Post Transaction
Api to create Transaction
note
The api is idempotent as the same input will produce the same result and no duplicate data will be produced.
Request
POST:/{integrationId}/transaction/postRequest Body
Transaction Post Input Model
| Field | Description | Type | Remark | |
|---|---|---|---|---|
redemptionCode | Auto-generated code used to make member redemption. | number |
| |
memberId | Transaction member id. | number | required | |
docId | Transaction document Id. | string | required | |
docNo | Transaction record number. | string | required | |
docDate | Transaction date. | date | required | |
outletId | Outlet Id that posted the transaction. | string | required | |
outlet | Outlet name. | string | required | |
outletDescription | Outlet Description. | string | ||
createdUser | Username of Integration App's user that created the transaction. | string | required | |
sales | Transaction sales data. | Sales Input Model | ||
point | Transaction points data. | Points Input Model | ||
voucher | Transaction voucher data. | Voucher Input Model |
Sales Input Model
| Field | Description | Type |
|---|---|---|
receiptId | receipt globally unique identifier. | guid |
totalExTax | Sales total excluding tax. | number |
tax | Sales tax. | number |
serviceCharge | Service charge. | number |
serviceTax | Service tax. | number |
roundingAdj | Sales rounding adjustment. | number |
finalTotal | Sales final total. | number |
details | Sales details. | array[Sales Detail Input Model] |
payments | Sales payments. | array[Sales Payment Input Model] |
Sales Details Input Model
| Field | Description | Type | Remark |
|---|---|---|---|
type | Sales detail type. | string | It has four types each correspond to N - (Normal), D - (Discount), R - (Return), and T - (Trade-in). Refer here for more information. |
productId | Product Id. | number | |
productCode | Product Code. | string | |
description | Sales detail description. | string | |
qty | Product quantity. | number | |
unitPrice | Product unit price. | number | |
discount | Product discount. | number | |
subTotalExTax | Sub total excluding tax. | number | |
subTotal | Sub total. | number | |
seq | Sales detail sequence. | number | It indicates the order of the document details displayed. The field value is determined by the order of the data list inserted in the request body when creating or updating a document. |
Sales Payment Input Model
| Field | Description | Type |
|---|---|---|
description | Payment description. | string |
amount | Paid amount. | number |
Points Input Model
| Field | Description | Type |
|---|---|---|
adjustmentAdd | Points to add. | number |
adjustmentAddDescription | Point addition description. | string |
collection | Points to collect. | number |
collectionDescription | Point collection description. | string |
adjustmentMinus | Points to minus. | number |
adjustmentMinusDescription | Point substraction description. | string |
redemption | Points to redeem. | number |
redemptionDescription | Point redemption description. | string |
Voucher Input Model
| Field | Description | Type | Remark |
|---|---|---|---|
voucherNo | Voucher Id assigned when linked to member. | string | |
discountAmount | Amount discounted | number | When posting transaction that uses vouchers, it should be the fixed amount it will be applied for this transaction. For example:
|
Example of Request Body
{
"redemptionCode": 1,
"memberId": 1,
"docId": "1",
"docNo": "T01-000001",
"docDate": "2023-10-20T09:35:36.967Z",
"outletId": "1",
"outlet": "KLA-01",
"outletDescription": "Electronic Store Klang",
"createdUser": "ADMIN",
"sales": {
"receiptId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"totalExTax": 6299.1,
"tax": 0,
"serviceCharge": 0,
"serviceTax": 0,
"roundingAdj": 0,
"finalTotal": 6299.1,
"details": [
{
"type": "N",
"productId": 1,
"productCode": "Microsoft Laptop",
"description": "Microsoft Surface Pro 9 (Core i5, 16GB/256GB, Windows 11) 13-inch Tablet - Graphite (QI9-00030)",
"qty": 1,
"unitPrice": 6999,
"discount": 0,
"subTotalExTax": 6999,
"subTotal": 6999,
"seq": 1
},
{
"type": "D",
"unitPrice": 0,
"discount": 0,
"subTotalExTax": -699.9,
"subTotal": -699.9,
"seq": 2
}
],
"payments": [
{
"description": "CASH",
"amount": 6099.1
},
{
"description": "POINT",
"amount": 200
}
]
},
"point": {
"redemption": 2000,
"redemptionDescription": "Redeem RM200"
},
"voucher": {
"voucherNo": "00001-00001-000001",
"discountAmount": 699.9
}
}
Example of Request URL:
Parameters:integrationId = d9cdb75e-da7c-43dc-8dee-7d786b464c59 URL:
POST: https://onerewards-integration-api.autocountcloud.com/d9cdb75e-da7c-43dc-8dee-7d786b464c59/transaction/post Response
Success Response
Status Code: 201
Response Body
Transaction Post Result Model
| Field | Description | Type | |
|---|---|---|---|
isSuccess | Transaction posting status. true indicates transaction posted. | boolean | |
isOverRedeemPoint | Point over-redemption. true indicates member points are over-redeemed. | boolean | |
voucherErrorMessage | Voucher error message. | string | nullable |
Example of Success Response Body
{
"isSuccess": true,
"isOverRedeemPoint": false,
"voucherErrorMessage": null
}