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 an account balance.

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.1/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.1/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.1/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.1/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.1/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.1/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.

{
  "transaction_id": "3fd4356b-a64b-4d2f-8699-cbb2b76e1d52",
  "customer_id": "08ebf96f-d3e2-4a50-8a52-d5677c3c9825",
  "card_id": "7c216d02-e5ca-4d88-b8da-90b912a34081",
  "raw_statement_descriptor": "Amazon.com Amzn.com/billWAUSA USA",
  "account_id": "4b9cecad-8081-49aa-ab71-d273d64fb50e",
  "bond_brand_id": "91b8a931-c86d-462b-9db5-eded20b26bd9",
  "payment_rail": "card",
  "amount": "-4.99",
  "amount_in_cents": "-499",
  "currency_code": "USD",
  "exchange_rate": null,
  "transaction_type": "POS Purchase",
  "cardholder_presence_indicator": null,
  "original_transaction_id": null,
  "merchant_name": "Amazon.Com Amzn.Com/Billwausa Usa",
  "merchant_id": null,
  "merchant_address": null,
  "merchant_country": null,
  "merchant_city": "string",
  "merchant_state": "string",
  "merchant_zip_code": "string",
  "mcc": "Online Shopping",
  "settled_date": "2021-07-20 22:29:00",
  "new_balance": "298.01",
  "prior_balance": "303",
  "transaction_time": "2021-07-20 22:29:00",
  "date_created": "2021-07-20 22:29:00",
  "date_updated": "2021-07-20 22:29:00",
  "fee": null,
  "rewards_rate": null,
  "rewards": null,
  "transaction_state": "pending",
  "origin_timestamp": "2021-07-20 22:29:00",
  "transaction_response_code": null,
  "acquiring_institution_identification_code": null
}

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