API: POST Transaction
Overview
The important pieces of onboarding for a transaction on Confirm are very similar to onboarding for Banyan Enrich. The biggest distinction is the importance of including the same finx_consumer_token
sent with the offer activation in the transaction record. This is the key to signaling to our matching engine that there is an offer that needs to be assessed.
Developers, please see the API Reference for an interactive example.
URL
POST api.banyan.com/rest/v1/transaction
Authentication and Authorization
Contact your Banyan representative to obtain an API key and Access ID to be used on the authorization end point. Once you have your key and ID, you will use the following curl call to obtain your token. Tokens expire every 30 minutes. Using a retired token will result in a 404 error response.
TOKEN=$(curl -s -X POST \
-H 'Content-Type: application/json' \
--data "{\"access_id\":\"$ACCESS_ID\",\"api_key\":\"$API_KEY\"}" \
${GATEWAY_URL}/token | jq -r .data[0])
Headers
Header Name | Description | Required | Values |
---|---|---|---|
Bearer | Access Token | Required | See Authorization section |
Content-Type | The transaction format to send | Optional | application/JSON |
Accept | The response format sent back | Optional | application/JSON |
POST Body
Top Level Objects
Element | Description | Data Type | Required | Notes |
---|---|---|---|---|
transaction_id | Unique to the transaction | string | Required | |
purchase_ts | When the purchase occurred | RFC3339 | Required | Timestamp is in UTC, example: 2021-01-28T14:43:50.52Z |
currency | Currency of the transaction amount | string | Optional | Default is USD |
consumer_token | A hashed token that is unique to the household or consumer | string | Optional |
Payment Object
Each payment used on the receipt is a different object in the array
Element | Description | Type | Required | Notes |
---|---|---|---|---|
payments | An array of payments | Top Level Object | Required | |
payment_type | Whether the payment was in cash, gift card, debit or credit | string | Optional | |
scheme | If debit or credit, what network is the card on | string | Optional | Valid values include Mastercard, Visa, Discover and American Express |
card_last_four | The last four digits on a debit or credit card | string | Optional | |
BIN | Bank Identification Number associated with the card used | string | Optional | Some BINs will be 8 digits in the near future |
total amount | The total amount of the transaction | decimal | Required | |
auth_code | Six digit alphanumeric code passed between banks that signal a transaction is possible | string | Optional | |
arn | A unique 16-digit number that tags a credit or debit card transaction when it goes from the merchant’s bank through to the cardholder's bank. | string | only available on credit card transactions from visa and mastercard |
Merchant Object
Element | Description | Type | Required | Notes |
---|---|---|---|---|
merchant | Elements pertaining to the location of the purchase | top level object | Required | |
name | The name of the merchant | string | Optional | E.g., ABC Store #23 |
description | The description of the transaction, with merchant details | string | Optional | |
merchant_id | Also known as MID, it’s a 15-digit distinctive code assigned by merchant bank to identifies a merchant account to their acquirer | string | Optional |
Location Object
Element | Description | Type | Required | Notes |
---|---|---|---|---|
location | Elements pertaining to the address of the store where the purchase took place | top level object | Required | |
address_line_one | Street address of the store | string | ||
address_line_two | Additional address information | string | Such as a lot number | |
city | City of the store | string | ||
state | State of the store | string | ||
country | Country of the store | string | ISO 3066-1, Alpha 2 format preferred | |
postal_code | Postal code of the store | string |
Sample Request
POST http://api.banyan.com/rest/v1/transaction
Bearer: {token_id}
Content-Type: application/json
Accept: application/json
{
"transaction": {
"transaction_id": "928010812908",
"purchase_ts": "2021-09-03T11:48:02.745487434Z",
"currency": "USD",
"consumer_token": "d448d0aa-4383-40ff-a222-4bca8d7d53d7",
"merchant": {
"name": "Pickles US inc",
"merchant_id": "899444"
},
"location": {
"address_line_one": "12 Main Street",
"address_line_two": "Floor 2",
"city": "Holmdel",
"state": "NJ",
"country": "US",
"postal_code": 8382
},
"location_type": "In Store",
"payment": {
"payment_type": "credit",
"scheme": "Mastercard",
"card_last_four": "9287",
"total_amount": 20.98,
"authorization_code": "392082",
"arn": "198018429390"
}
}
}
Response
Element | Description | Type | Notes |
---|---|---|---|
byn_transaction_id | The ID of the receipt generated by Banyan | string | This is what to use when using the GET method on /receipt |
Sample Response
{
"data": [
{
"byn_transaction_id": "c35fd152-454a-5281-a1f2-bc8426b68461"
}
],
"errors": []
}
Status Codes and Errors
The receipt will be validated upon delivery, and if there is an error, we will report it in our request response
Code | Description | Notes |
---|---|---|
200 | Success | A record was written to the /receipt resource |
400 | Bad Request | This error code will come with a brief description of what needs to be changed such as a data type or unknown field name |
401 | Not Found | Not authorized to view data |
500 | Internal Server Error |
Updated about 1 year ago