Product API
Fulfillment guide
Transactions

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

FieldTypeDescription
binstringThe first six digits of the payment card. Values are "539186", "546683", "555370", or "551917".
last_fourstringThe last four digits of the primary account number or payment card number. For example: 7890. .
transaction_timestampstringThe 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.
idstringThe global unique identifier for the transaction across all stores and banners. Avoid reusing the ID. For example: 847473.
store_idstringThe identifier for the store. For example: 4211.
checkout_idstringThe identifier submitted in checkout registration.
sub_totalnumberThe total for the transaction excluding taxes and fees. For example: 10.23.
totalnumberThe total for the transaction including taxes and fees. For example: 12.32.
currency_codestringThe currency type in ISO 4217 format. Default is USD.
total_taxnumberThe total tax for the transaction. For example: 1.25.
cardholder_namestringThe name associated with the payment card. For example: Foodin 12345.
tendersArrayThe various ways the transaction was paid for.
itemsArrayThe items involved in the transaction.
taxesArrayThe taxes and fees for the transaction.

Tenders Object

FieldTypeDescription
typestringThe type of tender. One of CASH, CREDIT_CARD, DEBIT_CARD, GIFT_CARD, BYPASS, or REFUND.
AmountnumberThe amount that this tender contributed to paying for the transaction.
IdstringWhen the tender type is “BYPASS”, the ID is the pos_checkout_request_id.
Approval_processed_by_codestringThe system that approved the process. One of STORE or FOODIN.

Items Object

FieldTypeDescription
line_item_numberstringThe unique identifier for the item in the transaction.
bar_codestringThe barcode or PLU of the item.
store_reference_codestringThe unique identifier for this item in the store's catalog. This should be the same unique identifier sent in the inventory files.
descriptionstringThe name of the item.
categorystringA general classification of the item.
price_per_unitnumberThe price of each individual unit of this item. For example, price per pound for produce. .
item_pricenumberThe total price of the item excluding taxes and discounts.
quantityintegerThe amount of the item. For weighted items, the value is 1.
weightnumberThe 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_unitstringThe 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.
alcoholbooleanWhether the item is an alcohol item and subject to stricter handling guidelines by the shopper.
tobaccobooleanWhether the item is a tobacco item and subject to stricter handling guidelines by the shopper.
weight_certifiedbooleanWhether the item weight is certified by the store.
bar_code_missing_reasonstringThe reason why a barcode is missing. If this field is provided, then leave bar_code and store_reference_code blank.
measure_methodstringThe method used to measure item numbers or weights. One of QUANTITY_BASED, PREPACKAGED_BY_WEIGHT, or LOOSE_RANDOM_WEIGHT_BASED.

Taxes Object

FieldTypeDescription
typestringThe 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_otherstringA freeform text representation of a tax type not captured by the type field. For example, custom taxes added by municipalities.
amountnumberThe amount of tax in dollars. For example, use "2.75" to represent $2.75.
ratenumberThe tax rate. For example, use "5.25" to represent 5.25% tax.
flat_ratenumberThe flat-fee tax rate. For example, use "2.75" to represent $2.75.
taxable_amountnumberThe 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

FieldTypeDescription
idstringID of the transaction submitted.

200 Success

{
  "id": "transaction-id-123"
}

Response

FieldTypeDescription
idstringID of the transaction submitted.

4XX Errors

CodeCauseError Message
400Request fails
"invalid input"