Payments

Cancel a payment

Cancel a payment request that's no longer needed.

Bash
POST /v1/transactions/{reference}/cancel

Scope: transactions:write

Request

FieldTypeRequiredDescription
reasonstringNoFree-text reason, kept for the audit log
Bash
curl -X POST https://api.harpoonsms.com/v1/transactions/hpn_trx_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6/cancel 
  -H "Authorization: Bearer hpn_live_sk_xxxxxxxxxxxxx" 
  -H "Content-Type: application/json" 
  -d '{ "reason": "Customer cancelled order" }'

Response

JSON
{
  "success": true,
  "reference": "hpn_trx_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
  "status": "CANCELLED",
  "message": "Transaction has been cancelled"
}

A transaction.cancelled webhook fires after the cancel succeeds.

Cancellation is rejected with 400 if the transaction is already in a terminal state (SUCCESS, PARTIAL, OVERPAID, EXPIRED, FAILED, REFUNDED, CANCELLED).