Purchase
This call is executed to allow to submit the transactions of customers.
POST
/accounts/transactions/submit
Request elements
Parameter | Type | Required | Description |
---|---|---|---|
account.accountId | String | Yes | Unique ID generated for the customer |
account.phone | String | Yes | Phone number of the customer |
account.email | String | Yes | Email ID of the customer |
account.first | String | Yes | First name of the customer |
account.last | String | Yes | Last name of the customer |
receipt | String | Yes | Transaction’s unique identity |
openTime | Date | Yes | Transaction’s open time |
closeTime | Date | Yes | Transaction’s time of closing |
operatorId | String | No | Cashier’s unique identity |
operatorName | String | No | Cashier’s name |
deviceId | String | No | POS terminal’s unique identity |
deviceName | String | No | POS terminal’s name |
billed | Decimal | Yes | Transaction’s gross total |
paid | Decimal | Yes | Transaction’s net paid |
redeemed | Decimal | Yes | Transaction’s net paid in loyalty redemption |
billDiscount | Decimal | Yes | Transaction’s total bill level discount |
itemDiscountTotal | Decimal | Yes | Transaction’s total item level discount |
billTax | Decimal | Yes | Transaction’s total bill level tax |
itemTaxTotal | Decimal | Yes | Transaction’s total item level tax |
sku | String | Yes | Line item’s unique identifier |
qty | Decimal | Yes | Line item’s quantity |
unitPrice | Decimal | Yes | Line item’s gross unit price |
payments.name | String | Yes | Currency type (e.g. UAE currency) |
payments.typeName | String | Yes | Payment type (e.g. Cash) |
payments.amount | Decimal | Yes | Payment amount |
payments.referenceId | String | Yes | Unique identity of the voucher if voucher is set to true |
voucher.name | Boolean | Yes | Voucher reward title |
voucher.typeName | String | Yes | Type of redemption |
voucher.referenceId | String | Yes | Voucher code |
voucher.amount | Decimal | Yes | Value of the voucher |
voucher.redemption | Boolean | Yes | True: Indicates that the voucher is redeemable |
voucher.voucher | Boolean | Yes | True: Indicates that the voucher has been assigned to the customer |
extras.name | String | Yes | Type of additional amount charged to the customer, which is not a product or a service. For example, delivery charges, shipping charges etc |
extras.amount | Decimal | Yes | Additional amount charged to the customer, which is not a product purchased. For example: USD 20 as delivery charge indicates charging 20 dollars for delivering the purchased product. Assigning '0' value here indicates there is no extra amount charged to the customer |
API Validations on the values
Field | Description |
---|---|
itemTaxTotal | This should be the total of all the taxes in the items (Sum of items.tax*items.qty) |
itemDiscountTotal | This should be the total of all the discounts in the items (Sum of items.discount.amount*items.qty) |
billed | This should be a sum of all items, taxes and extras, that is,
Sum(items.unitPrice*qty)+ Sum(extras.amount)+ billTax+ itemTaxTotal |
paid | This should be billed-billDiscount-itemDiscountTotal-redeemed |
Error messages
Error Code | Error Message |
---|---|
1004 | The following field is not unique |
1006 | The following fields are invalid |
1002 | Fields are empty |
EXAMPLE REQUEST:
POST http://[subdomain].datanuum.com/accounts/transactions/submit
{
"account": {
"accountId": "BSNS-10249",
"phone": "971581111148",
"email": "john2091@email.com",
"first": "John",
"last": "Samuel"
},
"receipt": "BSNS-201705141056",
"openTime": "2017-05-14 10:33:15",
"closeTime": "2017-05-14 10:33:15",
"billed": 1300,
"paid": 900,
"redeemed": 200,
"billDiscount": 0,
"itemDiscountTotal": 200,
"billTax": 0,
"itemTaxTotal": 50,
"operatorId" : "STAFF001",
"operatorName" : "Catherine",
"deviceId" : "POS001",
"deviceName" : "Front-desk",
"items": [
{
"sku": "SKU-001",
"name": "Service Name",
"description": "Service Desc",
"type": "Service",
"qty": 1,
"unit": "Service",
"unitPrice": 1200,
"tax": 50,
"discount": {
"name": "Name for the Discount",
"description": "Description for the Discount",
"amount": 200,
"groupId": "Discount GroupId",
"groupName": "Discount Group name",
"type": "Discount Type",
"reason": "Discount Reason",
"authorizedBy": "Branch-Manager"
}
},
{
"sku": "Zero-001",
"name": "Zero",
"description": "Zero level desc",
"type": "Service",
"qty": 1,
"unit": "Service",
"unitPrice": 0,
"tax": 0
}
],
"payments": [
{
"name": "Cash",
"typeName": "Cash",
"amount": 900,
"date": "2019-05-14 10:33:15",
"redemption": false,
"voucher": false,
"referenceId": "12685988"
},
{
"name": "50 AED VOUCHER REDEMPTION",
"typeName": "Voucher",
"referenceId": "7kwPsl",
"amount": 50,
"redemption": true,
"voucher": true
},
{
"name": "100 LOYALTY REDEMPTION",
"typeName": "Loyalty Points",
"amount": 150,
"redemption": true,
"voucher": false
}
],
"extras": [
{
"name": "Delivery Charge",
"amount": 50
}
]
}
EXAMPLE RESPONSE:
{
"status" : "success"
}