Developer Suite
Register Sandbox
Register Sandbox
  1. Ecommerce Checkout
  • Overview
  • API Endpoints
  • Ecommerce Checkout
    • Purchase
      POST
    • Get a transaction details
      POST
    • Close transaction
      POST
    • Check transaction
      POST
    • Refund API
      POST
    • Get transaction list
      POST
    • Exchange rate
      POST
  • Checkout Plugins
    • Prestashop
    • Woocommerce
  • Credentials on File
    • Link Account
      POST
    • Link Card
      POST
    • Purchase using token
      POST
    • Remove account token
      POST
    • Remove card token
      POST
    • Get linked account details
      POST
  • ABA QR API
    • QR API
      POST
  • Payment Link
    • Create payment link
      POST
    • Get payment link details
      POST
  • Pre-auth
    • Complete pre-auth transactions
      POST
    • Complete pre-auh transaction with payout
      POST
    • Cancel pre-purchase transaction
      POST
  • Payout
    • Payout
    • Update a beneficiary status
    • Add a beneficiary to whitelist
  • KHQR Guideline
  • Resources
  1. Ecommerce Checkout

Close transaction

POST
/api/payment-gateway/v1/payments/close-transaction
If your business involves transactions that may need cancellation—such as flash sales, hotel bookings, or ticket sales—you can use the Close Transaction API to cancel a transaction. Once a transaction is closed, its payment status is updated to CANCELLED. This means the payment will either be rejected or reversed, and no payment notification (callback) will be sent to the merchant.

Request

Header Params
Content-Type
string 
required
Example:
application/json
Body Params application/json
req_time
string 
required
Request date and time in UTC format as YYYYMMDDHHmmss.
merchant_id
string 
required
A unique merchant key which provided by ABA Bank.
<= 20 characters
tran_id
string 
required
Original purchase transaction id that you want to close/cancel.
<= 20 characters
hash
string 
required
A Base64-encoded HMAC SHA-512 hash generated by concatenating req_time, merchant_id, and tran_id , encrypted using your public_key.
PHP Sample Code
Example
{
    "req_time": "20241022053608",
    "merchant_id": "lavacafe",
    "tran_id": "1729573626",
    "hash": "ln9Td4JiGPc...R6y2tmUoF2NERNaQ=="
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/api/payment-gateway/v1/payments/close-transaction' \
--header 'Content-Type: application/json' \
--data-raw '{
    "req_time": "20241022053608",
    "merchant_id": "lavacafe",
    "tran_id": "1729573626",
    "hash": "ln9Td4JiGPc...R6y2tmUoF2NERNaQ=="
}'

Responses

🟢200OK
application/json
Body
status
object 
required
code
string 
required
Response code of the reqeust.
00 : Success
1 : Wrong Hash
5 : Transaction not found
26 : Invalid merchant profile
message
string 
required
Please see the property reponse code for the details.
tran_id
string 
required
Purchase transaction id that has been cancelled.
Examples
{
    "status": {
        "code": "00",
        "message": "Success!",
        "tran_id": "1729573626"
    }
}
Previous
Get a transaction details
Next
Check transaction