Simulating a card authorization

How can you simulate a card authorization (purchase) in the sandbox.

Overview

Because there is no actual money used in the accounts in the sandbox, we provide the ability to simulate a card authorization. This works in the same way that a purchase by a customer using their card would, but without you needing to use a genuine card and live data.

When you simulate the authorization of a card using the API, funds are removed from the card account. You can query this transaction using Retrieving transactions and Retrieving account balances.

Simulating a card authorization

To simulate a card authorization, use the POST /simulate/authorization operation and provide parameters as shown in the table below.

ParameterTypeDescription
card_id
required
stringUnique ID that identifies the card.
amount
required
stringTransaction amount as a decimal string with two digits of precision, for example 45.50.
transaction_datetime
required
stringDate and time of transaction in the format YYYY-MM-DD HH:MM. For example, 2021-12-25 18:43.
currency
required
stringISO currency for the transaction, for example USD.
merchant_name
required
stringName of the merchant for the transaction.
merchant_city
required
stringFreeform name between 3 and 20 characters.
merchant_state
required
stringTwo-character US state code or non-US state code, maximum 20 characters.
merchant_zip_code
required
stringFive-digit US zip code, (for example 54234) or nine-digit US zip code, (for example 12345-1234).
Non-US state code between 2 and 20 characters.
mcc
required
stringFour-digit number that represents the type of services or goods that a business provides. For example 5732 represents electronics retailers.
mid
required
stringFour-digit numerical code that identifies a merchant to the purchaser, for example 7922.

An example of a request to perform a simulated authorization is shown below.

curl --request POST \
     --url https://sandbox.bond.tech/api/v0/simulate/authorization \
     --header 'Accept: application/json' \
     --header 'Authorization: YOUR-AUTHORIZATION' \
     --header 'Content-Type: application/json' \
     --header 'Identity: YOUR-IDENTITY' \
     --data '
{
     "card_id": "2742ff6a-7455-4066-8b45-ae12d3acca34",
     "amount": "299.95",
     "transaction_datetime": "2021-09-10 11:39",
     "currency": "USD",
     "merchant_name": "Die Another Day",
     "merchant_city": "New York",
     "merchant_state": "NY",
     "merchant_zip_code": "12345",
     "mcc": "4324",
     "mid": "2245"
}
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://sandbox.bond.tech/api/v0/simulate/authorization")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Identity"] = 'YOUR-IDENTITY'
request["Authorization"] = 'YOUR-AUTHORIZATION'
request.body = "{\"card_id\":\"2742ff6a-7455-4066-8b45-ae12d3acca34\",\"amount\":\"299.95\",\"transaction_datetime\":\"2021-09-10 11:39\",\"currency\":\"USD\",\"merchant_name\":\"Die Another Day\",\"merchant_city\":\"New York\",\"merchant_state\":\"NY\",\"merchant_zip_code\":\"12345\",\"mcc\":\"4324\",\"mid\":\"2245\"}"

response = http.request(request)
puts response.read_body
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    Identity: 'YOUR-IDENTITY',
    Authorization: 'YOUR-AUTHORIZATION'
  },
  body: JSON.stringify({
    card_id: '2742ff6a-7455-4066-8b45-ae12d3acca34',
    amount: '299.95',
    transaction_datetime: '2021-09-10 11:39',
    currency: 'USD',
    merchant_name: 'Die Another Day',
    merchant_city: 'New York',
    merchant_state: 'NY',
    merchant_zip_code: '12345',
    mcc: '4324',
    mid: '2245'
  })
};

fetch('https://sandbox.bond.tech/api/v0/simulate/authorization', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
import requests

url = "https://sandbox.bond.tech/api/v0/simulate/authorization"

payload = {
    "card_id": "2742ff6a-7455-4066-8b45-ae12d3acca34",
    "amount": "299.95",
    "transaction_datetime": "2021-09-10 11:39",
    "currency": "USD",
    "merchant_name": "Die Another Day",
    "merchant_city": "New York",
    "merchant_state": "NY",
    "merchant_zip_code": "12345",
    "mcc": "4324",
    "mid": "2245"
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Identity": "YOUR-IDENTITY",
    "Authorization": "YOUR-AUTHORIZATION"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
var client = new RestClient("https://sandbox.bond.tech/api/v0/simulate/authorization");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Identity", "YOUR-IDENTITY");
request.AddHeader("Authorization", "YOUR-AUTHORIZATION");
request.AddParameter("application/json", "{\"card_id\":\"2742ff6a-7455-4066-8b45-ae12d3acca34\",\"amount\":\"299.95\",\"transaction_datetime\":\"2021-09-10 11:39\",\"currency\":\"USD\",\"merchant_name\":\"Die Another Day\",\"merchant_city\":\"New York\",\"merchant_state\":\"NY\",\"merchant_zip_code\":\"12345\",\"mcc\":\"4324\",\"mid\":\"2245\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"card_id\":\"2742ff6a-7455-4066-8b45-ae12d3acca34\",\"amount\":\"299.95\",\"transaction_datetime\":\"2021-09-10 11:39\",\"currency\":\"USD\",\"merchant_name\":\"Die Another Day\",\"merchant_city\":\"New York\",\"merchant_state\":\"NY\",\"merchant_zip_code\":\"12345\",\"mcc\":\"4324\",\"mid\":\"2245\"}");
Request request = new Request.Builder()
  .url("https://sandbox.bond.tech/api/v0/simulate/authorization")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("Identity", "YOUR-IDENTITY")
  .addHeader("Authorization", "YOUR-AUTHORIZATION")
  .build();

Response response = client.newCall(request).execute();

An example of a response to a successful card authorization simulation is shown below.

{
     "cardholder_presence_indicator":NULL,
     "raw_statement_descriptor":"WAUSA USA",
     "merchant_country":US,
     "merchant_id":2245,
     "payment_rail":"card",
     "account_id":"cafaa034-d487-4533-a8f0-9ced465ffdaf",
     "settled_date":"2021-07-20 22:29:00",
     "original_transaction_id":"5fd776de-50a7-4f41-97f7-1c2b4c7836e6",
     "customer_id":"b06d5406-7b65-4921-8806-bad23dd88bad",
     "transaction_id":"64875924-93d4-44f5-8682-f0c54ee8bff8",
     "amount_in_cents":"-299.95",
     "prior_balance":"998.01",
     "bond_brand_id":"e0cb152c-51dc-44b0-af3c-5c68341068da",
     "merchant_state":"NY",
     "merchant_city":"New York",
     "card_id":"b2c13e2e-c323-47c1-b07e-9c233c9ebec6",
     "fee":NULL,
     "transaction_time":"2021-07-20 22:29:00",
     "date_created":"2021-07-20 22:29:00.597522+00:00",
     "transaction_type":"POS Purchase",
     "date_updated":"2021-07-20 22:29:00.597528+00:00",
     "merchant_zip_code":"98109",
     "rewards_rate":NULL,,
     "rewards":NULL,,
     "mcc":"Online Shopping",
     "uuid":"7db5d6b3-aa52-445b-b457-839fc810aa35",
     "merchant_name":"Die Another Day",
     "amount":"-299.95",
     "transaction_state":"pending",
     "origin_timestamp":"2021-07-20 22:29:00",
     "exchange_rate":NULL,
     "new_balance":"298.01",
     "acquiring_institution_identification_code":NULL,
     "transaction_response_code":NULL,
     "merchant_address":NULL,
     "currency_code":"USD"
}

For a complete specification and interactive examples, see Simulate authorization in the Bond API Reference.