Transaction API
POS Transaction
POST api.foodin.ai/store_transaction/pos_transactions
Request
Sends point of sale (POS) transaction information to Foodin. Foodin uses the POS transaction information to match POS transactions to online transactions and to audit orders.
Parameter
Field | Type | Description |
---|---|---|
bin | string | The first six digits of the payment card. Values are "539186", "546683", "555370", or "551917". |
last_four | string | The last four digits of the primary account number or payment card number. For example: 7890. . |
transaction_timestamp | string | The time of the transaction. Append the timezone at the end or use the UTC format. For example: 2022-03-09T11:37:00-5:00 or 2022-03-09T16:37:00Z. |
id | string | The global unique identifier for the transaction across all stores and banners. Avoid reusing the ID. For example: 847473. |
store_id | string | The identifier for the store. For example: 4211. |
checkout_id | string | The identifier submitted in checkout registration. |
sub_total | number | The total for the transaction excluding taxes and fees. For example: 10.23. |
total | number | The total for the transaction including taxes and fees. For example: 12.32. |
currency_code | string | The currency type in ISO 4217 format. Default is USD. |
total_tax | number | The total tax for the transaction. For example: 1.25. |
cardholder_name | string | The name associated with the payment card. For example: Foodin 12345. |
tenders | Array | The various ways the transaction was paid for. |
items | Array | The items involved in the transaction. |
taxes | Array | The taxes and fees for the transaction. |
Tenders Object
Field | Type | Description |
---|---|---|
type | string | The type of tender. One of CASH, CREDIT_CARD, DEBIT_CARD, GIFT_CARD, BYPASS, or REFUND. |
Amount | number | The amount that this tender contributed to paying for the transaction. |
Id | string | When the tender type is “BYPASS”, the ID is the pos_checkout_request_id. |
Approval_processed_by_code | string | The system that approved the process. One of STORE or FOODIN. |
Items Object
Field | Type | Description |
---|---|---|
line_item_number | string | The unique identifier for the item in the transaction. |
bar_code | string | The barcode or PLU of the item. |
store_reference_code | string | The unique identifier for this item in the store's catalog. This should be the same unique identifier sent in the inventory files. |
description | string | The name of the item. |
category | string | A general classification of the item. |
price_per_unit | number | The price of each individual unit of this item. For example, price per pound for produce. . |
item_price | number | The total price of the item excluding taxes and discounts. |
quantity | integer | The amount of the item. For weighted items, the value is 1. |
weight | number | The weight of a weighted item. Exclude this field for unweighted items. This field is required if measure_method is PREPACKAGED_BY_WEIGHT or LOOSE_RANDOM_WEIGHT_BASED. |
weight_unit | string | The unit of measure of a weighted item. Exclude this field for unweighted items. One of lb, kg, g, or oz. This field is required if measure_method is PREPACKAGED_BY_WEIGHT or LOOSE_RANDOM_WEIGHT_BASED. |
alcohol | boolean | Whether the item is an alcohol item and subject to stricter handling guidelines by the shopper. |
tobacco | boolean | Whether the item is a tobacco item and subject to stricter handling guidelines by the shopper. |
weight_certified | boolean | Whether the item weight is certified by the store. |
bar_code_missing_reason | string | The reason why a barcode is missing. If this field is provided, then leave bar_code and store_reference_code blank. |
measure_method | string | The method used to measure item numbers or weights. One of QUANTITY_BASED, PREPACKAGED_BY_WEIGHT, or LOOSE_RANDOM_WEIGHT_BASED. |
Taxes Object
Field | Type | Description |
---|---|---|
type | string | The type of tax. One of OTHER, SALES_TAX_STATE, SALES_TAX_CITY, SALES_TAX_COUNTRY, SALES_TAX_LOCAL_TAX, ALCOHOL_TAX, BAG_FEE, BATTERY_RECYCLING_FEE, BEVERAGE_CONTAINER_FEE, EXCISE, POISON_CONTROL, PREPARED_FOOD_MEALS_TAX, FEE, or RECYCLING_FEE. |
type_other | string | A freeform text representation of a tax type not captured by the type field. For example, custom taxes added by municipalities. |
amount | number | The amount of tax in dollars. For example, use "2.75" to represent $2.75. |
rate | number | The tax rate. For example, use "5.25" to represent 5.25% tax. |
flat_rate | number | The flat-fee tax rate. For example, use "2.75" to represent $2.75. |
taxable_amount | number | The total taxable amount. |
Request examples
const axios = require('axios');
const user_id = '...';
const order_id = '...';
const token = '...';
const data = '{
"bin": "string",
"last_four": "string",
"transaction_timestamp": "string",
"id": "string",
"store_id": "string",
"checkout_id": "string",
"sub_total": 1,
"total": 1,
"currency_code": "string",
"total_tax": 1,
"cardholder_name": "string",
"tenders": [
{
"type": "CASH",
"amount": 1,
"id": "string",
"approval_processed_by_code": "FOODIN"
}
],
"items": [
{
"line_item_number": "string",
"bar_code": "string",
"store_reference_code": "string",
"description": "string",
"category": "string",
"price_per_unit": 1,
"item_price": 1,
"quantity": 1,
"weight": 1,
"weight_unit": "string",
"alcohol": true,
"tobacco": true,
"weight_certified": true,
"bar_code_missing_reason": "string",
"measure_method": "string"
}
],
"taxes": [
{
"type": "OTHER",
"type_other": "string",
"amount": 1,
"rate": 1,
"flat_rate": 1,
"taxable_amount": 1
}
]
};
axios({
method: 'put',
url: `https://api.foodin.ai/store_transaction/pos_transactions`
headers: {
Accept: 'application/json',
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
data
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
Response
Field | Type | Description |
---|---|---|
id | string | ID of the transaction submitted. |
200 Success
{
"id": "transaction-id-123"
}
Response
Field | Type | Description |
---|---|---|
id | string | ID of the transaction submitted. |
4XX Errors
Code | Cause | Error Message |
---|---|---|
400 | Request fails | |
"invalid input" |