Void an order
Use this endpoint to cancel a paid Hosted Model order before settlement, if the payment method supports voiding.
Endpoint summary
Path: /hosted-checkout/void
Method: POST
Content-Type: application/json
Request parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| merchantId | String | M | Merchant identifier |
| orderId | Number | C | Order ID of the payment. Mandatory when merchantReference is not given |
| merchantReference | String(64) | C | Unique reference of the order. Mandatory when orderId is not given |
Request example
{
"request": "{\"merchantId\":3,\"orderId\":5570}",
"signature": "<signature-generated-for-this-exact-payload>"
}
Response parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| responseCode | String | M | Payment Gateway response code |
| message | String | M | Payment Gateway response message |
| order | Object | M | |
| order.id | Number | M | Order identifier |
| order.merchantId | Number | M | Merchant identifier which own this order |
| order.merchantReference | String | M | Your reference for the order |
| order.currency | String | M | 3-Letters ISO currency code of the order |
| order.amount | Number | M | Order amount |
| order.netAmount | Number | M | Net amount of the order |
| order.cardType | String | M | Card type of the order |
| order.email | String | M | Customer's email if provided |
| order.createTime | Datetime | M | Timestamp when the order is created. Maintained by the Payment Gateway |
| order.updateTime | Datetime | M | Timestamp when the order is last updated. Maintained by the Payment Gateway |
| order.status | String | M | Status of the order. Maintained by the Payment Gateway |
| order.recurring | Boolean | M | Flags the order is a recurring order or not |
| transaction | Object | M | |
| transaction.id | Number | M | Transaction identifier for the void transaction |
| transaction.merchantId | Number | M | Merchant identifier which own this transaction |
| transaction.type | String | M | Transaction type |
| transaction.amount | Number | M | Transaction amount |
| transaction.status | String | M | Status of the transaction. Maintained by the Payment Gateway |
| transaction.maskedPan | String | M | Masked card number of the original sale transaction if supported by the payment method |
| transaction.stan | String | M | System trace audit number for the transaction |
note
- Not all payment methods support voiding. Check the order status after the request to confirm the void was applied.
Response example
{
"responseCode": "0000",
"order": {
"id": 5570,
"merchantId": 3,
"merchantReference": "merRef1656603707555",
"currency": "HKD",
"amount": 50.00,
"netAmount": 0,
"cardType": "MASTER",
"createTime": "2022-06-30T15:41:48.000+00:00",
"updateTime": "2022-06-30T15:42:16.000+00:00",
"status": "VOIDED",
"recurring": false
},
"transaction": {
"id": 3754,
"merchantId": 3,
"type": "SALE_VOID",
"amount": 50.00,
"currency": "HKD",
"status": "SUCCESS",
"maskedPan": "545668XXXXXX9797",
"stan": "S3753"
}
}