TRANSACTION INPUT
Transaction Input API
Transaction Repository provides a single common endpoint for all transaction inputs. To use the Transaction Input API, please, use the following URL: https://txr-input.retailsvc.com/
Transaction Input
Transaction search is available through the following POST endpoint: link. When sending a transaction, you would have to provide additional information about the transaction in the headers. This information is vital for us to store the transaction and not including it will result in a failure:
- 'Country-Code' - The country code of the transaction.
- 'Previous-Transaction-Id' - Previous transaction in the sequence or FIRST_TRANSACTION if it's the first one.
- 'Correlation-Id' - UUID that can be used to trace the transaction inside HiiRetail.
- 'Transaction-Id' - Transaction ID itself.
- 'Business-Unit-Id' - The ID of the business unit.
- 'Transaction-Timestamp' - The timestamp of the transaction in ISO 8601. The service will not accept transactions that are older than 6 months.
- 'Tenant-Id'
Transaction Repository uses these same headers when publishing the transaction event back to the Pub/Sub as event's attributes.
Example
zippedTransaction
variable contains a zipped transaction with following supported zip headers in HEX format:
- 0x78 0x01
- 0x78 0x5e
- 0x78 0x9c
- 0x78 0xda
- 0x78 0x20
- 0x78 0x7d
- 0x78 0xbb
- 0x78 0xf9
To check if your zip file is supported, you need to:
- Zip your transaction file using the
DEFLATE
algorithm. - Take first two bytes of the zip file and transform them to HEX encoding.
- If the first two bytes are not one of the above, then the zip file is not supported.
async function insertTransaction() {
const response = await fetch(
'https://txr-input.retailsvc.com/api/v1/transactions',
{
method: 'POST',
body: zippedTransaction,
headers: {
'Content-Type': 'application/zip',
Authorization: 'Bearer <your-api-key>',
'Country-Code': 'US',
'Previous-Transaction-Id': 'FIRST_TRANSACTION',
'Correlation-Id': '8efc3b16-336d-4712-825e-440d2d81fbbe',
'Transaction-Id': '001;01;23;2021-11-1417:13:10;4',
'Business-Unit-Id': '01',
'Transaction-Timestamp': '2020-01-01T00:00:00.000Z',
'Tenant-Id': '<your-tenant-id>',
},
}
);
if (response.status === 202) {
console.log('Transaction successfully inserted');
} else {
console.log('Transaction insertion failed');
}
}