Skip to main content

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/post

Request Body

Transaction Post Input Model
FieldDescriptionTypeRemark
redemptionCodeAuto-generated code used to make member redemption.number
  • It is required if member is linked to mobile app user.
  • It is required for voucher redemptions and point redemptions.
memberIdTransaction member id.numberrequired
docIdTransaction document Id.stringrequired
docNoTransaction record number.stringrequired
docDateTransaction date.daterequired
outletIdOutlet Id that posted the transaction.stringrequired
outletOutlet name.stringrequired
outletDescriptionOutlet Description.string
createdUserUsername of Integration App's user that created the transaction.stringrequired
salesTransaction sales data.Sales Input Model
pointTransaction points data.Points Input Model
voucherTransaction voucher data.Voucher Input Model
Sales Input Model
FieldDescriptionType
receiptIdreceipt globally unique identifier.guid
totalExTaxSales total excluding tax.number
taxSales tax.number
serviceChargeService charge.number
serviceTaxService tax.number
roundingAdjSales rounding adjustment.number
finalTotalSales final total.number
detailsSales details.array[Sales Detail Input Model]
paymentsSales payments.array[Sales Payment Input Model]
Sales Details Input Model
FieldDescriptionTypeRemark
typeSales detail type.stringIt has four types each correspond to N - (Normal), D - (Discount), R - (Return), and T - (Trade-in). Refer here for more information.
productIdProduct Id.number
productCodeProduct Code.string
descriptionSales detail description.string
qtyProduct quantity.number
unitPriceProduct unit price.number
discountProduct discount.number
subTotalExTaxSub total excluding tax.number
subTotalSub total.number
seqSales detail sequence.numberIt 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
FieldDescriptionType
descriptionPayment description.string
amountPaid amount.number
Points Input Model
FieldDescriptionType
adjustmentAddPoints to add.number
adjustmentAddDescriptionPoint addition description.string
collectionPoints to collect.number
collectionDescriptionPoint collection description.string
adjustmentMinusPoints to minus.number
adjustmentMinusDescriptionPoint substraction description.string
redemptionPoints to redeem.number
redemptionDescriptionPoint redemption description.string
Voucher Input Model
FieldDescriptionTypeRemark
voucherNoVoucher Id assigned when linked to member.string
discountAmountAmount discountednumberWhen posting transaction that uses vouchers, it should be the fixed amount it will be applied for this transaction. For example:

  • Given the amount before discount is 200.
  • The voucher can either be specified amount or percentage amount:
    • Percentage amount
      ex: "10%"
      discountAmount should be 20.
    • Specified amount
      ex: "50"
      discountAmount should be 50.
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
FieldDescriptionType
isSuccessTransaction posting status. true indicates transaction posted.boolean
isOverRedeemPointPoint over-redemption. true indicates member points are over-redeemed.boolean
voucherErrorMessageVoucher error message.stringnullable
Example of Success Response Body
{
"isSuccess": true,
"isOverRedeemPoint": false,
"voucherErrorMessage": null
}

Error Response