Skip to content

Cancel a trade ​

http
POST /api/trades/:id/cancel

User · buyer only

Refunds the escrow to the seller.

Preconditions ​

  • Trade is ESCROW_LOCKED (not yet marked paid)

Sequence ​

  1. Claim → REFUNDING.
  2. Submit the refund transaction (remove signer, merge to seller).
  3. → CANCELLED with refundTxHash, cancelReason: "BUYER_CANCELLED"; write ESCROW_REFUND ledger entry and system message.
  4. Reactivate the order if it hasn't expired (broadcasts order:created).

Response 200 ​

Updated trade details with links.refund.

Errors ​

StatusCodeCause
403FORBIDDENNot the buyer
409CONFLICTAlready paid, finished, or concurrent change
502STELLAR_TX_FAILEDRejected; status restored
503HORIZON_UNAVAILABLEOutcome unknown; reconciled automatically

Nexlm is a peer-to-peer facilitator and never holds customer Naira.