# Composing Requests
# Base Urls
Sandbox
The Sandbox environment is provided for testing. Transaction responses are simulated and do not leave the platform for processing. No billing related items occur within this environment.
Sandbox url:
Production
The Production environment should be used for all LIVE transactional processing.
Production url:
# Versioning
The platform's semi-RESTful API is fully backwards compatible and versioning is not necessary. Changes and feature updates are sent out via the platform prior to release.
Current version:
1.5.1
# Headers
The following headers should be included with your requests:
# Authorization
Calls to the API must include an Authorization header with the request. Either a JWT (JSON Web Token) or an API Key can be used as the value of this header, like so:
Authorization: Bearer { JWTToken }
Authorization: { API Key }
# Api Keys
API keys are used to authenticate your requests to the API. You can create and manage your API keys in the control panel. API keys are tied to a user account.
Their are two types of API keys:
- Public API keys (ex: pub_***) - used for making requests to the API from the client side (ex. Tokenizer and Cart Sessions)
- Private API keys (ex: api_***) - used for making requests to the API from the server side (ex. Transaction Processing)
DANGER
Private API keys should never be exposed to the public. Please do not include them in client side code, emails or support ticket request.
DANGER
Use of Public API keys to make requests to the API from the server side will result in an unauthorzed response.
# Content-Type
Content-Type
should typically be set to application/json
, unless you need to send your request body in a different format. All API responses will be in JSON format.
# Users
# Create User
Create a new user account.
Request Method:
POST
URL Endpoint:
/api/user
Name | Type | Default | Description | Required |
---|---|---|---|---|
username | string | user's username (must contain alpha and numeric characters) | ||
name | string | user's first and last name | ||
phone | string | user's phone number, digits only | ||
string | user's email address (must be valid email format) | |||
timezone | string | user's timezone (ex. ETC/UTC) | ||
password | string | user's password | ||
status | string | user's status (active or disabled) | ||
role | string | user's defined role (admin or standard) |
{
"status": "success",
"msg": "success",
"data": {
"id": "b89227ij8m0nuanr1tk0",
"username": "testmerchant43",
"name": "test merchant user",
"phone": "6305555555",
"email": "info@website.com",
"timezone": "ETC/UTC",
"status": "active",
"role": "admin",
"account_type": "merchant",
"account_type_id": "aucio551tlv85l7moe5g",
"created_at": "2017-11-20T00:26:06.190264Z",
"updated_at": "2017-11-20T00:26:06.190264Z"
}
}
function createUser() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
username: "testmerchant43",
name: "test user",
phone: "6305555555",
email: "info@website.com",
timezone: "ETC/UTC",
password: "T@est12345678",
status: "active",
role: "admin",
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/user", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var id = result.data.id;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class CreateUserResponse : ApiResponse {
public User Data { get; set; }
}
public class User {
public string Id { get; set; }
public string Username { get; set; }
public string Name { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string Timezone { get; set; }
public string Password { get; set; }
public string Status { get; set; }
public string Role { get; set; }
}
public void createUser(User user) {
var client = new RestClient("https://sandbox.fluidpay.com/api/user");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(user);
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<CreateUserResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var newId = apiResponse.Data.Id;
} else {
// handle non success
}
}
<?php
function createUser($user) {
$curl = curl_init();
$payload = json_encode($user);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class User {
public String Id;
public String Username;
public String Name;
public String Phone;
public String Email;
public String Timezone;
public String Password;
public String Status;
public String Role;
}
public class CreateUserResponse extends ApiResponse {
public User Data;
}
public void createUser(User user) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(user);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/user")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
CreateUserResponse entity = objectMapper.readValue(responseBody.string(), CreateUserResponse.class);
if (entity.status === "success") {
// handle success
String newId = entity.Data.Id;
} else {
// handle non success
}
}
# Get User By ID
Retrieve the properties of a specific user.
Request Method:
GET
URL Endpoint:
/api/user/{ user id }
{
"status": "success",
"msg": "success",
"data": {
"id": "b89227ij8m0nuanr1tk0",
"username": "testmerchant43",
"name": "test merchant user",
"phone": "6305555555",
"email": "info@website.com",
"timezone": "ETC/UTC",
"status": "active",
"role": "admin",
"account_type": "merchant",
"account_type_id": "aucio551tlv85l7moe5g",
"created_at": "2017-11-20T00:26:06.190264Z",
"updated_at": "2017-11-20T00:26:06.190264Z"
}
}
function getUser(id) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/user/" + id, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var user = result.data;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void getUser(int id) {
var client = new RestClient("https://sandbox.fluidpay.com/api/user/" + id);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<CreateUserResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var user = apiResponse.Data;
} else {
// handle non success
}
}
<?php
function getUser($id) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/user/".$id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void getUser(int id) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/user/" + id)
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
CreateUserResponse entity = objectMapper.readValue(responseBody.string(), CreateUserResponse.class);
if (entity.status === "success") {
// handle success
User user = entity.Data;
} else {
// handle non success
}
}
# Get Authenticated User
Retrieve the properties of the currently authenticated user. This is intended as a helper function, it is recommended to get a specific user by providing the ID if possible.
Request Method:
GET
URL Endpoint:
/api/user
{
"status": "success",
"msg": "success",
"data": {
"id": "b89227ij8m0nuanr1tk0",
"username": "testmerchant43",
"name": "test merchant user",
"phone": "6305555555",
"email": "info@website.com",
"timezone": "ETC/UTC",
"status": "active",
"role": "admin",
"account_type": "merchant",
"account_type_id": "aucio551tlv85l7moe5g",
"created_at": "2017-11-20T00:26:06.190264Z",
"updated_at": "2017-11-20T00:26:06.190264Z"
}
}
function getAuthenticatedUser() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/user", requestOptions)
.then((response) => response.text())
.then((result) => {
var user = result.data;
})
.catch((error) => console.log("error", error));
}
public void getAuthenticatedUser() {
var client = new RestClient("https://sandbox.fluidpay.com/api/user");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<CreateUserResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var user = apiResponse.Data;
} else {
// handle non success
}
}
<?php
function getAuthenticatedUser() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json",
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void getAuthenticatedUser() {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/user")
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
CreateUserResponse entity = objectMapper.readValue(responseBody.string(), CreateUserResponse.class);
if (entity.status === "success") {
// handle success
User user = entity.Data;
} else {
// handle non success
}
}
# Get All Users
Retrieve the properties of all users for the gateway or partner account associated with the API Key or JWT token provided in the Authorization header.
Request Method:
GET
URL Endpoint:
/api/users
{
"status": "success",
"msg": "success",
"total_count": 3,
"data": [
{
"id": "b89227ij8m0nuanr1tk0",
"username": "testmerchant43",
"name": "test merchant user",
"phone": "6305555555",
"email": "info@website.com",
"timezone": "ETC/UTC",
"status": "active",
"role": "admin",
"account_type": "merchant",
"account_type_id": "aucio551tlv85l7moe5g",
"created_at": "2017-11-20T00:26:06.190264Z",
"updated_at": "2017-11-20T00:26:06.190264Z"
}
]
}
function getAllUsers() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow",
};
fetch("https://sandbox.fluidpay.com/api/users", requestOptions)
.then((response) => response.text())
.then((result) => {
var users = result.data;
users.array.forEach((user) => {
// do something with each user
});
})
.catch((error) => console.log("error", error));
}
public class GetAllUsersResponse : ApiResponse {
public List<User> Data { get; set; }
}
public void getAllUsers() {
var client = new RestClient("https://sandbox.fluidpay.com/api/users");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<GetAllUsersResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var users = apiResponse.Data;
foreach(var user in users) {
// do something with each user
}
} else {
// handle non success
}
}
<?php
function getAllUsers() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class GetUserResponse extends ApiResponse {
public ArrayList<User> Data;
}
public void getAllUsers() {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/users")
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
GetUserResponse entity = objectMapper.readValue(responseBody.string(), GetUserResponse.class);
if (entity.status === "success") {
// handle success
ArrayList<User> user = entity.Data;
} else {
// handle non success
}
}
# Update User
Edit the properties of an existing user account.
Request Method:
POST
URL Endpoint:
/api/user/{ user id }
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | user's first and last name | ||
phone | string | user's phone number, digits only | ||
string | user's email address (must be valid email format) | |||
timezone | string | user's timezone (ex. ETC/UTC) | ||
status | string | user's status (active or disabled) | ||
role | string | user's defined role (admin or standard) |
{
"status": "success",
"msg": "success",
"data": {
"id": "b89227ij8m0nuanr1tk0",
"username": "testmerchant43",
"name": "test merchant user",
"phone": "6305555555",
"email": "info@website.com",
"timezone": "ETC/UTC",
"status": "active",
"role": "admin",
"account_type": "merchant",
"account_type_id": "aucio551tlv85l7moe5g",
"created_at": "2017-11-20T00:26:06.190264Z",
"updated_at": "2017-11-20T00:26:06.190264Z"
}
}
function updateUser() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "test user",
phone: "6305555555",
email: "info@website.com",
timezone: "ETC/UTC",
status: "active",
role: "admin",
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/user/{ user id }", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void updateUser(User user) {
var client = new RestClient("https://sandbox.fluidpay.com/api/user/" + user.Id);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(user);
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function updateUser($user) {
$curl = curl_init();
$payload = json_encode($user);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/user/".$user->id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void updateUser(User user) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(user);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/user/{ user id }")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse entity = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (entity.status === "success") {
// handle success
} else {
// handle non success
}
}
# Delete User
Delete a specific user.
Request Method:
DELETE
URL Endpoint:
/api/user/{ user id }
{
"status": "success",
"msg": "successfully deleted",
"data": null
}
function deleteUser(int id) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "DELETE",
headers: myHeaders
};
fetch("https://sandbox.fluidpay.com/api/user/" + id, requestOptions)
.then(response => response.text())
.then(result => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch(error => console.log("error", error));
}
public void deleteUser(int id) {
var client = new RestClient("https://sandbox.fluidpay.com/api/user/" + id);
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function deleteUser($id) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/user/".$id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void deleteUser(int id) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/user/{ user id }")
.method("DELETE", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse entity = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (entity.status === "success") {
// handle success
} else {
// handle non success
}
}
# Change Password
Change a user's password. Must provide an API Key or JWT token associated with the user as the Authorization header value.
Request Method:
POST
URL Endpoint:
/api/user/change-password
Name | Type | Default | Description | Required |
---|---|---|---|---|
username | string | User's username | ||
current_password | string | User's current password | ||
new_password | string | The new password to be set on the user's account. Must be 8-64 characters and contain an uppercase character, a number, and a special character. |
{
"status": "success",
"msg": "Request processed successfully",
"data": null
}
function changePassword(username, currentPassword, newPassword) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
username: username,
current_password: currentPassword,
new_password: newPassword,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/user/change-password", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class ApiResponse {
public string Status { get; set; }
public string Msg { get; set; }
}
public class ChangePasswordModel {
public string Username { get; set; }
public string CurrentPassword { get; set; }
public string NewPassword { get; set; }
}
public void changePassword(ChangePasswordModel model) {
var client = new RestClient("https://sandbox.fluidpay.com/api/user/change-password");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(model);
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
$passwordChange = array(
"username" => "<username>",
"current_password" => "<current_password>",
"new_password" => "<new_password>"
);
function changePassword($passwordChange) {
$curl = curl_init();
$payload = json_encode($passwordChange);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/user/change-password",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class ApiResponse {
String status;
String msg;
}
public class ChangePasswordRequest {
String username;
@JsonProperty("current_password")
String currentPassword;
@JsonProperty("new_password")
String newPassword;
}
public void changePassword(ChangePasswordRequest requestData) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(requestData);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/user/change-password")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse entity = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (entity.status === "success") {
// handle success
} else {
// handle non success
}
}
# Transactions
# Process a Transaction
Process a transaction through the gateway.
TIP
If you do not have a default processor set, you must include the processor_id
property in the request body or the transaction will fail.
TIP
Base Amount - If you are using base_amount it will be the base amount of the transaction. The surcharge and other related fees(if applicable) will be calculated and added unless those values are specifically passed in.
Amount - This will be the final amount you want charged and will include all surcharges and related fees(if applicable).
Request Method:
POST
URL Endpoint:
/api/transaction
Name | Type | Default | Description | Required |
---|---|---|---|---|
duplicate_detection_seconds | uint | used to override duplicate detection | ||
type | string | "sale", "authorize", "verification" or "credit" | ||
amount | integer | Amount to process in cents (should contain all applicable fees and taxes) (1299 = $12.99) | ||
base_amount | integer | Amount to process in cents (surcharge and related fees will be added to this amount during processing) (1299 = $12.99) | ||
tax_exempt | boolean | false | Is the transaction tax exempt | Required for L3 |
tax_amount | integer | 0 | Tax Amount in cents | Required for L3 |
shipping_amount | integer | 0 | Shipping Amount in cents (should be included in Amount) | |
discount_amount | integer | 0 | Discount Amount in cents (should be included in Amount) | |
currency | string | "USD" | ISO 4217 currency (ex "USD") | |
description | string | "" | Text field for miscellaneous notes (max 255 characters) | |
order_id | string | Supports up to 15 alphanumeric characters | Required for L3 | |
po_number | string | Supports up to 15 alphanumeric characters | ||
processor_id | string | "" | Designates a specific processor for the transaction. If no value is provided, the transaction will run against the default processor set on your gateway. If no value is provided and there is no default set, the transaction will fail. | see description |
ip_address | string | Server IP | IPv4 or IPv6 value of the end user | |
allow_partial | bool | false | Allow partial transactions to be approved (only if supported by processor) | |
email_receipt | boolean | false | If true, sends an email receipt (email_address must be provided) | |
email_address | string | Email address (must be valid email format, "example@mail.com") | required if email_receipt is true | |
create_vault_record | boolean | false | If true, triggers the creation of a customer vault record after a successful transaction. Multiple transactions with the same details will create duplicative customer records. | |
vendor_id | string | "" | Vendor ID passed along to certain processors if supported (Special Field, only use if instructed by support) | |
billing_method | string | "straight" | "straight", "initial_recurring", or "recurring" | |
summary_commodity_code | string | Summary Commodity Code 4 AlphaNumeric characters | Required for L3 | |
ship_from_postal_code | string | Ship From Postal Code | Required for L3 | |
payment_adjustment | object | Object containing payment adjustment details. (ex. convenience fees, service fees, and surcharges) | ||
payment_adjustment .type | string | "" | "flat" or "percentage" | |
payment_adjustment .value | integer | 0 | Amount of adjustment in cents for "flat" (ex. 199 = $1.99) or 3 decimal places for "percentage" (ex. 1000 = 1.000%) | |
payment_method | object | Object containing payment method details, must contain only one of the following: card, ach, customer, terminal, token, apm | must include one payment method | |
payment_method .card | object | Object containing details for processing a transaction against a debit or credit card | ||
payment_method .card.entry_type | string | Must be "keyed" or "swiped" | ||
payment_method .card.number | string | Card number (digits only) | required if payment_method.card is present | |
payment_method .card.expiration_date | string | Expiration date (format MM/YY) | required if payment_method.card is present | |
payment_method .card.cvc | string | Card Verification Code | required if the applicable rule is set on the gateway | |
payment_method .card.track_1 | string | Decrypted track_1 | ||
payment_method .card.track_2 | string | Decrypted track_2 | ||
payment_method .card.encrypted_track_1 | string | Encrypted Track 1 | ||
payment_method .card.encrypted_track_2 | string | Encrypted Track 2 | ||
payment_method .card.ksn | string | KSN used to encrypt the supplied encrypted tracks | ||
payment_method .card.cardholder_authentication | object | Optionally pass 3DS collected data | if passed, it must contain valid values | |
payment_method .card.cardholder_authentication.eci | string | ECI indicator, ie 01,02,05,07..etc | ||
payment_method .card.cardholder_authentication.cavv | string | CAVV | ||
payment_method .card.cardholder_authentication.xid | string | XID | ||
payment_method .card.cardholder_authentication.cryptogram | string | Cryptogram | ||
payment_method .card.cardholder_authentication.version | string | Version, 1 or 2 | ||
payment_method .card.cardholder_authentication.ds_transaction_id | string | DS Transaction ID | ||
payment_method .card.cardholder_authentication.acs_transaction_id | string | ACS Transaction ID | ||
payment_method .ach | object | Object containing details for processing a transaction via ACH | ||
payment_method .ach.routing_number | string | Routing number for account to be charged | required if payment_method.ach is present | |
payment_method .ach.account_number | string | Account number for account to be charged | required if payment_method.ach is present | |
payment_method .ach.sec_code | string | SEC code for ACH transaction type: "web", "ccd", "ppd", or "tel" | required if payment_method.ach is present | |
payment_method .ach.account_type | string | ACH account type: "checking" or "savings" | required if payment_method.ach is present | |
payment_method .ach.check_number | string | Check number | required if payment_method.ach.sec_code = "tel" | |
payment_method .ach.accountholder_authentication | string | Object containing details for accountholder authentication | if required by processor | |
payment_method .ach.accountholder_authentication.dl_state | string | Driver's License state | required if payment_method.ach.accountholder_authentication is present | |
payment_method .ach.accountholder_authentication.dl_number | string | Driver's License number | required if payment_method.ach.accountholder_authentication is present | |
payment_method .customer | object | Object containing details for processing a transaction against a vaulted customer record | ||
payment_method .customer.id | string | Customer ID | required if payment_method.customer is present | |
payment_method .customer.payment_method_id | string | Customer default | ID of customer's saved payment method to be charged | |
payment_method .customer.payment_method_type | string | Customer default | The type of the payment method referenced in payment_method_id | |
payment_method .customer.billing_address_id | string | Customer default | ID of customer's saved billing address to be used | |
payment_method .customer.shipping_address_id | string | Customer default | ID of customer's saved shipping address to be used | |
payment_method .terminal | object | Object containing details for processing a transaction against a Terminal | ||
payment_method .terminal.id | string | ID of the terminal to be used for the transaction | required if payment_method.terminal is present | |
payment_method .terminal.expiration_date | string | Optionally pass an expiration date along with the transaction | ||
payment_method .terminal.cvc | string | Optionally pass a CVV along with the transaction | ||
payment_method .terminal.print_receipt | string | "no" (no receipt), "customer" (customer copy only), "merchant" (merchant copy only), or "both" (both copies) | required if payment_method.terminal is present | |
payment_method .terminal.signature_required | string | If true, requests that the terminal capture a signature (if supported) | required if payment_method.terminal is present | |
payment_method .apm | object | Object containing details for processing APM transactions | ||
payment_method .apm.type | string | APM type (see chart below) | required if payment_method.apm is present | |
payment_method .apm.merchant_redirect_url | string | This is the redirect url you wish to send the customer to after processing the payment | required if payment_method.apm is present | |
payment_method .apm.locale | string | Locale to be used for the payment page, if supported by the APM (ex. "en-US") | required if payment_method.apm is present | |
payment_method .apm.mobile_view | boolean | If true, tells the APM to render a mobile version of the landing page (if supported by the APM) | required if payment_method.apm is present | |
payment_method .apm.national_id | string | Consumer's National ID (max 30 characters) | ||
payment_method .apm.consumer_ref | string | Unique reference identifiying the customer. May contain [a-z0-9-], max 20 characters | ||
billing_address | object | null | Object containing billing address details | |
billing_address .first_name | string | Up to 50 characters | ||
billing_address .last_name | string | Up to 50 characters | ||
billing_address .company | string | Up to 100 characters | ||
billing_address .address_line_1 | string | Up to 100 characters | ||
billing_address .address_line_2 | string | Up to 100 characters | ||
billing_address .city | string | Up to 50 characters | ||
billing_address .state | string | State abbrevation | ||
billing_address .postal_code | string | If payment_method.card is present, defaults to Postal Code associated with card | Required for L3 | |
billing_address .country | string | "US" | ||
billing_address | string | Email address (must be valid email format, "example@mail.com") | ||
billing_address .phone | string | Digits only | ||
billing_address .fax | string | Digits only | ||
shipping_address | object | null | Object containing billing address details | |
shipping_address .first_name | string | Up to 50 characters | ||
shipping_address .last_name | string | Up to 50 characters | ||
shipping_address .company | string | Up to 100 characters | ||
shipping_address .address_line_1 | string | Up to 100 characters | ||
shipping_address .address_line_2 | string | Up to 100 characters | ||
shipping_address .city | string | Up to 50 characters | ||
shipping_address .state | string | State abbreviation | ||
shipping_address .postal_code | string | Required for L3 | ||
shipping_address .country | string | |||
shipping_address | string | Email address (must be valid email format, "example@mail.com") | ||
shipping_address .phone | string | Digits only | ||
shipping_address .fax | string | Digits only | ||
group_name | string | "default" | custom fields group name | |
custom_fields | object | Object based where the key is the id of the custom field and the value is an array of strings(even is single value) | Only required if fields are set to required | |
iias_status | string | "" | Required for HSA/FSA Valid values are: "verified" or "exempt" | |
additional_amounts | object | |||
additional_amounts .hsa.total | int | 0 | Required for HSA/FSA Total amount for HSA/FSA, passed as an unsigned integer | |
additional_amounts .hsa.rx_amount | int | 0 | RX AMount for HSA/FSA, passed as an unsigned integer | |
additional_amounts .hsa.vision_amount | int | 0 | Vision Mount for HSA/FSA, passed as an unsigned integer | |
additional_amounts .hsa.clinic_amount | int | 0 | Clinic Mount for HSA/FSA, passed as an unsigned integer | |
additional_amounts .hsa.dental_amount | int | 0 | Dental Mount for HSA/FSA, passed as an unsigned integer | |
line_items | array | Array of line items | Required for L3 | |
line_items[] name | string | Friendly name up to 50 alpha characters | ||
line_items[] description | string | Product Description up to 50 alpha characters | ||
line_items[] product_code | string | Product Code/SKU up to 50 alpha characters | ||
line_items[] commodity_code | string | Commodity Code up to 12 alpha characters | ||
line_items[] quantity | float64 | Quantity ##.## | ||
line_items[] discount_amount | int | in cents | ||
line_items[] freight_amount | int | in cents | ||
line_items[] unit_price | int | in cents | ||
line_items[] tax_amount | int | in cents | ||
line_items[] national_tax_amount | int | in cents | ||
line_items[] amount | int | in cents | ||
line_items[] national_tax_rate | string | 3 decimal rate. 10% = 10.000 | ||
line_items[] tax_rate | string | 3 decimal rate. 10% = 10.000 | ||
line_items[] unit_of_measure | string | |||
processor_specific | object | Optional: this only applys to specific processor types | ||
processor_specific .paysafe_direct.subscription_trial_solution | bool | |||
processor_specific .paysafe_direct.subscription_start_date | string | YYYY-MM-DD | ||
processor_specific .paysafe_direct.subscription_trial_start_date | string | YYYY-MM-DD | ||
processor_specific .paysafe_direct.subscription_trial_end_date | string | YYYY-MM-DD | ||
processor_specific .paysafe_direct.subscription_secondary_billing_date | string | YYYY-MM-DD | ||
processor_specific .paysafe_direct.subscription_cancel_url | string | weburl | ||
processor_specific .paysafe_direct.subscription_amount | uint | in cents | ||
processor_specific .paysafe_direct.subscription_unit_cost | uint | in cents | ||
processor_specific .paysafe_direct.subscription_item_quantity | uint | |||
processor_specific .paysafe_direct.subscription_product_desc | string | |||
descriptor | object | Optional: this only applys to specific processor types | ||
descriptor .name | string (38 Char) | |||
descriptor .address | string (38 Char) | |||
descriptor .city | string (21 Char) | |||
descriptor .state | string (2 Char) | |||
descriptor .postal_code | string (5 Char) |
Supported APMs
Type | Supported Processing Countries | Supported Currencies |
---|---|---|
alipay | CN | EUR, USD, GBP |
dragonpay | PH | PHP |
wechatpay | CN | EUR, USD |
oxxo | MX | USD, MXN |
klarna | AT, DK, FI, DE, NL, NO, SE, GB | EUR, DKK, GBP, NOK, SEK |
sepa | DE | EUR |
APM requirements
# SEPA
Field | Required |
---|---|
payment_method .apm.consumer_id | |
payment_method .apm.iban | |
payment_method .apm.mandate_reference | merchant assigned value referencing the mandate |
payment_method .apm.mandate_url | |
payment_method .apm.mandate_signature_date | YYYY-MM-DD |
# Alipay
Field | Required |
---|---|
payment_method .apm.mobile_view |
# DragonPay
Field | Required |
---|---|
billing_address | |
billing_address .phone |
# WeChatPay
Field | Required |
---|---|
payment_method .apm.locale |
# OXXO
Field | Description | Required |
---|---|---|
payment_method .apm.national_id | Consumer's national id (max 30 characters). Not required for OXXO MXN. | |
payment_method .apm.consumer_ref | Unique customer reference provided by merchant. (max 20 alphanumeric characters) | |
payment_method .apm.due_date | "YYYY-MM-DD" expiry date for payment voucher. Voucher expires at midnight local Mexico City Time. Only applies to OXXO MXN currency. | |
billing_address | Email address (must be valid email format, "example@mail.com") | |
billing_address .address_1 | ||
billing_address .postal_code |
# Klarna
Field | Description | Required |
---|---|---|
payment_method .apm.payment_method_category | "direct_debit", "direct_bank_transfer", "pay_now", "pay_later", or "pay_over_time" | |
payment_method .apm.purchase_type | "buy", "rent", "book", "subscribe", "download", "order", or "continue" (default = "continue") | |
payment_method .apm.hpp_title | Title to be used for Hosted Payment Page | |
payment_method .apm.logo_url | Logo Url to be used on Hosted Payment Page | |
billing_address | ||
shipping_address | ||
line_items[] .name | ||
line_items[] .quantity | ||
line_items[] .unit_of_measure | unit of measure | |
line_items[] .unit_price | unit price | |
line_items[] .amount | total amount | |
line_items[] .product_code | sku/reference | |
line_items[] .local_tax | tax amount per item | |
line_items[] .discount_amount | discount amount as an unsigned integer | |
tax_amount |
{
"status": "success",
"msg": "success",
"data": {
"id": "b7kgflt1tlv51er0fts0",
"type": "sale",
"amount": 1112,
"tax_amount": 100,
"tax_exempt": false,
"shipping_amount": 100,
"discount_amount": 0,
"payment_adjustment_type": "",
"payment_adjustment_value": 0,
"currency": "usd",
"description": "test transaction",
"order_id": "someOrderID",
"po_number": "somePONumber",
"ip_address": "4.2.2.2",
"email_receipt": false,
"email_address": "user@home.com",
"payment_method": "card",
"response": {
"card": {
"id": "b7kgflt1tlv51er0ftsg",
"card_type": "visa",
"first_six": "401200",
"last_four": "5439",
"masked_card": "401200******5439",
"expiration_date": "12/20",
"status": "approved",
"auth_code": "TAS731",
"processor_response_code": "00",
"processor_response_text": "APPROVAL TAS731 ",
"processor_type": "tsys_sierra",
"processor_id": "b7kgflt1tlv51er0f1sg",
"avs_response_code": "0",
"cvv_response_code": "M",
"processor_specific": {},
"created_at": "2017-10-19T20:15:19.80368Z",
"updated_at": "2017-10-19T20:15:20.777011Z"
}
},
"status": "pending_settlement",
"response_code": 100,
"customer_id": "aaaaaaaaaaaaaaaaaaaa",
"billing_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"address_line_2": "",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
},
"shipping_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"address_line_2": "",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
},
"created_at": "2017-10-19T20:15:19.560708Z",
"updated_at": "2017-10-19T20:15:20.832049Z"
}
}
{
"status": "success",
"msg": "success",
"data": {
"id": "b9efr9qj8m0ge2h7tat0",
"user_id": "aucio551tlv85l7moe60",
"idempotency_key": "",
"idempotency_time": 0,
"type": "sale",
"amount": 500,
"amount_authorized": 500,
"amount_captured": 500,
"amount_settled": 0,
"processor_id": "",
"processor_type": "",
"payment_method": "terminal",
"payment_type": "",
"tax_amount": 100,
"tax_exempt": false,
"shipping_amount": 100,
"discount_amount": 0,
"payment_adjustment_type": "",
"payment_adjustment_value": 0,
"currency": "usd",
"description": "test transaction",
"order_id": "someOrderID",
"po_number": "somePONumber",
"ip_address": "4.2.2.2",
"transaction_source": "api",
"email_receipt": false,
"customer_id": "",
"referenced_transaction_id": "",
"response_body": {
"terminal": {
"id": "b9efr9qj8m0ge2h7tatg",
"card_type": "mastercard",
"payment_type": "credit",
"entry_type": "swiped",
"first_four": "5424",
"last_four": "3333",
"masked_card": "5424********3333",
"cardholder_name": "FDCS TEST CARD /MASTERCARD",
"auth_code": "",
"response_code": 100,
"processor_response_text": "APPROVAL VTLMC1",
"processor_specific": {
"BatchNum": "8",
"CashBack": "0.00",
"ClerkID": "",
"DISC": "0.00",
"EBTCashAvailBalance": "",
"EBTCashBeginBalance": "",
"EBTCashLedgerBalance": "",
"EBTFSAvailBalance": "",
"EBTFSBeginBalance": "",
"EBTFSLedgerBalance": "",
"Fee": "0.00",
"InvNum": "someOrderID",
"Language": "English",
"ProcessData": "",
"RefNo": "",
"RewardCode": "",
"RewardQR": "",
"RwdBalance": "0",
"RwdIssued": "",
"RwdPoints": "0",
"SHFee": "0.00",
"SVC": "0.00",
"TableNum": "0",
"TicketNum": "",
"Tip": "0.00",
"TotalAmt": "5.00"
},
"emv_aid": "",
"emv_app_name": "",
"emv_tvr": "",
"emv_tsi": "",
"signature_data": "Qk0OIQAAAAAAAD4AAAAoAAAALgEAANIAAAABAAEAAAAAANAgAADEDgAAxA4AAAAA//////////////////////////8f//////////////8AAA=",
"created_at": "2018-01-15T19:14:47.225068Z",
"updated_at": "2018-01-15T19:15:02.335853Z"
}
},
"status": "pending_settlement",
"response": "approved",
"response_code": 100,
"billing_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"address_line_2": "",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
},
"shipping_address": {
"first_name": "",
"last_name": "",
"company": "",
"address_line_1": "",
"address_line_2": "",
"city": "",
"state": "",
"postal_code": "",
"country": "",
"phone": "",
"fax": "",
"email": ""
},
"created_at": "2018-01-15T19:14:47.108371Z",
"updated_at": "2018-01-15T19:15:02.529558Z",
"captured_at": "2018-01-15T19:14:47.337763Z",
"settled_at": null
}
}
# Process a Transaction - Code Samples
curl -v -X POST \
-H "Authorization: APIKEY" \
-H "Content-Type: application/json" \
-d '{
"type": "sale",
"amount": 1112,
"tax_amount": 100,
"shipping_amount": 100,
"currency": "USD",
"description": "test transaction",
"order_id": "someOrderID",
"po_number": "somePONumber",
"ip_address": "4.2.2.2",
"email_receipt": false,
"email_address": "user@home.com",
"create_vault_record": true,
"payment_method": {
"card": {
"entry_type": "keyed",
"number": "4012000098765439",
"expiration_date": "12/20",
"cvc": "999"
}
... or ...
"customer": {
"id": "b798ls2q9qq646ksu070",
"payment_method_type": "card",
"payment_method_id": "b798ls2q9qq646ksu080",
"billing_address_id": "b798ls2q9qq646ksu07g",
"shipping_address_id": "b798ls2q9qq646ksu07g"
}
... or ...
"terminal": {
"id": "<terminal id>"
"expiration_date": "12/20",
"cvc": "999",
"print_receipt": "both"
"signature_required": true
}
... or ...
"token": "<tokenizer token goes here>",
... or ...
"ach": {
"routing_number": "490000018",
"account_number": "999999",
"sec_code": "ccd",
"account_type": "checking",
"check_number":"1223",
"accountholder_authentication": {
"dl_state": "IL",
"dl_number": "r500123123"
}
... or ...
"apm": {
"type": "alipay",
"merchant_redirect_url": "http://merchantwebsite.com/",
"locale": "en-US",
"mobile_view": false
}
}
},
"billing_address" : {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
},
"shipping_address" : {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
}
}' \
"https://sandbox.fluidpay.com/api/transaction"
var card = {
entry_type: "keyed",
number: "4111111111111111",
expiration_date: "12/22",
cvc: "999",
};
var customer = {
id: "{ customer id }",
payment_method_type: "card",
payment_method_id: "abcd1234",
billing_address_id: "abcd1234",
shipping_address_id: "abcd1234",
};
var terminal = {
id: "{ terminal id }",
expiration_date: "12/22",
cvc: "999",
print_receipt: "both",
signature_required: true,
};
var ach = {
routing_number: "123456789",
account_number: "234567890",
sec_code: "ccd",
account_type: "checking",
check_number: "1234",
accountholder_authentication: {
dl_state: "IL",
dl_number: "r123123123",
},
};
var billingAddress = {
first_name: "John",
last_name: "Smith",
company: "Test Company",
address_line_1: "123 Some St",
address_line_2: "",
city: "Wheaton",
state: "IL",
postal_code: "60187",
country: "US",
phone: "5555555555",
fax: "5555555555",
email: "help@website.com",
};
var shippingAddress = {
first_name: "John",
last_name: "Smith",
company: "Test Company",
address_line_1: "123 Some St",
address_line_2: "",
city: "Wheaton",
state: "IL",
postal_code: "60187",
country: "US",
phone: "5555555555",
fax: "5555555555",
email: "help@website.com",
};
var apm = {
type: "alipay",
merchant_redirect_url: "https://merchantwebsite.com/",
locale: "en-US",
mobile_view: false,
};
var transaction = {
type: "sale",
amount: 1112,
tax_amount: 100,
shipping_amount: 100,
currency: "USD",
description: "test transaction",
order_id: "someOrderID",
po_number: "somePONumber",
ip_address: "4.2.2.2",
email_receipt: false,
email_address: "user@home.com",
create_vault_record: true,
payment_method: {
card: card, // ... or ...
// token: "{ tokenizer token }" ... or ...
// customer: customer ... or ...
// terminal: terminal ... or ...
// ach: ach ... or ...
// apm: apm
},
billing_address: billingAddress,
shipping_address: shippingAddress,
};
// Process Transaction
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var jsonString = JSON.stringify(transaction); // Based upon your setup. You may or may not need to stringify
var requestOptions = {
method: "POST",
headers: myHeaders,
body: jsonString,
redirect: "follow",
};
fetch("https://sandbox.fluidpay.com/api/transaction", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
public class PaymentMethod {
public string Token { get; set; }
public Card Card { get; set; }
public Customer Customer { get; set; }
public Terminal Terminal { get; set; }
public Ach Ach { get; set; }
public Apm Apm { get; set; }
}
public class Card {
public string EntryType { get; set; }
public string Number { get; set; }
public string ExpirationDate { get; set; }
public string Cvc { get; set; }
}
public class Customer {
public string Id { get; set; }
public string PaymentMethodType { get; set; }
public string PaymentMethodId { get; set; }
public string BillingAddressId { get; set; }
public string ShippingAddressId { get; set; }
}
public class Terminal {
public string ExpirationDate { get; set; }
public string Cvc { get; set; }
public string PrintReceipt { get; set; }
public string SignatureRequired { get; set; }
}
public class AccountholderAuthentication {
public string DlState { get; set; }
public string DlNumber { get; set; }
}
public class Ach {
public string RoutingNumber { get; set; }
public string AccountNumber { get; set; }
public string SecCode { get; set; }
public string AccountType { get; set; }
public string CheckNumber { get; set; }
public AccountholderAuthentication AccountholderAuthentication { get; set; }
}
public class Apm {
public string Type { get; set; }
public string MerchantRedirectUrl { get; set; }
public string Locale { get; set; }
public bool MobileView { get; set; }
}
public class Address {
public string First_name { get; set; }
public string Last_name { get; set; }
public string Company { get; set; }
public string Address_line_1 { get; set; }
public string Address_line_2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Postal_code { get; set; }
public string Country { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public string Email { get; set; }
}
public class Transaction {
public string Type { get; set; }
public int Amount { get; set; }
public int TaxAmount { get; set; }
public int ShippingAmount { get; set; }
public string Currency { get; set; }
public string Description { get; set; }
public string OrderId { get; set; }
public string PoNumber { get; set; }
public string IpAddress { get; set; }
public bool EmailReceipt { get; set; }
public string EmailAddress { get; set; }
public bool CreateVaultRecord { get; set; }
public PaymentMethod PaymentMethod { get; set; }
public Address BillingAddress { get; set; }
public Address ShippingAddress { get; set; }
}
public void processTransaction(Transaction transaction) {
Transaction transaction = new Transaction();
transaction.PaymentMethod = new Card();
// Process Transaction
var client = new RestClient("https://sandbox.fluidpay.com/api/transaction");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "{ api key }");
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(transaction);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
}
<?php
$transaction = array(
"type" => "sale",
"amount" => 1112,
"tax_amount" => 100,
"shipping_amount" => 100,
"currency" => "USD",
"description" => "test transaction",
"order_id" => "someOrderID",
"po_number" => "somePONumber",
"ip_address" => "4.2.2.2",
"email_receipt" => false,
"email_address" => "user@home.com",
"create_vault_record" => true,
"payment_method" => array(
"card" => array(
"entry_type" => "keyed",
"number" => "4111111111111111",
"expiration_date" => "12/22",
"cvc" => "999"
)
/* ... or ...
"customer" => array(
"id" => "{ customer ID }",
"payment_method_type" => "card",
"payment_method_id" => "b798ls2q9qq646ksu080",
"billing_address_id" => "b798ls2q9qq646ksu07g",
"shipping_address_id" => "b798ls2q9qq646ksu07g"
)
*/
/* ... or ...
"terminal" => array(
"id" => "{ terminal id }"
"expiration_date" => "12/20",
"cvc" => "999",
"print_receipt" => "both"
"signature_required" => true
)
*/
/* ... or ...
"token" => "{ tokenizer token }",
*/
/* ... or ...
"ach" => array(
"routing_number" => "123456789",
"account_number" => "234567890",
"sec_code" => "ccd",
"account_type" => "checking",
"check_number" => "1234",
"accountholder_authentication" => array(
"dl_state" => "IL",
"dl_number" => "r123123123"
)
)
*/
/* ... or ...
"apm" => array(
"type" => "alipay",
"merchant_redirect_url" => "https://merchantwebsite.com/",
"locale" => "en-US",
"mobile_view" => false
)
*/
),
"billing_address" => array(
"first_name" => "John",
"last_name" => "Smith",
"company" => "Test Company",
"address_line_1" => "123 Some St",
"address_line_2" => "",
"city" => "Wheaton",
"state" => "IL",
"postal_code" => "60187",
"country" => "US",
"phone" => "5555555555",
"fax" => "5555555555",
"email" => "help@website.com"
),
"shipping_address" => array(
"first_name" => "John",
"last_name" => "Smith",
"company" => "Test Company",
"address_line_1" => "123 Some St",
"address_line_2" => "",
"city" => "Wheaton",
"state" => "IL",
"postal_code" => "60187",
"country" => "US",
"phone" => "5555555555",
"fax" => "5555555555",
"email" => "help@website.com"
)
);
function processTransaction ($transaction) {
$curl = curl_init();
$payload = json_encode($transaction);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
processTransaction($transaction);
public class PaymentMethod {
public string token;
public Card card;
public Customer customer;
public Terminal terminal;
public Ach ach;
public Apm apm;
}
public class Card {
@JsonProperty("entry_type")
public string entryType;
public string number;
@JsonProperty("expiration_date")
public string expirationDate;
public string cvc;
}
public class Customer {
public string id;
@JsonProperty("payment_method_type")
public string paymentMethodType;
@JsonProperty("payment_method_id")
public string paymentMethodId;
@JsonProperty("billing_address_id")
public string billingAddressId;
@JsonProperty("shipping_address_id")
public string shippingAddressId;
}
public class Terminal {
@JsonProperty("expiration_date")
public string expirationDate;
public string cvc;
@JsonProperty("print_receipt")
public string printReceipt;
@JsonProperty("signature_required")
public string signatureRequired;
}
public class AccountholderAuthentication {
@JsonProperty("dl_state")
public string dlState;
@JsonProperty("dl_number")
public string dlNumber;
}
public class Ach {
@JsonProperty("routing_number")
public string routingNumber;
@JsonProperty("account_number")
public string accountNumber;
@JsonProperty("sec_code")
public string secCode;
@JsonProperty("account_type")
public string accountType;
@JsonProperty("check_number")
public string checkNumber;
@JsonProperty("accountholder_authentication")
public AccountholderAuthentication accountholderAuthentication;
}
public class Apm {
public string type;
@JsonProperty("merchant_redirect_url")
public string merchantRedirectUrl;
public string locale;
@JsonProperty("mobile_view")
public bool mobileView;
}
public class Address {
@JsonProperty("first_name")
public string firstName;
@JsonProperty("last_name")
public string lastName;
public string company;
@JsonProperty("address_line_1")
public string addressLine1;
@JsonProperty("address_line_2")
public string addressLine2;
public string city;
public string state;
@JsonProperty("postal_code")
public string postalCode;
public string country;
public string phone;
public string fax;
public string email;
}
public class Transaction {
public string id;
public string type;
public int amount;
@JsonProperty("tax_amount")
public int taxAmount;
@JsonProperty("shipping_amount")
public int shippingAmount;
public string currency;
public string description;
@JsonProperty("order_id")
public string orderId;
@JsonProperty("po_number")
public string poNumber;
@JsonProperty("ip_address")
public string ipAddress;
@JsonProperty("email_receipt")
public bool emailReceipt;
@JsonProperty("email_address")
public string emailAddress;
@JsonProperty("create_vault_record")
public bool createVaultRecord;
@JsonProperty("payment_method")
public PaymentMethod paymentMethod;
@JsonProperty("billing_address")
public Address billingAddress;
@JsonProperty("shipping_address")
public Address shippingAddress;
}
public void processTransaction(Transaction transaction) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(transaction);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/transaction")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
}
# Fee Calculation
TIP
Using this endpoint will calculate any applicable fees that should be applied to the transaction. This includes Surcharge, Cash Discount Fees and Payment Adjustment, if applicable.
Request Method:
POST
URL Endpoint:
/api/lookup/fees
Name | Type | Required | Description |
---|---|---|---|
type | string | yes | type of request, "integrations" |
state | string | no | billing address state |
bin | string | yes | 6 - 19 digits of a card |
payment_method | string | yes | card |
base_amount | uint | yes | amount in lowest form of currency. $1.00 = 100 |
➜ ~ curl -H 'Authorization: API_KEY' -H "Content-Type: application/json" -X POST -d '{
"type": "integrations",
"type_id":"",
"state": "IL",
"bin": "517246700",
"payment_method": "card",
"base_amount": 1000
}' { url goes here }/api/api/lookup/fees
{
"status": "success",
"msg": "success",
"data": {
"service_fee": 0,
"payment_adjustment": {
"value": 0,
"type": ""
},
"requested_amount": 1350,
"discount_amount": null,
"surcharge": 350
}
}
# Response Codes
TIP
Response Codes are grouped as follows: 100 thru 199 are Approvals and Partial Approvals. 200 thru 299 are Declined via the processor. 300 thru 399 are Gateway Declines. 400 thru 499 are processor rejection errors.
Response Code | Processor Definition | Description |
---|---|---|
0 | Unknown | Unknown, please contact support for more information |
99 | Pending payment | Used in redirect processors prior to payment being received |
100 | Approved | Transaction was successfully approved |
110 | Partial approval | Transaction was successfully approved, but for a lesser amount |
200 - 299 | Decline | Transaction has been declined by the issuer for various reasons |
300 - 399 | Gateway Decline | Platform decline for configuration or fraud reasons |
400 - 499 | Transaction error returned by processor | Errors returned from the processor |
Response Code | Processor Definition | Description |
---|---|---|
0 | Unknown | Unknown, please contact support for more information |
99 | Pending payment | Used in redirect processors prior to payment being received |
100 | Approved | Transaction was successfully approved |
110 | Partial approval | Transaction was successfully approved, but for a lesser amount |
101 | Approved, pending customer approval | Transaction is pending customer approval before release |
200 | Decline | Generic decline with no additional information provided by the issuer |
201 | Do not honor | Generic decline with no additional information provided by the issuer |
202 | Insufficient funds | Declined for insufficient funds |
203 | Exceeds withdrawn limit | Declined for exceeding a withdrawn limit set by the issuer |
204 | Invalid Transaction | Declined as the issuer does not recognize the transaction |
205 | SCA Decline | Soft Decline indicating that a SCA challenge is required |
220 | Invalid Amount | Provided amount is not supported by the issuer |
221 | No such Issuer | The issuing bank can not be found |
222 | No credit Acct | Invalid credit card number |
223 | Expired Card | Credit card as expired and can not be processed |
225 | Invalid CVC | Invalid CVC or CVV2 value has been provided |
226 | Cannot Verify Pin | Card requires PIN |
240 | Refer to issuer | Generic decline by the issuing bank |
250 | Pick up card (no fraud) | Decline where issuer is requesting the merchant hold the card |
251 | Lost card, pick up (fraud account) | Decline where issuer is requesting the merchant hold the card |
252 | Stolen card, pick up (fraud account) | Decline where issuer is requesting the merchant hold the card |
253 | Pick up card, special condition | Decline where issuer is requesting the merchant hold the card |
261 | Stop recurring | Decline requesting recurring be stopped |
262 | Stop recurring | Decline requesting recurring be stopped |
300 | Gateway Decline | Generic Platform decline |
301 | Gateway Decline - Duplicate Transaction | The gateway detected this as a duplicate transaction. Order ID, payment type, amount and payment method are used to detect duplicate transactions. |
310 | Gateway Decline - Rule Engine | Platform has declined based on a fraud rule |
320 | Gateway Decline - Chargeback | The transaction was declined because the previous transaction was charged back |
321 | Gateway Decline - Stop Fraud | The transaction was declined because the customer record has been flagged as "stop_fraud" |
322 | Gateway Decline - Closed Contact | The transaction was declined because the customer record has been flagged as "closed_contact" |
323 | Gateway Decline - Stop Recurring | The transaction was declined because the customer record has been flagged as "stop_recurring" |
400 | Transaction error returned by processor | Generic error returned from the processor |
410 | Invalid merchant configuration | Configuration error returned from the processor |
421 | Communication error with processor | Processor is unreachable |
430 | Duplicate transaction at processor | Processor is seeing this as a duplicate transaction |
440 | Processor Format error | Processor has indicated that there is a formating error |
# Address Verification Response Codes (AVS)
AVS Response Code | Definition | Code Applies to | Card Brands |
---|---|---|---|
0 | AVS Not Available | Domestic + International | V, MC, AX, D, PP, JCB |
A | Address match only | Domestic + International | V, AX, D,PP, JCB |
B | Address matches, ZIP not verified | Domestic + International | V |
C | Incompatible format | Domestic + International | V |
D | Exact match | International | V |
F | Exact match, UK-issued cards | Domestic + International | V |
G | Non-U.S. Issuer does not participate | International | V |
I | Not verified | International | V, D, PP, JCB |
M | Exact match | International | V |
N | No address or ZIP match | Domestic + International | V, MC, AX, D, PP, JCB |
P | Postal Code match | Domestic + International | V |
R | Issuer system unavailable | Domestic | V, MC, AX, D, PP, JCB |
S | Service not supported | Domestic | MC, AX, D, PP, JCB |
U | Address unavailable | Domestic | V, MC, AX, D, PP, JCB |
W | 9-character numeric ZIP match only | Domestic + International (MC) | MC, D, PP, JCB |
X | Exact match, 9-character numeric ZIP | Domestic + International (MC) | MC, D, PP, JCB |
Y | Exact match, 5-character numeric ZIP | Domestic | V, MC, AX, D, PP, JCB |
Z | 5-character ZIP match only | Domestic + International (V) | V, MC, AX, D, PP, JCB |
1 | Cardholder name and ZIP match | Domestic | AX |
2 | Cardholder name, address and ZIP match | Domestic | AX |
3 | Cardholder name and address match | Domestic | AX |
4 | Cardholder name matches | Domestic | AX |
5 | Cardholder name incorrect, ZIP matches | Domestic | AX |
6 | Cardholder name incorrect, address and zip match | Domestic | AX |
7 | Cardholder name incorrect, address matches | Domestic | AX |
8 | Cardholder name, address, and ZIP do not match | Domestic | AX |
# Get Transaction By ID
Retrieve details for a specific transaction.
Request Method:
GET
URL Endpoint:
/api/transaction/{ transaction ID }
{
"status": "success",
"msg": "success",
"data": [
{
"id": "b7kgflt1tlv51er0fts0",
"type": "sale",
"amount": 1112,
"tax_amount": 100,
"tax_exempt": false,
"shipping_amount": 100,
"currency": "usd",
"description": "test transaction",
"order_id": "someOrderID",
"po_number": "somePONumber",
"ip_address": "4.2.2.2",
"email_receipt": false,
"payment_method": "card",
"response": {
"card": {
"id": "b7kgflt1tlv51er0ftsg",
"card_type": "visa",
"first_six": "401200",
"last_four": "5439",
"masked_card": "401200******5439",
"expiration_date": "12/20",
"status": "approved",
"auth_code": "TAS731",
"processor_response_code": "00",
"processor_response_text": "APPROVAL TAS731 ",
"processor_type": "tsys_sierra",
"processor_id": "b7kgflt1tlv51er0f1sg",
"avs_response_code": "0",
"cvv_response_code": "M",
"processor_specific": {},
"created_at": "2017-10-19T20:15:19.80368Z",
"updated_at": "2017-10-19T20:15:20.777011Z"
}
},
"status": "pending_settlement",
"billing_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"address_line_2": "",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
},
"shipping_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Test Company",
"address_line_1": "123 Some St",
"address_line_2": "",
"city": "Wheaton",
"state": "IL",
"postal_code": "60187",
"country": "US",
"phone": "5555555555",
"fax": "5555555555",
"email": "help@website.com"
},
"created_at": "2017-10-19T20:15:19.560708Z",
"updated_at": "2017-10-19T20:15:20.832049Z"
}
],
"total_count": 1
}
function getTransactionStatus(transactionId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/transaction/" + transactionId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var status = result.data.status;
var response = result.data.response;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class TransactionStatusData {
public string Id { get; set; }
public string Type { get; set; }
public int Amount { get; set; }
public int Tax_amount { get; set; }
public bool Tax_exempt { get; set; }
public int Shipping_amount { get; set; }
public string Currency { get; set; }
public string Description { get; set; }
public string Order_id { get; set; }
public string Po_number { get; set; }
public string Ip_address { get; set; }
public string Email_receipt { get; set; }
public string Payment_method { get; set; }
public TransactionResponse Response { get; set; }
public string Status { get; set; }
public Address Billing_Address { get; set; }
public Address Shipping_Address { get; set; }
public DateTime Created_at { get; set; }
public DateTime Updated_at { get; set; }
}
public void getTransactionStatus(string transactionId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/transaction/" + transactionId);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
IRestResponse response = client.Execute(request);
var apiResponse = JsonConvert.DeserializeObject<GetTransactionStatusResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var status = apiResponse.Data.Status;
var response = apiResponse.Data.Response;
} else {
// handle non success
}
}
<?php
function getTransactionStatus($transactionId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/transaction/".$transactionId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class GetTransactionStatusResponse extends ApiResponse {
public TransactionStatusData data;
}
public class TransactionStatusData {
public String id;
public String type;
public int amount;
public int tax_amount;
public bool tax_exempt;
public int shipping_amount;
public String currency;
public String description;
public String order_id;
public String po_number;
public String ip_address;
public String email_receipt;
public String payment_method;
public TransactionResponse response;
public String status;
public Address billing_Address;
public Address shipping_Address;
public DateTime created_at;
public DateTime updated_at;
}
public void getTransactionStatus(String transactionId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/transaction/" + transactionId)
.method("GET", null)
.addHeader("Authorization", apiKey)
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
GetTransactionStatusResponse entity = objectMapper.readValue(responseBody.string(), GetTransactionStatusResponse.class);
if (entity.status === "success") {
// handle success
String status = apiResponse.data.status;
String responseString = apiResponse.data.response;
} else {
// handle non success
}
}
# Search Transactions
Retrieve details for all transactions that match provided search criteria.
Request Method:
POST
URL Endpoint:
/api/transaction/search
Name | Type | Description |
---|---|---|
transaction_id | QuerySearchString | Searches for transaction id |
user_id | QuerySearchString | Searches for user_id |
type | QuerySearchString | Searches for transaction type (sale, authorize...etc) |
ip_address | QuerySearchString | Searches for ip_address, either ipv4 or ipv6 |
amount | QuerySearchInt | Searches for originally requested amount |
amount_authorized | QuerySearchInt | Searches for amount_authorized |
amount_captured | QuerySearchInt | Searches for amount_captured |
amount_settled | QuerySearchInt | Searches for amount_settled |
tax_amount | QuerySearchInt | Searches for tax_amount |
po_number | QuerySearchString | Searches for po_number |
order_id | QuerySearchString | Searches for order_id |
payment_method | QuerySearchString | Searches by payment_method, (token, card, terminal) |
payment_type | QuerySearchString | Searches by payment_type (card, echeck) |
status | QuerySearchString | Searches by transaction status (unknown, declined, authorized, pending_settlement, settled, voided, reversed, refunded) |
processor_id | QuerySearchString | Searches by processor_id |
customer_id | QuerySearchString | Searches by customer_id |
created_at | QueryDateRange | Searches by created_at between the provided start_date and end_date. (Dates in UTC "YYYY-MM-DDTHH:II:SSZ") |
captured_at | QueryDateRange | Searches by captured_at between the provided start_date and end_date. (Dates in UTC "YYYY-MM-DDTHH:II:SSZ") |
settled_at | QueryDateRange | Searches by settled_at between the provided start_date and end_date. (Dates in UTC "YYYY-MM-DDTHH:II:SSZ") |
billing_address .address_id | QuerySearchString | Searches by billing_address.id |
billing_address .first_name | QuerySearchString | Searches by billing_address.first_name (0-50 characters) |
billing_address .last_name | QuerySearchString | Searches by billing_address.last_name (0-50 characters) |
billing_address .company | QuerySearchString | Searches by billing_address.company (0-50 characters) |
billing_address .address_line_1 | QuerySearchString | Searches by billing_address.address_line_1 (0-100 characters) |
billing_address .address_line_2 | QuerySearchString | Searches by billing_address.address_line_2 (0-100 characters) |
billing_address .city | QuerySearchString | Searches by billing_address.city (0-50 characters) |
billing_address .state | QuerySearchString | Searches by billing_address.state (2 Character) |
billing_address .postal_code | QuerySearchString | Searches by billing_address.postal_code (0-6 Characters) |
billing_address .country | QuerySearchString | Searches by billing_address.country (2 Characters) |
billing_address | QuerySearchString | Searches by billing_address.email |
billing_address .phone | QuerySearchString | Searches by billing_address.phone (0-14 digits only) |
billing_address .fax | QuerySearchString | Searches by billing_address.fax (0-14 digits only) |
shipping_address .address_id | QuerySearchString | Searches by shipping_address.id |
shipping_address .first_name | QuerySearchString | Searches by shipping_address.first_name (0-50 characters) |
shipping_address .last_name | QuerySearchString | Searches by shipping_address.last_name (0-50 characters) |
shipping_address .company | QuerySearchString | Searches by shipping_address.company (0-50 characters) |
shipping_address .address_line_1 | QuerySearchString | Searches by shipping_address.address_line_1 (0-100 characters) |
shipping_address .address_line_2 | QuerySearchString | Searches by shipping_address.address_line_2 (0-100 characters) |
shipping_address .city | QuerySearchString | Searches by shipping_address.city (0-50 characters) |
shipping_address .state | QuerySearchString | Searches by shipping_address.state (2 Character) |
shipping_address .postal_code | QuerySearchString | Searches by shipping_address.postal_code (0-6 Characters) |
shipping_address .country | QuerySearchString | Searches by shipping_address.country (2 Characters) |
shipping_address | QuerySearchString | Searches by shipping_address.email |
shipping_address .phone | QuerySearchString | Searches by shipping_address.phone (0-14 digits only) |
shipping_address .fax | QuerySearchString | Searches by shipping_address.fax (0-14 digits only) |
limit | integer | |
offset | integer |
Request Body Type Values
Type | Operators |
---|---|
QuerySearchString | =, != |
QuerySearchInt | =, !=, <, > |
{
"status": "success",
"msg": "",
"total_count": 1,
"data": [
{
"id": "b84vgb2j8m0jujadi4v0",
"user_id": "aucio551tlv85l7moe60",
"idempotency_key": "",
"idempotency_time": 0,
"type": "sale",
"amount": 1112,
"amount_authorized": 1112,
"amount_captured": 1112,
"amount_settled": 0,
"processor_id": "aucio551tlv85l7moe7g",
"processor_type": "tsys_sierra",
"payment_method": "token",
"payment_type": "card",
"tax_amount": 100,
"tax_exempt": false,
"shipping_amount": 100,
"currency": "usd",
"description": "test transaction",
"order_id": "someOrderID",
"po_number": "somePONumber",
"ip_address": "?01",
"transaction_source": "api",
"email_receipt": false,
"customer_id": "b81ko5qq9qq5v460r9i0",
"referenced_transaction_id": "",
"response_body": {},
"status": "pending_settlement",
"response": "approved",
"response_code": 100,
"billing_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Some Company",
"address_line_1": "123 Some St",
"address_line_2": "STE 203",
"city": "SomeTown",
"state": "IL",
"postal_code": "55555",
"country": "US",
"phone": "5555555555",
"fax": "",
"email": "info@website.com"
},
"shipping_address": {
"first_name": "John",
"last_name": "Smith",
"company": "Some Company",
"address_line_1": "123 Some St",
"address_line_2": "STE 203",
"city": "SomeTown",
"state": "IL",
"postal_code": "55555",
"country": "US",
"phone": "5555555555",
"fax": "",
"email": "info@website.com"
},
"created_at": "2017-11-13T19:53:17Z",
"updated_at": "2017-11-13T19:53:18Z",
"captured_at": null,
"settled_at": null
}
]
}
function searchTransactions(transactionId, amount, billingAddressFirstName) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
transaction_id: {
operator: "=",
value: transactionId,
},
amount: {
operator: "=",
value: amount,
},
billing_address: {
first_name: {
operator: "=",
value: billingAddressFirstName,
},
},
// ... other search criteria as needed
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/transaction/search", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success" && result.data.length) {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class QueryResponse : ApiResponse {
public List<TransactionData> Data { get; set; }
}
public class TransactionData {
public string Id { get; set; }
public string Type { get; set; }
public int Amount { get; set; }
public int Tax_amount { get; set; }
public bool Tax_exempt { get; set; }
public int Shipping_amount { get; set; }
public string Currency { get; set; }
public string Description { get; set; }
public string Order_id { get; set; }
public string Po_number { get; set; }
public string Ip_address { get; set; }
public string Email_receipt { get; set; }
public string Payment_method { get; set; }
public string Response { get; set; }
public string Status { get; set; }
public Address Billing_Address { get; set; }
public Address Shipping_Address { get; set; }
public DateTime Created_at { get; set; }
public DateTime Updated_at { get; set; }
}
public class OperatorValueCriteria {
public string Order { get; set; }
public T Value { get; set; }
}
public class AddressCriteria {
public OperatorValueCriteria First_name { get; set; }
}
public class SearchCriteria {
public OperatorValueCriteria Transaction_id { get; set; }
public OperatorValueCriteria Amount { get; set; }
public AddressCriteria Billing_Address { get; set; }
}
public void searchTransactions(SearchCriteria criteria) {
var client = new RestClient("https://sandbox.fluidpay.com/api/transaction/search");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", , ParameterType.RequestBody);
request.AddJsonBody(criteria);
IRestResponse response = client.Execute(request);
QueryResponse apiResponse = JsonConvert.DeserializeObject<QueryResponse>(response);
if (apiResponse.Status === "success" && apiResponse.Data.Count) {
// handle success
} else {
// handle non success
}
}
<?php
$transactionSearchCriteria = array(
"transaction_id" => array(
"operator" => "=",
"value" => "bsdk191erttqnm79q5lg"
),
"amount" => array(
"operator" => "=",
"value" => 1112
),
"billing_address" => array(
"first_name" => array(
"operator" => "=",
"value" => "John"
)
)
)
function searchTransactions($transactionSearchCriteria) {
$curl = curl_init();
$payload = json_encode($transactionSearchCriteria);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/transaction/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
if ($result["Status"] === "success") {
$transactions = $result["data"];
}
else {
}
curl_close($curl);
echo $response;
}
public class QueryResponse extends ApiResponse {
public List<TransactionData> data;
}
public class TransactionData {
public string id;
public string type;
public int amount;
@JsonProperty("tax_amount")
public int taxAmount;
@JsonProperty("tax_exempt")
public bool taxExempt;
@JsonProperty("shipping_amount")
public int shippingAmount;
public string currency;
public string description;
@JsonProperty("order_id")
public string orderId;
@JsonProperty("po_number")
public string poNumber;
@JsonProperty("ip_address")
public string ipAddress;
@JsonProperty("email_receipt")
public string emailReceipt;
@JsonProperty("payment_method")
public string paymentMethod;
public string response;
public string status;
@JsonProperty("billing_address")
public Address billingAddress;
@JsonProperty("shipping_address")
public Address shippingAddress;
@JsonProperty("created_at")
public DateTime createdAt;
@JsonProperty("updated_at")
public DateTime updatedAt;
}
public class OperatorValueCriteria {
public string order;
public T value;
}
public class AddressCriteria {
@JsonProperty("first_name")
public OperatorValueCriteria firstName;
}
public class SearchCriteria {
@JsonProperty("transaction_id")
public OperatorValueCriteria transactionId;
public OperatorValueCriteria amount;
@JsonProperty("billing_address")
public AddressCriteria billingAddress;
}
public void searchTransactions(SearchCriteria criteria) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(request);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/transaction/search")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
QueryResponse entity = objectMapper.readValue(responseBody.string(), QueryResponse.class);
if (entity.status === "success") {
// handle success
var transactions = entity.Data;
} else {
// handle non success
}
}
# Capture
Capture funds for a specified transaction that has already been authorized.
Request Method:
POST
URL Endpoint:
/api/transaction/{ transaction ID }/capture
Name | Type | Default | Description | Required |
---|---|---|---|---|
amount | integer | amount from auth | Total amount to capture, in cents. (1299 = $12.99) | |
tax_amount | integer | tax_amount from auth | Tax amount to capture, in cents. (199 = $1.99) | |
shipping_amount | integer | shipping_amount from auth | Shipping amount to capture, in cents. (299 = $2.99) | |
tax_exempt | boolean | false | Is the transaction tax exempt | |
order_id | string | order_id from auth | Alphanumeric (max 17 characters) | |
po_number | string | po_number from auth | Alphanumeric (max 17 characters) | |
ip_address | string | ip_address from auth | IPV4 or IPV6 address |
{
"status": "success",
"msg": "success",
"data": null
}
function captureFunds(transactionId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
amount: 1000,
tax_amount: 100,
tax_exempt: false,
shipping_amount: 0,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch(
"https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/capture",
requestOptions
)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class TransactionCaptureRequest {
public int Amount { get; set; }
[JsonProperty("tax_amount")]
public int TaxAmount { get; set; }
[JsonProperty("tax_exempt")]
public bool TaxExempt { get; set; }
[JsonProperty("shipping_amount")]
public int ShippingAmount { get; set; }
}
public void captureFunds(TransactionCaptureRequest request) {
var client = new RestClient("https://sandbox.fluidpay.com/api/transaction/bsdk191erttqnm79q5lg/capture");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(request);
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<php?
$transaction = array(
"amount" => 1000,
"tax_amount" => 100,
"tax_exempt" => false,
"shipping_amount" => 0
);
function captureFunds($transaction) {
$curl = curl_init();
$payload = json_encode($transaction);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/transaction/".$transaction->transactionId."/capture",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
public class TransactionCaptureRequest {
@JsonProperty("transaction_id")
public string transactionId;
public int amount;
@JsonProperty("tax_amount")
public int taxAmount;
@JsonProperty("tax_exempt")
public boolean taxExempt;
@JsonProperty("shipping_amount")
public int shippingAmount;
}
public void captureFunds(TransactionCaptureRequest request) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(request);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/transaction/" + request.TransactionId + "/capture")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse response = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (response.status === "success") {
// handle success
} else {
// handle non success
}
}
# Void / Auth Reversal
Void a transaction that is pending settlement. Where applicable, a void will be processed as an auth reversal.
Request Method:
POST
URL Endpoint:
/api/transaction/{ transaction ID }/void
{
"status": "success",
"msg": "success",
"data": null
}
function voidTransaction(transactionId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "POST",
headers: myHeaders,
};
fetch(
"https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/void",
requestOptions
)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void voidTransaction(string transactionId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/void");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<api key>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function voidTransaction($transaction) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/transaction/".$transaction->id."/void",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
public void voidTransaction(int transactionId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/void")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse response = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (response.status === "success") {
// handle success
} else {
// handle non success
}
}
# Refund
Process a refund for a transaction that has already been settled. Multiple partial refunds can be processed, but the total amount of all refunds cannot exceed the previously settled amount.
Request Method:
POST
URL Endpoint:
/api/transaction/{ transaction ID }/refund
Name | Type | Default | Description | Required |
---|---|---|---|---|
amount | integer | amount from auth | Total amount to capture, in cents. (1299 = $12.99) |
{
"status": "success",
"msg": "success",
"data": null
}
function refundTransaction(transactionId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({ amount: 1000 });
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch(
"https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/refund",
requestOptions
)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void refundTransaction(string transactionId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/refund");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<api key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"amount\": 1000\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function refundTransaction($transaction) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/transaction/".$transaction->id."/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"amount\": 1000\n}",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
public void refundTransaction(int transactionId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \"amount\": 1000}");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/transaction/" + transactionId + "/refund")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse response = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (response.status === "success") {
// handle success
} else {
// handle non success
}
}
# Settlement Batches
# Search Settlement Batches
Retrieve details for all settlement batches that match provided search criteria.
Request Method:
POST
URL Endpoint:
/api/settlement/batch/search
Name | Type | Default | Description | Required |
---|---|---|---|---|
batch_date | object | Object containing details defining a batch date range | ||
batch_date .start_date | string | "" | Searches by batch_date between the provided start_date and end_date. (Dates in UTC "YYYY-MM-DDTHH:II:SSZ") | |
batch_date .end_date | string | "" | Searches by batch_date between the provided start_date and end_date. (Dates in UTC "YYYY-MM-DDTHH:II:SSZ") | |
settlement_batch_id | object | Object containing details defining a range of id's | ||
settlement_batch_id .operator | string literal | "=" or "!=" | ||
settlement_batch_id .value | string | The settlement batch id to match or exclude | ||
limit | integer | 10 | The number of results to return (1-100) | |
offset | integer | 0 | The number of results to skip (1-1000) |
{
"status": "success",
"msg": "success",
"data": {
"summary": [
{
"merchant_id": "aaaaaaaaaaaaaaaaaaaa",
"batch_date": "2018-12-04",
"processor_id": "bbbbbbbbbbbbbbbbbbbb",
"processor_name": "main mid",
"num_transactions": 1,
"captured": 10000,
"credit": 0
}
],
"results": [
{
"id": "cccccccccccccccccccc",
"merchant_id": "aaaaaaaaaaaaaaaaaaaa",
"batch_date": "2018-12-04T13:31:02Z",
"processor_id": "bbbbbbbbbbbbbbbbbbbb",
"processor_name": "main mid",
"processor_type": "tsys_sierra",
"batch_number": 1,
"num_transactions": 1,
"amount_captured": 10000,
"amount_credit": 0,
"net_deposit": 10000,
"response_code": 100,
"response_message": " ACCEPT"
}
]
},
"total_count": 1
}
function searchSettlements() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
batch_date: {
start_date: "2018-12-01T00:00:00Z",
end_date: "2018-12-26T23:59:59Z",
},
offset: 0,
limit: 10,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/settlement/batch/search", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class ApiResponse {
public string Status { get; set; }
public string Msg { get; set; }
public ResponseData Data { get; set; }
[JsonProperty("total_count")]
public int TotalCount { get; set; }
// totalCount
}
public class ResponseData {
public SummaryRecord Summary { get; set; }
public List<ResultRecord> Results { get; set; }
}
public class SummaryRecord {
public string MerchantId { get; set; }
[JsonProperty("batch_date")]
public string BatchDate { get; set; }
[JsonProperty("processor_id")]
public string ProcessorId { get; set; }
[JsonProperty("processor_name")]
public string ProcessorName { get; set; }
[JsonProperty("num_transactions")]
public int NumTransactions { get; set; }
public int Captured { get; set; }
public int Credit { get; set; }
}
public class ResultRecord {
public string Id { get; set; }
[JsonProperty("merchant_id")]
public string MerchantId { get; set; }
[JsonProperty("batch_date")]
public DateTime BatchDate { get; set; }
public string ProcessorId { get; set; }
[JsonProperty("processor_name")]
public string ProcessorName { get; set; }
[JsonProperty("num_transactions")]
public int NumTransactions { get; set; }
[JsonProperty("amount_captured")]
public int AmountCaptured { get; set; }
[JsonProperty("amount_credit")]
public int AmountCredit { get; set; }
[JsonProperty("processor_type")]
public string ProcessorType { get; set; }
[JsonProperty("batch_number")]
public int BatchNumber { get; set; }
[JsonProperty("net_deposit")]
public int NetDeposit { get; set; }
[JsonProperty("response_code")]
public int ResponseCode { get; set; }
[JsonProperty("response_message")]
public string ResponseMessage { get; set; }
}
public class BatchDate {
[JsonProperty("start_date")]
public DateTime StartDate { get; set; }
[JsonProperty("end_date")]
public DateTime EndDate { get; set; }
}
public class SearchCriteria {
[JsonProperty("batch_date")]
public BatchDate BatchDate { get; set; }
public int Offset { get; set; }
public int Limit { get; set; }
}
public void searchSettlements(SearchCriteria criteria) {
var client = new RestClient("https://sandbox.fluidpay.com/api/settlement/batch/search");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(criteria);
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
SummaryRecord summary = apiResponse.Data.Summary;
java.util.ArrayList<ResultRecord> results = apiResponse.Data.Results;
} else {
// handle non success
}
}
<?php
$criteria = array(
"batch_date" => array(
"start_date" => "2018-12-01T00:00:00Z",
"end_date" => "2018-12-26T23:59:59Z"
),
"offset" => 0,
"limit" => 10
);
function searchSettlements($criteria) {
$curl = curl_init();
$payload = json_encode($criteria);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/settlement/batch/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class ApiResponse {
public String status;
public String msg;
public ResponseData data;
@JsonProperty("total_count")
public int totalCount;
// totalCount
}
public class ResponseData {
public SummaryRecord summary;
public java.util.ArrayList<ResultRecord> results;
}
public class SummaryRecord {
public String merchantId;
@JsonProperty("batch_date")
public String batchDate;
@JsonProperty("processor_id")
public String processorId;
@JsonProperty("processor_name")
public String processorName;
@JsonProperty("num_transactions")
public int numTransactions;
public int captured;
public int credit;
}
public class ResultRecord {
public String id;
@JsonProperty("merchant_id")
public String merchantId;
@JsonProperty("batch_date")
public DateTime batchDate;
public String processorId;
@JsonProperty("processor_name")
public String processorName;
@JsonProperty("num_transactions")
public int numTransactions;
@JsonProperty("amount_captured")
public int amountCaptured;
@JsonProperty("amount_credit")
public int amountCredit;
@JsonProperty("processor_type")
public String processorType;
@JsonProperty("batch_number")
public int batchNumber;
@JsonProperty("net_deposit")
public int netDeposit;
@JsonProperty("response_code")
public int responseCode;
@JsonProperty("response_message")
public String responseMessage;
}
public class BatchDate {
@JsonProperty("start_date")
public DateTime startDate;
@JsonProperty("end_date")
public DateTime endDate;
}
public class SearchCriteria {
@JsonProperty("batch_date")
public BatchDate batchDate;
public int offset;
public int limit;
}
public void searchSettlements(SearchCriteria criteria) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(criteria);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/settlement/batch/search")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse apiResponse = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
SummaryRecord summary = apiResponse.data.summary;
java.util.ArrayList<ResultRecord> results = apiResponse.data.results;
} else {
// handle non success
}
}
# File Batch
# Upload Batch File
Upload a CSV file for batch processing.
TIP
CSV File Format
The input file for the upload endpoint should contain records to process in the following format (example below):
- First row should be a header using the fields below, fields can be in any order and not all fields are required.
- Each field should be wrapped in quotes and should not contain any quotes
- Each field should be seperated with a comma
- Each row should be terminated with a newline \n character.
Request Method:
POST
URL Endpoint:
/api/filebatch
Name | Type | Default | Description | Required |
---|---|---|---|---|
transaction_type | string | "verification", "authorize", "capture", "sale", "credit" or "refund" | * | |
cc_number | string | CC Number | if credit card | |
cc_expiration | string | CC Expiration Date | if credit card | |
cc_cvc | string | Optional unless your account requires CVC for processing | ||
ach_account_number | string | ACH account number | if ACH | |
ach_routing_number | string | ACH routing number | if ACH | |
ach_account_type | string | "checking" or "savings" | if ACH | |
ach_sec_code | string | SEC code: "WEB", "CCD", or "PPD" | if ACH | |
customer_id | string | customer vault id to charge | if using customer vault | |
amount | integer | Total amount to process in cents (100 = $1.00) | * | |
shipping_amount | integer | Shipping amount to process in cents (100 = $1.00) | ||
tax_amount | integer | Tax amount to process in cents (100 = $1.00) | ||
discount_amount | integer | Discount amount to process in cents (100 = $1.00) | ||
order_id | string | Alphanumeric string for reference (max 17 characters) | ||
description | string | Alphanumeric string for notes (max 100 characters) | ||
po_number | string | Alphanumeric string for reference (max 17 characters) | ||
tax_exempt | boolean | false | is the transaction tax exempt | |
email_address | string | Email address to tag to the transaction, emails are not sent. | ||
processor_id | string | Processor ID to process the transaction, otherwise the default is used. | ||
billing_first_name | string | |||
billing_last_name | string | |||
billing_company | string | |||
billing_address_line_1 | string | |||
billing_address_line_2 | string | |||
billing_city | string | |||
billing_state | string | |||
billing_postal_code | string | |||
billing_country | string | |||
billing_phone | string | |||
billing_fax | string | |||
billing_email | string | |||
shipping_first_name | string | |||
shipping_last_name | string | |||
shipping_company | string | |||
shipping_address_line_1 | string | |||
shipping_address_line_2 | string | |||
shipping_city | string | |||
shipping_state | string | |||
shipping_postal_code | string | |||
shipping_country | string | |||
shipping_phone | string | |||
shipping_fax | string | |||
shipping_email | string |
function uploadFile() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
var formdata = new FormData();
formdata.append("file", "testBatch.csv");
var requestOptions = {
method: "POST",
headers: myHeaders,
body: formdata,
redirect: "follow",
};
fetch("https://sandbox.fluidpay.com/api/filebatch", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var batchId = result.data.id;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class ApiResponse {
public string Status { get; set; }
public string Msg { get; set; }
}
public class Batch {
public string Id { get; set; }
[JsonProperty("file_name")]
public string FileName { get; set; }
public string Status { get; set; }
[JsonProperty("num_lines")]
public string NumLines { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}
public class BatchResponse : ApiResponse {
public Batch Data { get; set; }
}
public void uploadFile(string filePath, string contentType) {
var client = new RestClient("https://sandbox.fluidpay.com/api/filebatch");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AlwaysMultipartFormData = true;
request.AddFile("file", filePath, contentType);
IRestResponse response = client.Execute(request);
BatchResponse apiResponse = JsonConvert.DeserializeObject\>BatchResponse>(response);
if (apiResponse.Status === "success") {
// handle success
string newId = apiResponse.Data.Id;
} else {
// handle non success
}
}
<?php
function uploadFile() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/filebatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array("file" => $_FILES["userfile"]["tmp_name"]),
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey
),
));
$response = curl_exec($curl);
json_decode($response);
curl_close($curl);
echo $response;
}
public class ApiResponse {
String status;
String msg;
}
public class BatchData {
String id;
@JsonProperty("file_name")
String fileName;
String status;
@JsonProperty("num_lines")
String numLines;
@JsonProperty("created_at")
String createdAt;
@JsonProperty("updated_at")
String updatedAt;
}
public class BatchResponse extends ApiResponse {
BatchData data;
}
public void uploadFile(String filePath) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file", filePath)
.build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/filebatch")
.method("POST", body)
.addHeader("Authorization", apiKey)
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
BatchResponse apiResponse = objectMapper.readValue(responseBody.string(), BatchResponse.class);
if (apiResponse.status === "success") {
// handle success
String newId = apiResponse.data.id;
} else {
// handle non success
}
}
# Get Batch Status
Get the current status of a specified settlement batch.
Request Method:
GET
URL Endpoint:
/api/filebatch/{ batch id }
function getBatchStatus(batchId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/filebatch/" + batchId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var message = result.msg;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void getBatchStatus(string batchId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/filebatch/" + batchId);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject\>ApiResponse>(response.Content);
if (apiResponse.Status === "success") {
// handle success
string message = apiResponse.Msg;
} else {
// handle non success
}
}
<?php
function getBatchStatus($batchId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/filebatch/".$batchId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
json_decode($response);
curl_close($curl);
echo $response;
}
public void getBatchStatus(String batchId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/filebatch/" + batchId)
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse apiResponse = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
String message = apiResponse.msg;
} else {
// handle non success
}
}
# Download Batch File
Returns a CSV text response for the specified batch.
Request Method:
GET
URL Endpoint:
/api/filebatch/{ batch id }/download
function downloadBatchFile(batchId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch(
"https://sandbox.fluidpay.com/api/filebatch/" + batchId + "/download",
requestOptions
)
.then((response) => {
if (response.ok) {
return response.text().then((csvData) => {
// return csv file.. csvData
});
} else {
return response.text().then((result) => {
var msg = result.msg;
});
}
})
.catch((error) => console.log("error", error));
}
public void downloadBatchFile(string batchId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/filebatch/" + batchId + "/download");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
if (response.StatusCode == HttpStatusCode.OK) {
byte[] bytes = Encoding.ASCII.GetBytes(response.Content);
var resultFile = new File(DeriveBytes, "text/csv", "results.csv");
}
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response.Content);
string message = apiResponse.Msg;
}
<?php
function downloadBatchFile($batchId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/filebatch/".$batchId."/download",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
public void downloadBatchFile(String batchId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/filebatch/" + batchId + "/download")
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ResponseBody responseBody = response.body();
if (response.getStatus() == Response.Status.OK.getStatusCode()) {
String responseCSVString = responseBody.string();
} else {
ObjectMapper objectMapper = new ObjectMapper();
ApiResponse apiResponse = objectMapper.readValue(responseBody.string(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
String message = apiResponse.msg;
} else {
// handle non success
}
}
}
# Recurring
# Create Add-On
Create a new recurring plan add-on. Add-ons are used to adjust a recurring charge amount, either by a set amount or a percentage of the subscription amount.
Request Method:
POST
URL Endpoint:
/api/recurring/addon
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | "" | Display name for the add-on | |
description | string | "" | Description for the add-on | |
amount | integer | null | Amount to be added in cents (100 = $1.00) | * (see note below) |
percentage | integer | null | Percentage of original charge to be added (must be 0 or a percentage between .1% and 100%, expressed in thousandths. 43440 = 43.440%) | * (see note below) |
duration | integer | 0 | Number of times for the add-on to be billed (use 0 if you want the add-on to persist until cancelled) |
TIP
Either amount or percentage may be provided, but not both.
:::
{
"status": "success",
"msg": "success",
"data": {
"id": "b89ffdqj8m0o735i19i0",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:41:43.330315Z",
"updated_at": "2017-11-20T15:41:43.330315Z"
}
}
function createAddOn() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "test plan",
description: "just a simple test plan",
amount: 100,
duration: 0,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/recurring/addon", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class ApiResponse {
public string Status { get; set; }
public string Msg { get; set; }
}
public class AddOnResponse : ApiResponse {
public AddOn Data { get; set; }
}
public class AddOn {
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public int Amount { get; set; }
public int Percentage { get; set; }
public int Duration { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public void createAddOn(AddOn addon) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/addon");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(addon);
IRestResponse response = client.Execute(request);
AddOnResponse apiResponse = JsonConvert.DeserializeObject<AddOnResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
$addOn = array(
"name" => "test plan",
"description" => "just a simple test plan",
"amount" => 100,
"duration" => 0
);
function createAddOn($addOn) {
$curl = curl_init();
$payload = json_encode($addOn);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/addon",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class ApiResponse {
String status;
String msg;
}
public class AddOnResponse extends ApiResponse {
AddOn data;
}
public class AddOn {
String id;
String name;
String description;
int amount;
int percentage;
int duration;
java.util.Date createdAt;
java.util.Date updatedAt;
}
public void createAddOn(AddOn addon) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(addon);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/addon")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
AddOnResponse apiResponse = objectMapper.readValue(responseBody.String(), AddOnResponse.class);
if (apiResponse.status === "success") {
// handle success
} else {
// handle non success
}
}
# Get Add-On By ID
Retrieve details for the specified add-on.
Request Method:
GET
URL Endpoint:
/api/recurring/addon/{ add-on id }
{
"status": "success",
"msg": "success",
"data": {
"id": "b89ffdqj8m0o735i19i0",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:41:43.330315Z",
"updated_at": "2017-11-20T15:41:43.330315Z"
}
}
function getAddOn(addOnId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/addon/" + addOnId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var addon = result.data;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void getAddOn(string addOnId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/addon/" + addOnId);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
AddOnResponse apiResponse = JsonConvert.DeserializeObject<AddOnResponse>(response);
if (apiResponse.Status === "success") {
// handle success
AddOn addon = apiResponse.Data;
} else {
// handle non success
}
}
<?php
function getAddOn($addOnId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/addon/".$addOnId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json",
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void getAddOn(String addOnId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/addon/" + addOnId)
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
AddOnResponse apiResponse = objectMapper.readValue(responseBody.String(), AddOnResponse.class);
if (apiResponse.status === "success") {
// handle success
AddOn addon = apiResponse.data;
} else {
// handle non success
}
}
# Get All Add-Ons
Retrieve details for all add-ons accosciated with the gateway account.
Request Method:
GET
URL Endpoint:
/api/recurring/addons
{
"status": "success",
"msg": "success",
"data": [
{
"id": "b75cvl51tlv38t0o7o30",
"name": "test_addon",
"description": "some description",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-09-26T22:08:20Z",
"updated_at": "2017-09-26T22:08:20Z"
},
{
"id": "b779mpt1tlv96kdv2n20",
"name": "test_addon_percent",
"description": "",
"amount": null,
"percentage": 10,
"duration": 0,
"created_at": "2017-10-09T20:39:41Z",
"updated_at": "2017-10-09T20:39:41Z"
},
{
"id": "b89ffdqj8m0o735i19i0",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:41:43Z",
"updated_at": "2017-11-20T15:41:43Z"
}
],
"total_count": 3
}
function getAllAddOns() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/addons", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var addons = result.data;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class AllAddOnsResponse : ApiResponse {
public List<AddOn> Data { get; set; }
public int TotalCount { get; set; }
}
public void getAllAddOns() {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/addons");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
AllAddOnsResponse apiResponse = JsonConvert.DeserializeObject<AllAddOnsResponse>(response);
if (apiResponse.Status === "success") {
// handle success
List<AddOn> addons = apiResponse.Data;
int total = apiResponse.TotalCount;
} else {
// handle non success
}
}
<?php
function getAllAddOns() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/addons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class AllAddOnsResponse extends ApiResponse {
java.util.ArrayList<AddOn> data;
int totalCount;
}
public void getAllAddOns() {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/addons")
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
AllAddOnsResponse apiResponse = objectMapper.readValue(responseBody.String(), AllAddOnsResponse.class);
if (apiResponse.status === "success") {
// handle success
java.util.ArrayList<AddOn> addon = apiResponse.data;
int total = apiResponse.totalCount;
} else {
// handle non success
}
}
# Update Add-On
Edit details for the specified add-on.
Request Method:
POST
URL Endpoint:
/api/recurring/addon/{ add-on id }
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | "" | Display name for the add-on | |
description | string | "" | Description for the add-on | |
amount | integer | null | Amount to be added in cents (100 = $1.00) | * (see note below) |
percentage | integer | null | Percentage of original charge to be added (must be 0 or a percentage between .1% and 100%, expressed in thousandths. 43440 = 43.440%) | * (see note below) |
duration | integer | 0 | Number of times for the add-on to be billed (use 0 if you want the subscription to persist until cancelled) |
TIP
Either amount or percentage may be provided, but not both.
:::
{
"status": "success",
"msg": "success",
"data": {
"id": "b89ffdqj8m0o735i19i0",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:41:43.330315Z",
"updated_at": "2017-11-20T15:41:43.330315Z"
}
}
function updateAddOn(addOnId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "test plan",
description: "just a simple test plan",
amount: 100,
duration: 0,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/recurring/addon/" + addOnId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void updateAddOn(AddOn addon) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/addon/" + addon.Id);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(addon);
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function updateAddOn($addOn) {
$curl = curl_init();
$payload = json_encode($addOn);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/addon/".$addOn->id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void updateAddOn(AddOn addon) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(addon);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/addon/" + addon.id
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse apiResponse = objectMapper.readValue(responseBody.String(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
} else {
// handle non success
}
}
# Delete Add-On
Delete the specified add-on.
Request Method:
DELETE
URL Endpoint:
/api/recurring/addon/{ add-on id }
{
"status": "success",
"msg": "success",
"data": null
}
function deleteAddOn(addOnId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "DELETE",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/addon/" + addOnId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void deleteAddOn(string addonId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/addon/" + addonId);
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function deleteAddOn($addOn) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/addon/".$addOn->id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void deleteAddOn(String addOnId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/addon/" + addOnId)
.method("DELETE", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ApiResponse apiResponse = objectMapper.readValue(responseBody.String(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
java.util.ArrayList<AddOn> addon = apiResponse.data;
int total = apiResponse.totalCount;
} else {
// handle non success
}
}
# Create Discount
Create a new recurring plan discount. Discounts are used to adjust a recurring charge amount either by a set amount or a percentage of the subscription amount.
Request Method:
POST
URL Endpoint:
/api/recurring/discount
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | "" | Display name for the discount | |
description | string | "" | Description for the discount | |
amount | integer | null | Amount to be discounted in cents (100 = $1.00) | * (see note below) |
percentage | integer | null | Percentage of original charge to be discounted (must be 0 or a percentage between .1% and 100%, expressed in thousandths. 43440 = 43.440%) | * (see note below) |
duration | integer | 0 | Number of times for the discount to be billed (use 0 if you want the discount to persist until cancelled) |
TIP
Either amount or percentage may be provided, but not both.
:::
{
"status": "success",
"msg": "success",
"data": {
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "just a simple test discount",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:54:39.851636Z",
"updated_at": "2017-11-20T15:54:39.851636Z"
}
}
function createDiscount() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "test discount",
description: "just a simple test discount",
amount: 100,
duration: 0,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/recurring/discount", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var newId = result.data.id;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class Discount {
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public int Amount { get; set; }
public int Duration { get; set; }
public int Percentage { get; set; }
public DateTime CreateAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public class DiscountResponse : ApiResponse {
public Discount Data { get; set; }
}
public void createDiscount(Discount discount) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/discount");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(discount);
IRestResponse response = client.Execute(request);
DiscountResponse apiResponse = JsonConvert.DeserializeObject<DiscountResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var newId = apiResponse.Data.Id;
} else {
// handle non success
}
}
<?php
$discount = array(
"name" => "test discount",
"description" => "just a simple test discount",
"amount" => 100,
"duration" => 0
);
function createDiscount($discount) {
$curl = curl_init();
$payload = json_encode($discount);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/discount",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class Discount {
String id;
String name;
String description;
int amount;
int duration;
int percentage;
java.util.Date createAt;
java.util.Date updatedAt;
}
public class DiscountResponse extends ApiResponse {
Discount data;
}
public void createDiscount(Discount discount) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(discount);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/discount")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
DiscountResponse apiResponse = objectMapper.readValue(responseBody.String(), DiscountResponse.class);
if (apiResponse.status === "success") {
// handle success
var newId = apiResponse.data.Id;
} else {
// handle non success
}
}
# Get Discount By ID
Retrieve details for the specified discount.
Request Method:
GET
URL Endpoint:
/api/recurring/discount/{ discount id }
{
"status": "success",
"msg": "success",
"data": {
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "just a simple test discount",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:54:39.851636Z",
"updated_at": "2017-11-20T15:54:39.851636Z"
}
}
function getDiscount(discountId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch(
"https://sandbox.fluidpay.com/api/recurring/discount/" + discountId,
requestOptions
)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var discount = result.data;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void getDiscount(string discountId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/discount/" + discountId);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
DiscountResponse apiResponse = JsonConvert.DeserializeObject<DiscountResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var discount = apiResponse.Data;
} else {
// handle non success
}
}
<?php
function getDiscount($discountId)
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/discount/".$discountId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$discountId,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void getDiscount(String discountId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/discount/" + discountId)
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
DiscountResponse apiResponse = objectMapper.readValue(responseBody.String(), DiscountResponse.class);
if (apiResponse.status === "success") {
// handle success
var discount = apiResponse.data;
} else {
// handle non success
}
}
# Get All Discounts
Retrieve the properties of all discounts for the gateway account associated with the API Key or JWT token provided in the Authorization header.
Request Method:
GET
URL Endpoint:
/api/recurring/discounts
{
"status": "success",
"msg": "success",
"data": [
{
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "just a simple test discount",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:54:40Z",
"updated_at": "2017-11-20T15:54:40Z"
},
{
"id": "b779mpt1tlv96kdv2n20",
"name": "test_discount_percent",
"description": "",
"amount": null,
"percentage": 10,
"duration": 0,
"created_at": "2017-10-09T20:59:52Z",
"updated_at": "2017-10-09T20:59:52Z"
}
],
"total_count": 2
}
function getAllDiscounts() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/discounts", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var discounts = result.data;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class AllDiscountsResponse : ApiResponse {
public List<Discount> Data { get; set; }
}
public void getAllDiscounts() {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/discounts");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
AllDiscountsResponse apiResponse = JsonConvert.DeserializeObject<AllDiscountsResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var discounts = apiResponse.Data;
} else {
// handle non success
}
}
<?php
function getAllDiscounts() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/discounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class AllDiscountsResponse extends ApiResponse {
java.util.ArrayList<Discount> data;
}
public void getAllDiscounts() {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/discounts")
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
AllDiscountsResponse apiResponse = objectMapper.readValue(responseBody.String(), AllDiscountsResponse.class);
if (apiResponse.status === "success") {
// handle success
var discounts = apiResponse.data;
} else {
// handle success
}
}
# Update Discount
Edit details for the specified discount.
Request Method:
POST
URL Endpoint:
/api/recurring/discount/{ discount id }
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | "" | Display name for the discount | |
description | string | "" | Description for the discount | |
amount | integer | null | Amount to be discounted in cents (100 = $1.00) | * (see note below) |
percentage | integer | null | Percentage of original charge to be discounted (must be 0 or a percentage between .1% and 100%, expressed in thousandths. 43440 = 43.440%) | * (see note below) |
duration | integer | 0 | Number of times for the discount to be billed (use 0 if you want the discount to persist until cancelled) |
TIP
Either amount or percentage may be provided, but not both.
:::
{
"status": "success",
"msg": "success",
"data": {
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "just a simple test discount",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": "2017-11-20T15:54:39.851636Z",
"updated_at": "2017-11-20T15:54:39.851636Z"
}
}
function updateDiscount(discountId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "test discount",
description: "just a simple test discount",
amount: 120,
duration: 0,
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch(
"https://sandbox.fluidpay.com/api/recurring/discount/" + discountId,
requestOptions
)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void updateDiscount(Discount discount) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/discount/" + discount.Id);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(discount);
IRestResponse response = client.Execute(request);
DiscountResponse apiResponse = JsonConvert.DeserializeObject<DiscountResponse>(response);
if (apiResponse.Status === "success") {
// handle success
var discount = apiResponse.Data;
} else {
// handle non success
}
}
<?php
function updateDiscount($discount) {
$curl = curl_init();
$payload = json_encode($discount);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/discount/".$discount->id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void updateDiscount(Discount discount) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(discount);
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"test discount\",\n \"description\": \"just a simple test discount\",\n \"amount\": 120,\n \"duration\": 0\n }");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/discount/" + discount.id)
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
DiscountResponse apiResponse = objectMapper.readValue(responseBody.String(), DiscountResponse.class);
if (apiResponse.status === "success") {
// handle success
var discount = apiResponse.data;
} else {
// handle non success
}
}
# Delete Discount
Delete the specified discount.
Request Method:
DELETE
URL Endpoint:
/api/recurring/discount/{ discount id }
{
"status": "success",
"msg": "success",
"data": null
}
function deleteDiscount(discountId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "DELETE",
headers: myHeaders,
};
fetch(
"https://sandbox.fluidpay.com/api/recurring/discount/" + discountId,
requestOptions
)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var discount = result.data;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void deleteDiscount(string discountId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/discount/" + discountId);
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function deleteDiscount($discountId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/discount/".$discountId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void deleteDiscount(String discountId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/discount/" + discountId)
.method("DELETE", body)
.addHeader("Authorization", apiKey
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse apiResponse = objectMapper.readValue(responseBody.String(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
} else {
// handle non success
}
}
# Create Plan
Creates a new recurring plan with discounts and/or add-ons.
Request Method:
POST
URL Endpoint:
/api/recurring/plan
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | "" | Display name for the plan | |
description | string | "" | Description for the plan | |
amount | integer | null | Amount to be billed in cents (100 = $1.00) | * |
billing_cycle_interval | integer | null | How often to run the billing cycle (run every X months) | * |
billing_frequency | string literal | "monthly" | How often to run the plan within a billing cycle. ("monthly", "twice_monthly", "daily") | * |
billing_days | string | null | Which day of the month to bill on. If "twice_monthly" then comma separate dates ("1, 15"). For the last day of the month, use "0". | * |
duration | integer | 0 | Number of times for the discount to be billed (use 0 if you want the plan to persist until cancelled) | |
add_ons | array of objects | Enumerates add-ons for a recurring plan | ||
add_ons[#] .id | string | ID of the referenced add_on | ||
add_ons[#] .name | string | Display name for the add_on (optional, this overrides the add_ons value) | ||
add_ons[#] .description | string | Description for the add_on (optional, this overrides the add_ons value) | ||
add_ons[#] .amount | int | Amount to be added (optional, this overrides the add_ons value) | ||
add_ons[#] .duration | int | Duration for the add_on to be billed (optional, this overrides the add_ons value) | ||
discounts | array of objects | Enumerates discounts for a recurring plan | ||
discounts[#] .id | string | ID of the referenced discount | ||
discounts[#] .name | string | Display name for the discount (optional, this overrides the discount value) | ||
discounts[#] .description | string | Description for the discount (optional, this overrides the discount value) | ||
discounts[#] .amount | int | Amount to be discounted (optional, this overrides the discount value) | ||
discounts[#] .duration | int | Duration for the discount to be billed (optional, this overrides the discount value) |
{
"status": "success",
"msg": "success",
"data": {
"id": "b89g35qj8m0o735i19jg",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"billing_cycle_interval": 1,
"billing_frequency": "twice_monthly",
"billing_days": "1,15",
"total_add_ons": 100,
"total_discounts": 50,
"duration": 0,
"add_ons": [
{
"id": "b75cvl51tlv38t0o7o30",
"name": "test_addon",
"description": "this will add to the cost of the subscription",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"discounts": [
{
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "this will discount the cost of the subscription",
"amount": 50,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"created_at": "2017-11-20T16:23:51.990051Z",
"updated_at": "2017-11-20T16:23:51.990051Z"
}
}
function createPlan() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "__cfduid=123abc");
var raw = JSON.stringify({
name: "test plan",
description: "just a simple test plan",
amount: 100,
billing_cycle_interval: 1,
billing_frequency: "twice_monthly",
billing_days: "1,15",
duration: 0,
add_ons: [],
discounts: [],
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/recurring/plan", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class Plan {
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public int Amount { get; set; }
[JsonProperty("billing_cycle_interval")]
public int BillingCycleInterval { get; set; }
[JsonProperty("billing_frequency")]
public string BillingFrequency { get; set; }
[JsonProperty("billing_days")]
public string BillingDays { get; set; }
public int Duration { get; set; }
[JsonProperty("add_ons")]
public List<AddOn> AddOns { get; set; }
public List<Discount> Discounts { get; set; }
[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
}
public class PlanResponse : ApiResponse {
public Plan Data { get; set; }
}
public void createPlan(Plan plan) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/plan");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(plan);
IRestResponse response = client.Execute(request);
PlanResponse apiResponse = JsonConvert.DeserializeObject<PlanResponse>(response);
if (apiResponse.Status === "success") {
// handle success
string newId = apiResponse.Data;
} else {
// handle non success
}
}
<?php
$plan = array(
"name" => "test plan",
"description" => "just a simple test plan",
"amount" => 100,
"billing_cycle_interval" => 1,
"billing_frequency" => "twice_monthly",
"billing_days" => "1,15",
"duration" => 0,
"add_ons" => array(),
"discounts" => array()
);
function createPlan($plan) {
$curl = curl_init();
$payload = json_encode($plan);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class Plan {
String id;
String name;
String description;
int amount;
@JsonProperty("billing_cycle_interval")
int billingCycleInterval;
@JsonProperty("billing_frequency")
String billingFrequency;
@JsonProperty("billing_days")
String billingDays;
int duration;
@JsonProperty("add_ons")
java.util.ArrayList<AddOn> addOns;
java.util.ArrayList<Discount> discounts;
@JsonProperty("created_at")
java.util.Date createdAt;
@JsonProperty("updated_at")
java.util.Date updatedAt;
}
public class PlanResponse extends ApiResponse {
Plan data;
}
public void createPlan(Plan plan) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(plan);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/plan")
.method("POST", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
PlanResponse apiResponse = objectMapper.readValue(responseBody.String(), PlanResponse.class);
if (apiResponse.status === "success") {
// handle success
String newId = apiResponse.data.id;
} else {
// handle non success
}
}
# Get Plan By ID
Retrieve details for the specified plan.
Request Method:
GET
URL Endpoint:
/api/recurring/plan/{ plan id }
{
"status": "success",
"msg": "success",
"data": {
"id": "b89g35qj8m0o735i19jg",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"billing_cycle_interval": 1,
"billing_frequency": "twice_monthly",
"billing_days": "1,15",
"total_add_ons": 100,
"total_discounts": 50,
"duration": 0,
"add_ons": [
{
"id": "b75cvl51tlv38t0o7o30",
"name": "test_addon",
"description": "this will add to the cost of the subscription",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"discounts": [
{
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "this will discount the cost of the subscription",
"amount": 50,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"created_at": "2017-11-20T16:23:51.990051Z",
"updated_at": "2017-11-20T16:23:51.990051Z"
}
}
function getPlan(planId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/plan/" + planId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var plan = result.data[0];
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public class PlanListResponse : ApiResponse {
public List<Plan> Data { get; set; }
[JsonProperty("total_count")]
public int TotalCount { get; set; }
}
public void getPlan(string planId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/plan/" + planId);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
PlanListResponse apiResponse = JsonConvert.DeserializeObject<PlanListResponse>(response);
if (apiResponse.Status === "success") {
// handle success
Plan plan = apiResponse.Data.FirstOrDefault(); // return first in array
} else {
// handle non success
}
}
<?php
function getPlan($planId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/plan/".$planId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public class PlanListResponse extends ApiResponse {
java.util.ArrayList<Plan> data;
@JsonProperty("total_count")
int totalCount;
}
public void getPlan(String planId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/plan/" + planId)
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
PlanListResponse apiResponse = objectMapper.readValue(responseBody.String(), PlanListResponse.class);
if (apiResponse.status === "success") {
// handle success
Plan plan = apiResponse.data.get(0);
} else {
// handle non success
}
}
# Get All Plans
Retrieve the properties of all plans for the gateway account associated with the API Key or JWT token provided in the Authorization header.
Request Method:
GET
URL Endpoint:
/api/recurring/plans
{
"status": "success",
"msg": "success",
"data": [
{
"id": "b89g35qj8m0o735i19jg",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"billing_cycle_interval": 1,
"billing_frequency": "twice_monthly",
"billing_days": "1,15",
"total_add_ons": 100,
"total_discounts": 50,
"duration": 0,
"add_ons": [
{
"id": "b75cvl51tlv38t0o7o30",
"name": "test_addon",
"description": "this will add to the cost of the subscription",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"discounts": [
{
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "this will discount the cost of the subscription",
"amount": 50,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"created_at": "2017-11-20T16:23:52Z",
"updated_at": "2017-11-20T16:23:52Z"
}
],
"total_count": 1
}
function getAllPlans() {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "GET",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/plans", requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
var plans = result.data;
var total = result.total_count;
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void getAllPlans() {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/plans");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
PlanListResponse apiResponse = JsonConvert.DeserializeObject<PlanListResponse>(response);
if (apiResponse.Status === "success") {
// handle success
List<Plan> plan = apiResponse.Data;
int total = apiResponse.TotalCount;
} else {
// handle non success
}
}
<?php
function getAllPlans() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/plans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void getAllPlans() {
OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/plans")
.method("GET", null)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
PlanListResponse apiResponse = objectMapper.readValue(responseBody.String(), PlanListResponse.class);
if (apiResponse.status === "success") {
// handle success
java.util.ArrayList<Plan> plan = apiResponse.data;
int total = apiResponse.totalCount;
} else {
// handle non success
}
}
# Update Plan
Edit details for the specified plan.
Request Method:
POST
URL Endpoint:
/api/recurring/plan/{ plan id }
Name | Type | Default | Description | Required |
---|---|---|---|---|
name | string | "" | Display name for the plan | |
description | string | "" | Description for the plan | |
amount | integer | null | Amount to be billed in cents (100 = $1.00) | * |
billing_cycle_interval | integer | null | How often to run the billing cycle (run every X months) | * |
billing_frequency | string literal | "monthly" | How often to run the plan within a billing cycle. ("monthly", "twice_monthly", "daily") | * |
billing_days | string | null | Which day of the month to bill on. If "twice_monthly" then comma separate dates ("1, 15"). For the last day of the month, use "0". | * |
duration | integer | 0 | Number of times for the discount to be billed (use 0 if you want the plan to persist until cancelled) | |
add_ons | array of objects | Enumerates add-ons for a recurring plan | ||
add_ons[#] .id | string | ID of the referenced add_on | ||
add_ons[#] .name | string | Display name for the add_on (optional, this overrides the add_ons value) | ||
add_ons[#] .description | string | Description for the add_on (optional, this overrides the add_ons value) | ||
add_ons[#] .amount | int | Amount to be added (optional, this overrides the add_ons value) | ||
add_ons[#] .duration | int | Duration for the add_on to be billed (optional, this overrides the add_ons value) | ||
discounts | array of objects | Enumerates discounts for a recurring plan | ||
discounts[#] .id | string | ID of the referenced discount | ||
discounts[#] .name | string | Display name for the discount (optional, this overrides the discount value) | ||
discounts[#] .description | string | Description for the discount (optional, this overrides the discount value) | ||
discounts[#] .amount | int | Amount to be discounted (optional, this overrides the discount value) | ||
discounts[#] .duration | int | Duration for the discount to be billed (optional, this overrides the discount value) |
{
"status": "success",
"msg": "success",
"data": {
"id": "b89g35qj8m0o735i19jg",
"name": "test plan",
"description": "just a simple test plan",
"amount": 100,
"billing_cycle_interval": 1,
"billing_frequency": "twice_monthly",
"billing_days": "1,15",
"total_add_ons": 100,
"total_discounts": 50,
"duration": 0,
"add_ons": [
{
"id": "b75cvl51tlv38t0o7o30",
"name": "test_addon",
"description": "this will add to the cost of the subscription",
"amount": 100,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"discounts": [
{
"id": "b89flfqj8m0o735i19ig",
"name": "test discount",
"description": "this will discount the cost of the subscription",
"amount": 50,
"percentage": null,
"duration": 0,
"created_at": null,
"updated_at": null
}
],
"created_at": "2017-11-20T16:23:51.990051Z",
"updated_at": "2017-11-20T16:23:51.990051Z"
}
}
function updatePlan(planId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
name: "test plan",
description: "just a simple test plan",
amount: 100,
billing_cycle_interval: 1,
billing_frequency: "twice_monthly",
billing_days: "1,15",
duration: 0,
add_ons: [],
discounts: [],
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
};
fetch("https://sandbox.fluidpay.com/api/recurring/plan/" + planId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void updatePlan(Plan plan) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/plan/" + plan.Id);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(plan);
IRestResponse response = client.Execute(request);
PlanResponse apiResponse = JsonConvert.DeserializeObject<PlanResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function updatePlan($plan) {
$curl = curl_init();
$payload = json_encode($plan);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/plan/".$plan->id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void updatePlan(Plan plan) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
Gson gson = new Gson();
String jsonObject = gson.toJson(plan);
RequestBody body = RequestBody.create(mediaType, jsonObject);
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/plan/" + plan.id)
.method("POST", body)
.addHeader("Authorization", apiKey
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
PlanResponse apiResponse = objectMapper.readValue(responseBody.String(), PlanResponse.class);
if (apiResponse.status === "success") {
// handle success
} else {
// handle non success
}
}
# Delete Plan
Delete the specified plan.
Request Method:
DELETE
URL Endpoint:
/api/recurring/plan/{ plan id }
{
"status": "success",
"msg": "success",
"data": null
}
function deletePlan(planId) {
var myHeaders = new Headers();
myHeaders.append("Authorization", apiKey);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: "DELETE",
headers: myHeaders,
};
fetch("https://sandbox.fluidpay.com/api/recurring/plan/" + planId, requestOptions)
.then((response) => response.text())
.then((result) => {
if (result.status === "success") {
// handle success
} else {
// handle non success
}
})
.catch((error) => console.log("error", error));
}
public void deletePlan(string planId) {
var client = new RestClient("https://sandbox.fluidpay.com/api/recurring/plan/" + planId);
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", _apiKey);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(response);
if (apiResponse.Status === "success") {
// handle success
} else {
// handle non success
}
}
<?php
function deletePlan($planId) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://sandbox.fluidpay.com/api/recurring/plan/".$planId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Authorization: ".$apiKey,
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
echo $response;
}
public void deletePlan(String planId) {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://sandbox.fluidpay.com/api/recurring/plan/" + planId)
.method("DELETE", body)
.addHeader("Authorization", apiKey)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
ObjectMapper objectMapper = new ObjectMapper();
ResponseBody responseBody = response.body();
ApiResponse apiResponse = objectMapper.readValue(responseBody.String(), ApiResponse.class);
if (apiResponse.status === "success") {
// handle success
} else {
// handle non success
}
}
# Create Subscription
Creates a new subscription which applies a recurring billing plan to a customer.
Request Method:
POST
URL Endpoint:
/api/recurring/subscription
Name | Type | Default | Description | Required |
---|---|---|---|---|
plan_id | string | "" | ID of the plan being subscribed to | |
description | string | "" | Description for the subscription | |
customer | object | Object containing details for the customer being subscribed to the plan | ||
customer .id |