Cancel a deposit
Start with the short API guide for a ready-to-use client and minimal request. This page keeps the detailed reference and existing anchors.
POST / is our Merchant API. It requires deposits:write, HMAC and an Idempotency-Key; see Authentication.
Supported D06 profile
LIVE accepts only the Merchant's own THB awaiting_liquidity order that has never issued transfer instructions. TEST accepts an isolated pending awaiting_payment deposit in the active run. Source alone does not establish that your deployment has enabled this profile; check its deployment evidence.
When cancelling is possible
| Order | Result |
|---|---|
LIVE awaiting_liquidity, never instructed | Accepted only after every source check passes |
LIVE awaiting_payment, or any previously displayed account/QR | 409 deposit_not_cancelable, even without a slip |
| Any allocation, reservation, destination, external route or prepared external intent | 409 deposit_not_cancelable, including inactive history |
| Any slip receipt, evidence or evidence application | 409 deposit_not_cancelable |
| settled / expired / canceled / rejected / reversed, or slip-processing states | A new command returns 409 deposit_not_cancelable |
| TEST pending order from an archived run | 409 sandbox_ |
The absence of a slip is insufficient. Source history is checked atomically with cancellation, including the genuine original CREATE 202 receipt for an uninstructed awaiting_liquidity order with empty legs. The cascade generation changes and its claim/lease is cleared. Cancellation does not release existing reservations or cancel an already issued upstream route to make the order eligible.
Request
The body must contain exactly one field:
{ "reason": "Customer changed the amount before transfer instructions" }reason: 1–500 Unicode codepoints, not whitespace-only; no C0/C1 controls or lone surrogates.- Maximum body: 8 KiB. Query parameters are rejected.
Idempotency-Key: 8–200 visible ASCII characters, with no spaces. Retry with the same key and raw body.- HMAC authenticates the actual raw bytes; no trimming or JSON re-encoding occurs before verification.
- Use a fresh timestamp, nonce and signature for retry. Do not change bytes under the same key.
- Audit/idempotency retain request and reason digests, not raw support-readable reason text.
The overall deadline is 4.5 seconds. After an ambiguous network result, retry the original command rather than generating a new key.
Response 200
{
"id": "dep_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"object": "deposit_order",
"version": 2,
"status": "canceled",
"livemode": true,
"merchant_reference": "ORDER-108",
"end_user_ref": "customer-reference",
"amount_minor": 50000,
"currency": "THB",
"created_at": "2026-10-18T08:00:00.000Z",
"updated_at": "2026-10-18T08:01:00.000Z",
"expires_at": "2026-10-18T08:30:00.000Z",
"metadata": {},
"legs": [],
"canceled_by": "merchant",
"cancel_reason_code": "merchant_request",
"is_terminal": true,
"late_slip_accepted_until": null
}The existing public sender_id alias and return_url may remain when present. There is no canceled_at, payment instruction, upload capability, settlement fee or manufactured balance transaction in this cancellation profile.
One transaction stores the D06 transition, immutable source, deposit.canceled callback payload and receipt. Configured delivery uses the existing signing scheduler. No journal, credit or refund is created: this order has not received money. Current GET returns the canceled snapshot. Replaying the original CREATE still returns its original CREATE receipt. The signed LIVE event has exactly id, object, type, api_version, livemode, created_at and data; polling reads the same immutable transition source rather than rebuilding the event from a later order state.
Idempotency and current authority
An authorized exact replay returns 200 with Idempotent-Replay: true, without another transition or event. Different raw bytes under the same key return 409 idempotency_key_reused. Expired/revoked keys or suspended Merchant/ancestor authority cannot recover an old success. Authority is rechecked after lock waits and before replay.
A new command for a terminal order returns 409; unknown/foreign orders return 404. Malformed JSON returns 400 malformed_json; a well-formed body that fails the exact reason-only contract returns 422 validation_error. Oversized bodies return 400 invalid_request, and exhausted quota returns 429. Unavailable or deadline-exceeded requests return 503 service_unavailable; retry the same command after an ambiguous result. This operation creates no balance.credited event.
TEST / Sandbox
Use the Sandbox host and its sk_test key. Only an own pending deposit in the active run is eligible. Original fee/run snapshots and the CREATE receipt remain. The result is canceled / sandbox.outcome: cancel with a signed deposit.canceled event. Wallet balances do not change and no fictional refund ledger entry is added.
After reset, a new command for an archived order returns 409; a retained exact cancel replay recovers its original receipt before quota or cleanup. No magic amount or employee simulate outcome is added. Upgrade the SDK and refresh the UI to readers accepting canceled deposits/events before use. See Sandbox and Webhooks.