Introduction
Audience
This document is intended to be used by the merchant’s technical staff. For any information not explained in this user guide, contact Client Services.
Payment Service
The Payment Service is designed to allow merchants to communicate and process online transactions with the payment gateway’s transaction processing system. The API serves as a bridge between the merchant’s website and various financial institutions in processing real-time payment transactions.
HOST
The Live API Base URL : https://api.paybybankful.com/
The Sandbox API Base URL: https://api-dev1.bankfulportal.com/
Credit Card Payments
Location
The API Endpoint: https://api.paybybankful.com/api/transaction/api
Method
POST
Content-Type: application/x-www-form-urlencoded
Encoding
Payment Service API uses 8-bit Unicode Transformation Format as described in the ISO/ISE 10646. Merchants are required to send Service requests with content-type, application/x-www-form-urlencoded; and charset, iso-8859-1,*, utf-8 using HTTP Post method.
Charge a Credit Card
For Sales Transaction, use this code:
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "1.12",
"bill_addr" => "Apt#135, Shemwood St",
"bill_addr_city" => "Denver",
"bill_addr_country" => "US",
"bill_addr_state" => "CO",
"bill_addr_zip" => "201005",
"cust_email" => "[email protected]",
"cust_fname" => "Test James",
"cust_lname" => "Bond",
"cust_phone" => "9999333321",
"pmt_expiry" => "12/2022",
"pmt_key" => "111",
"pmt_numb" => "4111111111111111",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"request_currency" => "USD",
"transaction_type" => "CAPTURE",
"xtl_order_id" => "000011112222",
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'req_username': 'sandbox_username',
'req_password': 'sandbox_password',
'amount': '1.12',
'request_currency': 'USD',
'bill_addr': 'Apt#135, Shemwood St',
'bill_addr_city': 'Denver',
'bill_addr_country': 'US',
'bill_addr_state': 'CO',
'bill_addr_zip': '201005',
'cust_email': '[email protected]',
'cust_fname': 'Test James',
'cust_lname': 'Bond',
'xtl_order_id': '000011112222',
'cust_phone': '9999333321',
'transaction_type': 'CAPTURE',
'pmt_key': '111',
'pmt_numb': '4111111111111111',
'pmt_expiry': '12/2022'
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022"
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'amount' => '1.12',
'request_currency' => 'USD',
'bill_addr' => 'Apt#135, Shemwood St',
'bill_addr_city' => 'Denver',
'bill_addr_country' => 'US',
'bill_addr_state' => 'CO',
'bill_addr_zip' => '201005',
'cust_email' => '[email protected]',
'cust_fname' => 'Test James',
'cust_lname' => 'Bond',
'xtl_order_id' => '000011112222',
'cust_phone' => '9999333321',
'transaction_type' => 'CAPTURE',
'pmt_key' => '111',
'pmt_numb' => '4111111111111111',
'pmt_expiry' => '12/2022'
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022'
});
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "CAPTURE",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "1.1200",
"TRANS_REQUEST_ID": 1272,
"TRANS_RECORD_ID": 79154,
"TRANS_ORDER_ID": 0980982121,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD"
}
Make sure to replace
req_usernamewith your API key.
Sales Transaction Parameters
The table below only includes typical parameters sent in a simple Sales transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “CAPTURE”) | Alphanumeric |
pmt_numb |
Required* | Credit Card Number | Numeric |
pmt_key |
Required* | Credit Card CVV2 or CVC2 Code | Numeric |
pmt_expiry |
Required* | Credit Card Expiration Date | Alphanumeric MM/YYYY Example: “12/2025” |
amount |
Required | Transaction Amount | Numeric |
request_currency |
Required | 3-letter Currency Code | Alphanumeric Example: USD |
cust_fname |
Optional | Cardholder’s First Name | Alphanumeric |
cust_lname |
Optional | Cardholder’s Last Name | Alphanumeric |
cust_email |
Optional | Cardholder’s Email Address | Alphanumeric |
cust_phone |
Optional | Cardholder’s Phone Number | Numeric |
bill_addr |
Optional | Cardholder Billing Street Address | Alphanumeric |
bill_addr_city |
Optional | Cardholder’s Billing City | Alphanumeric |
bill_addr_state |
Optional | Cardholder’s Billing State | Alphanumeric |
bill_addr_zip |
Optional | Cardholder’s Billing Postal/ZIP cod | Alphanumeric |
bill_addr_country |
Optional | Cardholder’s Billing Country | Alphanumeric |
xtl_order_id |
Optional | Merchant’s Order ID | Alphanumeric |
Sales Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return CAPTURE |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Extra transaction Tracking ID |
TRANS_ORDER_ID |
order ID. This ID should be used in the refund transaction call |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
Charge a Credit Card and Save Card on file
For Sales Transaction, use this code:
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "1.12",
"bill_addr" => "Apt#135, Shemwood St",
"bill_addr_city" => "Denver",
"bill_addr_country" => "US",
"bill_addr_state" => "CO",
"bill_addr_zip" => "201005",
"cust_email" => "[email protected]",
"cust_fname" => "Test James",
"cust_lname" => "Bond",
"cust_phone" => "9999333321",
"pmt_expiry" => "12/2022",
"pmt_key" => "111",
"pmt_numb" => "4111111111111111",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"request_currency" => "USD",
"transaction_type" => "CAPTURE",
"xtl_order_id" => "000011112222",
"save_card_on_file" => "Y"
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'req_username': 'sandbox_username',
'req_password': 'sandbox_password',
'amount': '1.12',
'request_currency': 'USD',
'bill_addr': 'Apt#135, Shemwood St',
'bill_addr_city': 'Denver',
'bill_addr_country': 'US',
'bill_addr_state': 'CO',
'bill_addr_zip': '201005',
'cust_email': '[email protected]',
'cust_fname': 'Test James',
'cust_lname': 'Bond',
'xtl_order_id': '000011112222',
'cust_phone': '9999333321',
'transaction_type': 'CAPTURE',
'pmt_key': '111',
'pmt_numb': '4111111111111111',
'pmt_expiry': '12/2022',
"save_card_on_file": "Y"
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022&save_card_on_file=Y"
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022&save_card_on_file=Y");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'amount' => '1.12',
'request_currency' => 'USD',
'bill_addr' => 'Apt#135, Shemwood St',
'bill_addr_city' => 'Denver',
'bill_addr_country' => 'US',
'bill_addr_state' => 'CO',
'bill_addr_zip' => '201005',
'cust_email' => '[email protected]',
'cust_fname' => 'Test James',
'cust_lname' => 'Bond',
'xtl_order_id' => '000011112222',
'cust_phone' => '9999333321',
'transaction_type' => 'CAPTURE',
'pmt_key' => '111',
'pmt_numb' => '4111111111111111',
'pmt_expiry' => '12/2022',
'save_card_on_file' => 'Y'
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022&save_card_on_file=Y'
});
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2022&save_card_on_file=Y`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "CAPTURE",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "1.1200",
"TRANS_REQUEST_ID": 1272,
"TRANS_RECORD_ID": 79154,
"TRANS_ORDER_ID": 0980982121,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD",
"CUSTOMER_VAULT_ID": 12345
}
Make sure to replace
req_usernamewith your API key.
Sales Transaction Parameters
The table below only includes typical parameters sent in a simple Sales transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “CAPTURE”) | Alphanumeric |
pmt_numb |
Required* | Credit Card Number | Numeric |
pmt_key |
Required* | Credit Card CVV2 or CVC2 Code | Numeric |
pmt_expiry |
Required* | Credit Card Expiration Date | Alphanumeric MM/YYYY Example: “12/2025” |
amount |
Required | Transaction Amount | Numeric |
request_currency |
Required | 3-letter Currency Code | Alphanumeric Example: USD |
cust_fname |
Optional | Cardholder’s First Name | Alphanumeric |
cust_lname |
Optional | Cardholder’s Last Name | Alphanumeric |
cust_email |
Optional | Cardholder’s Email Address | Alphanumeric |
cust_phone |
Optional | Cardholder’s Phone Number | Numeric |
bill_addr |
Optional | Cardholder Billing Street Address | Alphanumeric |
bill_addr_city |
Optional | Cardholder’s Billing City | Alphanumeric |
bill_addr_state |
Optional | Cardholder’s Billing State | Alphanumeric |
bill_addr_zip |
Optional | Cardholder’s Billing Postal/ZIP cod | Alphanumeric |
bill_addr_country |
Optional | Cardholder’s Billing Country | Alphanumeric |
xtl_order_id |
Optional | Merchant’s Order ID | Alphanumeric |
save_card_on_file |
Optional** | Save card on file | String Example: “Y” |
Sales Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return CAPTURE |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Extra transaction Tracking ID |
TRANS_ORDER_ID |
order ID. This ID should be used in the refund transaction call |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
CUSTOMER_VAULT_ID |
Unique Customer vault id |
Charge a Credit Card By saved card
For Sales Transaction, use this code:
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "1.12",
"bill_addr" => "Apt#135, Shemwood St",
"bill_addr_city" => "Denver",
"bill_addr_country" => "US",
"bill_addr_state" => "CO",
"bill_addr_zip" => "201005",
"cust_email" => "[email protected]",
"cust_fname" => "Test James",
"cust_lname" => "Bond",
"cust_phone" => "9999333321",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"request_currency" => "USD",
"transaction_type" => "CAPTURE",
"xtl_order_id" => "000011112222",
"customer_vault_id" => 123455
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'req_username': 'sandbox_username',
'req_password': 'sandbox_password',
'amount': '1.12',
'request_currency': 'USD',
'bill_addr': 'Apt#135, Shemwood St',
'bill_addr_city': 'Denver',
'bill_addr_country': 'US',
'bill_addr_state': 'CO',
'bill_addr_zip': '201005',
'cust_email': '[email protected]',
'cust_fname': 'Test James',
'cust_lname': 'Bond',
'xtl_order_id': '000011112222',
'cust_phone': '9999333321',
'transaction_type': 'CAPTURE',
"customer_vault_id": 123455
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&customer_vault_id=123455"
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&customer_vault_id=123455");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'amount' => '1.12',
'request_currency' => 'USD',
'bill_addr' => 'Apt#135, Shemwood St',
'bill_addr_city' => 'Denver',
'bill_addr_country' => 'US',
'bill_addr_state' => 'CO',
'bill_addr_zip' => '201005',
'cust_email' => '[email protected]',
'cust_fname' => 'Test James',
'cust_lname' => 'Bond',
'xtl_order_id' => '000011112222',
'cust_phone' => '9999333321',
'transaction_type' => 'CAPTURE',
'customer_vault_id' => 123455
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&customer_vault_id=123455'
});
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAPTURE&customer_vault_id=123455`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "CAPTURE",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "1.1200",
"TRANS_REQUEST_ID": 1272,
"TRANS_RECORD_ID": 79154,
"TRANS_ORDER_ID": 0980982121,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD"
}
Make sure to replace
req_usernamewith your API key.
Sales Transaction Parameters
The table below only includes typical parameters sent in a simple Sales transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “CAPTURE”) | Alphanumeric |
amount |
Required | Transaction Amount | Numeric |
request_currency |
Required | 3-letter Currency Code | Alphanumeric Example: USD |
cust_fname |
Optional | Cardholder’s First Name | Alphanumeric |
cust_lname |
Optional | Cardholder’s Last Name | Alphanumeric |
cust_email |
Optional | Cardholder’s Email Address | Alphanumeric |
cust_phone |
Optional | Cardholder’s Phone Number | Numeric |
bill_addr |
Optional | Cardholder Billing Street Address | Alphanumeric |
bill_addr_city |
Optional | Cardholder’s Billing City | Alphanumeric |
bill_addr_state |
Optional | Cardholder’s Billing State | Alphanumeric |
bill_addr_zip |
Optional | Cardholder’s Billing Postal/ZIP cod | Alphanumeric |
bill_addr_country |
Optional | Cardholder’s Billing Country | Alphanumeric |
xtl_order_id |
Optional | Merchant’s Order ID | Alphanumeric |
customer_vault_id |
Required | Customer Vault ID | Numeric |
Sales Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return CAPTURE |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Extra transaction Tracking ID |
TRANS_ORDER_ID |
order ID. This ID should be used in the refund transaction call |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
Refund a Transaction
For REFUND transaction, use this code:
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "0.1",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"transaction_type" => "REFUND",
"request_ref_po_id" => "186434737",
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'request_ref_po_id': '186434737',
'transaction_type': 'REFUND',
'amount': '0.1',
'req_username': 'sandbox_username',
'req_password': 'sandbox_password'
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST \
"https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "request_ref_po_id=186434737&transaction_type=REFUND&amount=0.1&req_username=sandbox_username&req_password=sandbox_password"
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'request_ref_po_id' => '186434737',
'transaction_type' => 'REFUND',
'amount' => '0.1',
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password'
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'request_ref_po_id=186434737&transaction_type=REFUND&amount=0.1&req_username=sandbox_username&req_password=sandbox_password'
});
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("request_ref_po_id=186434737&transaction_type=REFUND&amount=0.1&req_username=sandbox_username&req_password=sandbox_password");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`request_ref_po_id=186434737&transaction_type=REFUND&amount=0.1&req_username=sandbox_username&req_password=sandbox_password`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "REFUND",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "0.1000",
"TRANS_REQUEST_ID": 80282,
"TRANS_RECORD_ID": 78443,
"TRANS_ORDER_ID": 186434737,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD"
}
Make sure to replace
req_usernamewith your API key.
Merchants may request to refund the original sales transaction by sending REFUND in the transaction_type parameter.
Refund Transaction Parameters
The table below only includes typical parameters sent in a simple Authorization transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “REFUND”) | Alphanumeric |
amount |
Required | Transaction Amount | Numeric |
request_ref_po_id |
Required | order ID | Numeric |
Refund Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return REFUND |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Order ID |
TRANS_ORDER_ID |
Extra Transaction ID |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
Authorize a Credit Card
Authorization Transaction Parameters
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "1.12",
"bill_addr" => "Apt#135, Shemwood St",
"bill_addr_city" => "Denver",
"bill_addr_country" => "US",
"bill_addr_state" => "CO",
"bill_addr_zip" => "201005",
"cust_email" => "[email protected]",
"cust_fname" => "Test James",
"cust_lname" => "Bond",
"cust_phone" => "9999333321",
"pmt_expiry" => "12/2025",
"pmt_key" => "111",
"pmt_numb" => "4111111111111111",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"request_currency" => "USD",
"transaction_type" => "AUTH",
"xtl_order_id" => "000011112222",
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'req_username': 'sandbox_username',
'req_password': 'sandbox_password',
'amount': '1.12',
}
data = {
'req_username': 'sandbox_username',
'req_password': 'sandbox_password',
'amount': '1.12',
'request_currency': 'USD',
'bill_addr': 'Apt#135, Shemwood St',
'bill_addr_city': 'Denver',
'bill_addr_country': 'US',
'bill_addr_state': 'CO',
'bill_addr_zip': '201005',
'cust_email': '[email protected]',
'cust_fname': 'Test James',
'cust_lname': 'Bond',
'xtl_order_id': '000011112222',
'cust_phone': '9999333321',
'transaction_type': 'AUTH',
'pmt_key': '111',
'pmt_numb': '4111111111111111',
'pmt_expiry': '12/2025'
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=AUTH&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2025"
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=AUTH&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2025");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'amount' => '1.12',
'request_currency' => 'USD',
'bill_addr' => 'Apt#135, Shemwood St',
'bill_addr_city' => 'Denver',
'bill_addr_country' => 'US',
'bill_addr_state' => 'CO',
'bill_addr_zip' => '201005',
'cust_email' => '[email protected]',
'cust_fname' => 'Test James',
'cust_lname' => 'Bond',
'xtl_order_id' => '000011112222',
'cust_phone' => '9999333321',
'transaction_type' => 'AUTH',
'pmt_key' => '111',
'pmt_numb' => '4111111111111111',
'pmt_expiry' => '12/2025'
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=AUTH&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2025'
});
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=AUTH&pmt_key=111&pmt_numb=4111111111111111&pmt_expiry=12%2F2025`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "AUTH",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "1.1200",
"TRANS_REQUEST_ID": 1272,
"TRANS_RECORD_ID": 79154,
"TRANS_ORDER_ID": 0980982121,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD"
}
Make sure to replace
req_usernamewith your API key.
The table below only includes typical parameters sent in a simple Sales transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “AUTH”) | Alphanumeric |
pmt_numb |
Required* | Credit Card Number | Numeric |
pmt_key |
Required* | Credit Card CVV2 or CVC2 Code | Numeric |
pmt_expiry |
Required* | Credit Card Expiration Date | Alphanumeric MM/YYYY Example: “12/2025” |
amount |
Required | Transaction Amount | Numeric |
request_currency |
Required | 3-letter Currency Code | Alphanumeric Example: USD |
cust_fname |
Optional | Cardholder’s First Name | Alphanumeric |
cust_lname |
Optional | Cardholder’s Last Name | Alphanumeric |
cust_email |
Optional | Cardholder’s Email Address | Alphanumeric |
cust_phone |
Optional | Cardholder’s Phone Number | Numeric |
bill_addr |
Optional | Cardholder Billing Street Address | Alphanumeric |
bill_addr_city |
Optional | Cardholder’s Billing City | Alphanumeric |
bill_addr_state |
Optional | Cardholder’s Billing State | Alphanumeric |
bill_addr_zip |
Optional | Cardholder’s Billing Postal/ZIP cod | Alphanumeric |
bill_addr_country |
Optional | Cardholder’s Billing Country | Alphanumeric |
xtl_order_id |
Optional | Merchant’s Order ID | Alphanumeric |
customer_vault_id |
Required** | Customer Vault ID | Numeric |
**Required when pmt_numb, pmt_key, pmt_expiry are not present.
Authorization Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return AUTH |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Extra transaction Tracking ID |
TRANS_ORDER_ID |
order ID. This ID should be used Capture (CAUTH) Transaction or used in the refund transaction call |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
Cancel/Void Authorization
For CANCEL transaction, use this code:
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "0.1",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"transaction_type" => "CANCEL",
"request_ref_po_id" => "0980982121"
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'request_ref_po_id': '0980982121',
'transaction_type': 'CANCEL',
'amount': '0.1',
'req_username': 'sandbox_username',
'req_password': 'sandbox_password'
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST \
"https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "request_ref_po_id=186434737&transaction_type=CANCEL&amount=0.1&req_username=sandbox_username&req_password=sandbox_password"
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'request_ref_po_id' => '0980982121',
'transaction_type' => 'CANCEL',
'amount' => '0.1',
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password'
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'request_ref_po_id=186434737&transaction_type=CANCEL&amount=0.1&req_username=sandbox_username&req_password=sandbox_password'
});
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("request_ref_po_id=186434737&transaction_type=CANCEL&amount=0.1&req_username=sandbox_username&req_password=sandbox_password");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
)
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
package main
import (
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream(
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`request_ref_po_id=186434737&transaction_type=CANCEL&amount=0.1&req_username=sandbox_username&req_password=sandbox_password`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "CANCEL",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "0.1000",
"TRANS_REQUEST_ID": 80282,
"TRANS_RECORD_ID": 78443,
"TRANS_ORDER_ID": 186434737,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD"
}
Make sure to replace
req_usernamewith your API key.
Merchants may request to refund the original sales transaction by sending CANCEL in the transaction_type parameter.
Cancel Transaction Parameters
The table below only includes typical parameters sent in a simple Authorization transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “CANCEL”) | Alphanumeric |
amount |
Optional | Transaction Amount | Numeric |
request_ref_po_id |
Required | order ID | Numeric |
Cancel Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return CANCEL |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Order ID |
TRANS_ORDER_ID |
Extra Transaction ID |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
Cancel Transaction Failed Response Fields
These are the fields returned to the merchant when a transaction has been declined by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return CANCEL |
TRANS_STATUS_NAME |
Transaction Status i.e DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Order ID |
TRANS_ORDER_ID |
Extra Transaction ID |
XTL_ORDER_ID |
Merchant Order ID |
API_ADVICE |
Only transactions pending settlement can be voided REFID:3182956031 |
SERVICE_ADVICE |
Only transactions pending settlement can be voided REFID:3182956031 |
PROCESSOR_ADVICE |
Only transactions pending settlement can be voided REFID:3182956031 |
ERROR_MESSAGE |
Only transactions pending settlement can be voided REFID:3182956031 |
TRANS_CUR |
3-Letter Currency Code |
Capture Previously Authorization
Capture Transaction Parameters
require 'net/http'
require 'uri'
uri = URI.parse("https://api.paybybankful.com/api/transaction/api")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/x-www-form-urlencoded"
request["Cache-Control"] = "no-cache"
request.set_form_data(
"amount" => "1.12",
"bill_addr" => "Apt#135, Shemwood St",
"bill_addr_city" => "Denver",
"bill_addr_country" => "US",
"bill_addr_state" => "CO",
"bill_addr_zip" => "201005",
"cust_email" => "[email protected]",
"cust_fname" => "Test James",
"cust_lname" => "Bond",
"cust_phone" => "9999333321",
"request_ref_po_id" => "0980982121",
"req_password" => "sandbox_password",
"req_username" => "sandbox_username",
"request_currency" => "USD",
"transaction_type" => "CAUTH",
"xtl_order_id" => "000011112222"
)
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
# response.code
# response.body
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = {
'req_username': 'sandbox_username',
'req_password': 'sandbox_password',
'amount': '1.12',
'request_currency': 'USD',
'bill_addr': 'Apt#135, Shemwood St',
'bill_addr_city': 'Denver',
'bill_addr_country': 'US',
'bill_addr_state': 'CO',
'bill_addr_zip': '201005',
'cust_email': '[email protected]',
'cust_fname': 'Test James',
'cust_lname': 'Bond',
'xtl_order_id': '000011112222',
'cust_phone': '9999333321',
'transaction_type': 'CAUTH',
'request_ref_po_id': '0980982121'
}
response = requests.post('https://api.paybybankful.com/api/transaction/api', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/transaction/api" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "cache-control: no-cache" \
-d "req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAUTH&request_ref_po_id=0980982121"
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/transaction/api");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAUTH&request_ref_po_id=0980982121");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/x-www-form-urlencoded',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'amount' => '1.12',
'request_currency' => 'USD',
'bill_addr' => 'Apt#135, Shemwood St',
'bill_addr_city' => 'Denver',
'bill_addr_country' => 'US',
'bill_addr_state' => 'CO',
'bill_addr_zip' => '201005',
'cust_email' => '[email protected]',
'cust_fname' => 'Test James',
'cust_lname' => 'Bond',
'xtl_order_id' => '000011112222',
'cust_phone' => '9999333321',
'transaction_type' => 'CAUTH',
"request_ref_po_id" => "0980982121"
);
$response = Requests::post('https://api.paybybankful.com/api/transaction/api', $headers, $data);
var fetch = require('node-fetch');
fetch('https://api.paybybankful.com/api/transaction/api', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
body: 'req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAUTH&request_ref_po_id=0980982121'
});
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`req_username=sandbox_username&req_password=sandbox_password&amount=1.12&request_currency=USD&bill_addr=Apt%23135%2C%20Shemwood%20St&bill_addr_city=Denver&bill_addr_country=US&bill_addr_state=CO&bill_addr_zip=201005&cust_email=test.jamesbond%40example.com&cust_fname=Test%20James&cust_lname=Bond&xtl_order_id=000011112222&cust_phone=9999333321&transaction_type=CAUTH&request_ref_po_id=0980982121`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/transaction/api", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns JSON structured like this:
{
"REQUEST_ACTION": "CAPTURE",
"TRANS_STATUS_NAME": "APPROVED",
"TRANS_VALUE": "1.1200",
"TRANS_REQUEST_ID": 1272,
"TRANS_RECORD_ID": 79154,
"TRANS_ORDER_ID": 0980982121,
"XTL_ORDER_ID": "000011112222",
"TRANS_CUR": "USD"
}
Make sure to replace
req_usernamewith your API key.
The table below only includes typical parameters sent in a simple Sales transaction request
| Parameter | Required | Description | Data Type |
|---|---|---|---|
req_username |
Required | Username | Alphanumeric |
req_password |
Required | Password | Alphanumeric and Special Characters |
transaction_type |
Required | Service Request Action (Send “CAUTH”) | Alphanumeric |
amount |
Required | Transaction Amount | Numeric |
request_currency |
Required | 3-letter Currency Code | Alphanumeric Example: USD |
cust_fname |
Optional | Cardholder’s First Name | Alphanumeric |
cust_lname |
Optional | Cardholder’s Last Name | Alphanumeric |
cust_email |
Optional | Cardholder’s Email Address | Alphanumeric |
cust_phone |
Optional | Cardholder’s Phone Number | Numeric |
bill_addr |
Optional | Cardholder Billing Street Address | Alphanumeric |
bill_addr_city |
Optional | Cardholder’s Billing City | Alphanumeric |
bill_addr_state |
Optional | Cardholder’s Billing State | Alphanumeric |
bill_addr_zip |
Optional | Cardholder’s Billing Postal/ZIP cod | Alphanumeric |
bill_addr_country |
Optional | Cardholder’s Billing Country | Alphanumeric |
xtl_order_id |
Optional | Merchant’s Order ID | Alphanumeric |
request_ref_po_id |
Required | Auth Transaction Order ID | Numeric |
Capture Transaction Success Response Fields
These are the fields returned to the merchant when a transaction has been approved by the Payment Service.
| Parameter | Description |
|---|---|
REQUEST_ACTION |
This will Return CAPTURE |
TRANS_STATUS_NAME |
Transaction Status i.e APPROVED OR DECLINED |
TRANS_VALUE |
Transaction Amount |
TRANS_REQUEST_ID |
Unique Transaction ID |
TRANS_RECORD_ID |
Extra transaction Tracking ID |
TRANS_ORDER_ID |
order ID. This ID should be used in the refund transaction call |
XTL_ORDER_ID |
Merchant Order ID |
TRANS_CUR |
3-Letter Currency Code |
Card Tokenization
Location
The API Endpoint: https://api.paybybankful.com/api/integration/customer/card-tokenization
Method
POST
Create Card Token
For Create Card Token, use this code:
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://api.paybybankful.com/api/integration/customer/card-tokenization")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
request["Cache-Control"] = "no-cache"
request.body = JSON.dump({
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password'
"customer_details" => {
"first_name" => "John",
"last_name" => "Doe",
"email" => "[email protected]",
"phone" => "1234567890",
"address_1" => "315 W 36th St",
"address_2" => "",
"city" => "New York",
"state" => "NY",
"zip" => "10018",
"country" => "US",
},
"card_details": {
"card_number": "4111111111111111",
"card_exp_mm": "07",
"card_exp_yy": "30",
"card_cvv": "123"
}
})
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }'
response = requests.post('https://api.paybybankful.com/api/integration/customer/card-tokenization', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/integration/customer/card-tokenization" \
-H 'Content-Type: application/json' \
-H "cache-control: no-cache" \
-d '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }'
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/integration/customer/card-tokenization");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{ \"req_username\": \"sandbox_username\", \"req_password\": \"sandbox_password\", \"customer_details\": { \"first_name\": \"John\", \"last_name\": \"Doe\", \"email\": \"[email protected]\", \"phone\": \"123456789\", \"address_1\": \"315 W 36th St\", \"address_2\": \"\", \"city\": \"New York\", \"state\": \"NY\", \"zip\": \"10018\", \"country\": \"US\" }, \"card_details\": { \"card_number\": \"4111111111111111\", \"card_exp_mm\": \"07\", \"card_exp_yy\": \"30\", \"card_cvv\": \"476\" } }");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/json',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password'
'customer_details[first_name]' => 'John',
'customer_details[last_name]' => 'Doe',
'customer_details[address_1]' => '315 W 36th St',
'customer_details[address_2]' => '',
'customer_details[city]' => 'New York',
'customer_details[state]' => 'NY',
'customer_details[zip]' => '10018',
'customer_details[country]' => 'US',
'customer_details[email]' => '[email protected]',
'card_details[card_number]' => '4111111111111111',
'card_details[card_exp_mm]' => '07',
'card_details[card_exp_yy]' => '30',
'card_details[card_cvv]' => '123',
);
$response = Requests::post('https://api.paybybankful.com/api/integration/customer/card-tokenization', $headers, $data);
var request = require('request');
var headers = {
'Content-Type': 'application/json',
'cache-control': 'no-cache'
};
var dataString = '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }';
var options = {
url: 'https://api.paybybankful.com/api/integration/customer/card-tokenization',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/integration/customer/card-tokenization", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns SUCCESS JSON structured like this:
{
"data": {
"customer_vault_id": 23211,
"first_name": "John",
"last_name": "Doe",
"cc_bin": "411111",
"cc_last_4_digit": "1111",
"customer_id": 123453,
"cc_expiry_mm": "07",
"cc_expiry_yy": "30"
},
"status": "Success",
"ts": "2023-01-31T16:47:21.750Z"
}
The above command returns FAILED JSON structured like this:
{
"errorMessage": "Merchant not found!.",
"status": "Failed",
"ts": "2023-01-31T16:47:21.750Z"
}
Make sure to replace
req_usernamewith your API key.
Location
The API is located at: https://api.paybybankful.com/api/integration/customer/card-tokenization
Method
POST
Content-Type:
application/json
Create Card Token Parameters
The table below only includes typical parameters sent in a create Token request
| Field | Description | Data Type | Required |
|---|---|---|---|
req_username |
Bankful Merchant Username | Alphanumeric | Y |
req_password |
Bankful Merchant Password | Alphanumeric and Special Characters | Y |
customer_details |
Customer Details | Object | Y |
card_details |
Card Details | Object | Y |
Create Token SUCCESS Response Fields
These are the fields returned to the merchant when an token successfully created in Bankful.
| Field Name | Description |
|---|---|
status |
Api Request Status, Example : Success |
ts |
UTC Timestamp |
data |
Card Data Object |
Create Token FAILED Response Fields
These are the fields returned to the merchant when there is an error in creating an token in Bankful.
| Field Name | Description |
|---|---|
status |
Api Request Status, Example : Success |
ts |
UTC Timestamp |
errorMessage |
Error Message |
Update Card Token
For Update Card Token, use this code:
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://api.paybybankful.com//api/integration/customer/card-tokenization/update")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
request["Cache-Control"] = "no-cache"
request.body = JSON.dump({
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
"customer_vault_id":12345,
"customer_details" => {
"first_name" => "John",
"last_name" => "Doe",
"email" => "[email protected]",
"phone" => "1234567890",
"address_1" => "315 W 36th St",
"address_2" => "",
"city" => "New York",
"state" => "NY",
"zip" => "10018",
"country" => "US",
},
"card_details": {
"card_number": "4111111111111111",
"card_exp_mm": "07",
"card_exp_yy": "30",
"card_cvv": "123"
}
})
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_vault_id":"12345", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }'
response = requests.post('https://api.paybybankful.com/api/integration/customer/card-tokenization', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/integration/customer/card-tokenization" \
-H 'Content-Type: application/json' \
-H "cache-control: no-cache" \
-d '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_vault_id":"12345" , "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }'
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/integration/customer/card-tokenization");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{ \"req_username\": \"sandbox_username\", \"req_password\": \"sandbox_password\", \"customer_vault_id\": \"12345\", \"customer_details\": { \"first_name\": \"John\", \"last_name\": \"Doe\", \"email\": \"[email protected]\", \"phone\": \"123456789\", \"address_1\": \"315 W 36th St\", \"address_2\": \"\", \"city\": \"New York\", \"state\": \"NY\", \"zip\": \"10018\", \"country\": \"US\" }, \"card_details\": { \"card_number\": \"4111111111111111\", \"card_exp_mm\": \"07\", \"card_exp_yy\": \"30\", \"card_cvv\": \"476\" } }");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/json',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'customer_vault_id' =>'12345'
'customer_details[first_name]' => 'John',
'customer_details[last_name]' => 'Doe',
'customer_details[address_1]' => '315 W 36th St',
'customer_details[address_2]' => '',
'customer_details[city]' => 'New York',
'customer_details[state]' => 'NY',
'customer_details[zip]' => '10018',
'customer_details[country]' => 'US',
'customer_details[email]' => '[email protected]',
'card_details[card_number]' => '4111111111111111',
'card_details[card_exp_mm]' => '07',
'card_details[card_exp_yy]' => '30',
'card_details[card_cvv]' => '123',
);
$response = Requests::post('https://api.paybybankful.com/api/integration/customer/card-tokenization', $headers, $data);
var request = require('request');
var headers = {
'Content-Type': 'application/json',
'cache-control': 'no-cache'
};
var dataString = '{ "req_username": "sandbox_username", "req_password": "sandbox_password","customer_vault_id":"12345", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }';
var options = {
url: 'https://api.paybybankful.com/api/integration/customer/card-tokenization/',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{ "req_username": "sandbox_username", "req_password": "sandbox_password","customer_vault_id":"12345", "customer_details": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "123456789", "address_1": "315 W 36th St", "address_2": "", "city": "New York", "state": "NY", "zip": "10018", "country": "US" }, "card_details": { "card_number": "4111111111111111", "card_exp_mm": "07", "card_exp_yy": "30", "card_cvv": "476" } }`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/integration/customer/card-tokenization", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns SUCCESS JSON structured like this:
{
"data": {
"customer_vault_id": 23211,
"first_name": "John",
"last_name": "Doe",
"cc_bin": "411111",
"cc_last_4_digit": "1111",
"customer_id": 123453,
"cc_expiry_mm": "07",
"cc_expiry_yy": "30"
},
"status": "Success",
"ts": "2023-01-31T16:47:21.750Z"
}
The above command returns FAILED JSON structured like this:
{
"errorMessage": "Merchant not found!.",
"status": "Failed",
"ts": "2023-01-31T16:47:21.750Z"
}
Make sure to replace
req_usernamewith your API key.
Location
The API is located at: https://api.paybybankful.com/api/integration/customer/card-tokenization/update
Method
POST
Content-Type:
application/json
Update Card Token Parameters
The table below only includes typical parameters sent in a create Token request
| Field | Description | Data Type | Required |
|---|---|---|---|
req_username |
Bankful Merchant Username | Alphanumeric | Y |
req_password |
Bankful Merchant Password | Alphanumeric and Special Characters | Y |
customer_details |
Customer Details | Object | Y |
card_details |
Card Details | Object | Y |
customer_vault_id |
Vault Id | Numeric | Y |
Update Token SUCCESS Response Fields
These are the fields returned to the merchant when an token successfully created in Bankful.
| Field Name | Description |
|---|---|
status |
Api Request Status, Example : Success |
ts |
UTC Timestamp |
data |
Card Data Object |
Update Token FAILED Response Fields
These are the fields returned to the merchant when there is an error in creating an token in Bankful.
| Field Name | Description |
|---|---|
status |
Api Request Status, Example : Success |
ts |
UTC Timestamp |
errorMessage |
Error Message |
Delete Card Token
For Delete Card Token, use this code:
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://api.paybybankful.com//api/integration/customer/card-tokenization/delete")
{
"req_username": "sandbox_username",
"req_password": "sandbox_password",
"customer_vault_id":12345
}
req_options = {
use_ssl: uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache',
}
data = '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_vault_id":"12345"}'
response = requests.post('https://api.paybybankful.com/api/integration/customer/card-tokenization/delete', headers=headers, data=data)
curl -X POST "https://api.paybybankful.com/api/integration/customer/card-tokenization/delete" \
-H 'Content-Type: application/json' \
-H "cache-control: no-cache" \
-d '{ "req_username": "sandbox_username", "req_password": "sandbox_password", "customer_vault_id":"12345"}'
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.paybybankful.com/api/integration/customer/card-tokenization/delete");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setRequestProperty("cache-control", "no-cache");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{ \"req_username\": \"sandbox_username\", \"req_password\": \"sandbox_password\", \"customer_vault_id\": \"12345\"}");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'Content-Type' => 'application/json',
'cache-control' => 'no-cache'
);
$data = array(
'req_username' => 'sandbox_username',
'req_password' => 'sandbox_password',
'customer_vault_id' =>'12345'
);
$response = Requests::post('https://api.paybybankful.com/api/integration/customer/card-tokenization/delete', $headers, $data);
var request = require('request');
var headers = {
'Content-Type': 'application/json',
'cache-control': 'no-cache'
};
var dataString = '{ "req_username": "sandbox_username", "req_password": "sandbox_password","customer_vault_id":"12345"}';
var options = {
url: 'https://api.paybybankful.com/api/integration/customer/card-tokenization/delete',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{ "req_username": "sandbox_username", "req_password": "sandbox_password","customer_vault_id":12345}`)
req, err := http.NewRequest("POST", "https://api.paybybankful.com/api/integration/customer/card-tokenization/delete", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("cache-control", "no-cache")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
The above command returns SUCCESS JSON structured like this:
{
"data": {
"message": "Card token delected successfully"
},
"status": "Success",
"ts": "2023-01-31T16:47:21.750Z"
}
The above command returns FAILED JSON structured like this:
{
"errorMessage": "Merchant not found!.",
"status": "Failed",
"ts": "2023-01-31T16:47:21.750Z"
}
Make sure to replace
req_usernamewith your API key.
Location
The API is located at: https://api.paybybankful.com/api/integration/customer/card-tokenization/delete
Method
POST
Content-Type:
application/json
Delete Card Token Parameters
The table below only includes typical parameters sent in a create Token request
| Field | Description | Data Type | Required |
|---|---|---|---|
req_username |
Bankful Merchant Username | Alphanumeric | Y |
req_password |
Bankful Merchant Password | Alphanumeric and Special Characters | Y |
customer_vault_id |
Vault Id | Numeric | Y |
Delete Token SUCCESS Response Fields
These are the fields returned to the merchant when an token successfully created in Bankful.
| Field Name | Description |
|---|---|
status |
Api Request Status, Example : Success |
ts |
UTC Timestamp |
data |
Card Data Object |
Delete Token FAILED Response Fields
These are the fields returned to the merchant when there is an error in creating an token in Bankful.
| Field Name | Description |
|---|---|
status |
Api Request Status, Example : Success |
ts |
UTC Timestamp |
errorMessage |
Error Message |
Appendix Token Objects
Customer Details
Customer Details Information
| Field | Description | Data Type | Required |
|---|---|---|---|
first_name |
First Name | Alphanumeric | Y |
last_name |
Last Name | Alphanumeric | Y |
address_1 |
Billing Street Address | Alphanumeric | Y |
email |
Alphanumeric Example: [email protected] |
Y | |
address_2 |
Billing Street Address 2 | Alphanumeric | N |
city |
Billing City | Alphanumeric | Y |
state |
Billing State | 2-letter State or Territory Code | N |
zip |
Billing Postal/ZIP code | Alphanumeric | N |
country |
Billing Country | 2-letter Country Code ISO 3166-1 alpha-2 | N |
phone |
Phone Number | Numeric | N |
| delete-card-token |
Card Details
Card Details Information
| Field | Description | Data Type | Required |
|---|---|---|---|
card_number |
Credit Card Number | Numeric | Y |
card_exp_mm |
Credit Card Expiry Month | Numeric Example: 12 | Y |
card_exp_yy |
Credit Card Expiry Year | Numeric Example: 30 | Y |
card_cvv |
Credit Card CVV2 or CVC2 Code | Numeric | Y |
Card Data Object
Token Data Returned with API call
| Field | Description |
|---|---|
customer_vault_id |
Customer saved card vault Id |
first_name |
Customer First Name |
last_name |
Customer Last Name |
cc_bin |
Card Bin |
cc_last_4_digit |
Card Last 4 Digit |
customer_id |
Customer Id |
cc_expiry_month |
Card Expiry Month |
cc_expiry_year |
Card Expiry Year |
Delete Card Object
Token Data Returned with API call
| Field | Description |
|---|---|
message |
Response Message |
Credit Card Test Cases
Test Card Numbers
Use these test card numbers in the sandbox environment to simulate various payment scenarios.
Successful Transactions
| Card Brand | Card Number | CVV | Expiry | Expected Result |
|---|---|---|---|---|
| Visa | 4111111111111111 | 123 | 12/2025 | Approved |
| Visa | 4012888888881881 | 123 | 01/2026 | Approved |
| Mastercard | 5105105105105100 | 123 | 03/2025 | Approved |
| Mastercard | 5555555555554444 | 123 | 06/2026 | Approved |
| American Express | 378282246310005 | 1234 | 09/2025 | Approved |
| American Express | 371449635398431 | 123 | 11/2026 | Approved |
| Discover | 6011111111111117 | 123 | 08/2025 | Approved |
| Discover | 6011000990139424 | 123 | 04/2026 | Approved |
| Diners Club | 30569309025904 | 123 | 07/2025 | Approved |
| JCB | 3530111333300000 | 123 | 10/2025 | Approved |
Declined Transactions
| Card Number | CVV | Expiry | Decline Reason |
|---|---|---|---|
| 4111111111111112 | 123 | 12/2025 | Decline - Invalid account number |
| 42423482938483873 | 123 | 12/2025 | Decline - Invalid account number |
Decline transaction
| Information | Input | Expected Response |
|---|---|---|
| Invalid amount Amount too large | 100000000000 | Declined - One or more fields in the request contains invalid data |
| Invalid Expiration Year | any past Year | Decline - Expired card. You might also receive this if the expiration date you provided does not match the date the issuing bank has on file. |
Notes for Testing
- CVV: Use any 3-digit CVV for Visa/MC/Discover, 4-digit for Amex
- Expiry Dates: Use any future date in MM/YYYY format