Developer Suite
Register Sandbox
Register Sandbox
  1. Pre-auth
  • 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. Pre-auth

Cancel pre-purchase transaction

POST
/api/merchant-portal/merchant-access/online-transaction/pre-auth- cancellation
Cancel pre-auth (or cancel pre-authorization) is the process of releasing a temporary hold on funds placed on a customer's payment method before the final transaction is completed.
Important Notes:
You can only cancel a pre-authorization if the transaction is still pending; if the pre-auth has already been completed or previously cancelled, it cannot be cancelled again.
Each transaction’s pre-authorization can be cancelled only once.
Once the cancellation is successfully processed, the transaction status will update to "CANCELLED."
For ABA PAY and Card transactions, funds are instantly released back to the payer, whereas for KHQR transactions, the funds will be refunded to the payer.

Request

Header Params
Content-Type
string 
required
Example:
application/json
Body Params application/json
request_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
merchant_auth
string 
required
The JSON-encoded object containing mc_id and tran_id using RSA public key encryption in chunks. The encrypted data is then concatenated and encoded in Base64 format.

mc_id string mandatory
A unique merchant key which provided by ABA Bank. Same value as merchant_id.

tran_id string mandatory
Pre-auth purcahse transaction id to cancel.

PHP Sample Code
hash
string 
required
Base64-encoded HMAC-SHA512 hash of concatenated values: merchant_id, merchant_auth, and request_time with public_key.
PHP Sample Code
Example
{
    "request_time": "20200728093403",
    "merchant_id": "ec000002",
    "merchant_auth": "b1453eac8cd686f...c026a3f70678afd",
    "hash": "wR2bVPV...Q6/llsnJ bw=="
}

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/merchant-portal/merchant-access/online-transaction/pre-auth- cancellation' \
--header 'Content-Type: application/json' \
--data-raw '{
    "request_time": "20200728093403",
    "merchant_id": "ec000002",
    "merchant_auth": "b1453eac8cd686f...c026a3f70678afd",
    "hash": "wR2bVPV...Q6/llsnJ bw=="
}'

Responses

🟢200OK
application/json
Body
grand_total
number 
required
The original amount authorized for pre-auth transactions.
currency
string 
required
Original transaction currency
transaction_status
string 
required
Status of the transaction. After successfully cancelling, its status is CANCELLED
status
object 
required
code
string 
required
00: Success!
PTL02: Invalid hash provided. Ensure you are using the correct hash key.
PTL04: Parameter validation failed. Verify that all required fields are correctly formatted.
PTL06: The request has expired. Please generate a new request and retry.
PTL36: Invalid transaction. Ensure that the transaction ID is correct.
PTL62: Invalid merchant information. Verify your merchant ID and try again.
PTL63: Merchant does not have a security configuration file. Contact support for assistance.
PTL59: Unable to complete or cancel Pre-auth. Check the transaction status before retrying.
PTL60: Pre-auth amount exceeds the allowed limit. Reduce the amount and try again.
PTL61: Invalid action type. Ensure you are using a valid operation type.
PTL157: An unexpected error occurred. Please try again later or contact our digital support team.
PTL168: Concurrent requests are not allowed. Wait a few seconds and retry.
PTL169: The merchant profile cannot accept payments. Settlement account is closed.
USD-NOT-ALLOW: The requested amount is not permitted. Choose a valid amount.
KHR-LESS-100: KHR amount must be greater than 100 KHR.
KHR-CONTAIN-DECIMAL: Amount for KHR currency must be a whole number (no decimals allowed).
message
string 
required
Please see more details on the property code above.
Examples
{
    "grand_total": 1.5,
    "currency": "USD",
    "transaction_status": "CANCELLED",
    "status": {
        "code": "00",
        "message": "Success"
    }
}
Previous
Complete pre-auh transaction with payout
Next
Payout