Transactions

Cancel a transaction

Void or cancel a pending transaction before it is processed.

The Cancel Transaction endpoint voids or cancels a transaction that is still in a pending state. Once canceled, the transaction will no longer settle or capture funds.

You can only cancel transactions that have not yet been processed (pending). If a transaction has already succeeded, you must issue a refund instead.

Endpoint

DELETE /v1/transactions/{transaction_id}

Path Parameters

Parameter

Type

Required

Description

transaction_id

string

Yes

The unique ID of the transaction to cancel.

Headers

Key

Value

Required

Authorization

Bearer <access_token>

Yes

Response

Successful Response (200 OK)

{
  "id": "txn_001",
  "status": "canceled",
  "canceled_at": "2025-09-18T20:42:00Z",
  "message": "The transaction has been canceled successfully."
}

Field

Type

Description

id

string

Transaction ID.

status

string

Always canceled after success.

canceled_at

string

ISO 8601 timestamp when cancellation occurred.

message

string

Confirmation message.

Error Response (400 / 404 / 409)

{
  "error": "not_cancellable",
  "message": "Only pending transactions can be canceled."
}

Error Code

Meaning

not_found

Transaction ID does not exist.

not_cancellable

Transaction cannot be canceled because it is already processed.

unauthorized

Invalid or missing access token.

Example Usage

cURL

curl -X DELETE "https://api.example.com/v1/transactions/txn_001" \
  -H "Authorization: Bearer your_access_token"

JavaScript (Fetch)

const response = await fetch("https://api.example.com/v1/transactions/txn_001", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer your_access_token"
  }
});

const data = await response.json();
console.log(data.status); // canceled

Canceling a transaction does not remove it from records. The transaction remains visible in reports and APIs with a status of canceled.

Need help? Contact Support

Questions? Contact Sales

On this page

Create a free website with Framer, the website builder loved by startups, designers and agencies.