Skip to content

Cancel an unpaid order

POST
/Transactions/CancelOrder
curl --request POST \
--url https://cybqa.pesapal.com/pesapalv3/api/Transactions/CancelOrder \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "order_tracking_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Cancels an order that has not been paid.

Cancelling is not idempotent: a second cancellation of the same order fails with Invalid order state. Order cannot be cancelled.

The cancellation is not reflected anywhere else in the API. getTransactionStatus continues to report the order as pending, so record the cancellation yourself.

Every failure returns the same message, Invalid order request., whether the id is unknown, malformed, empty or missing.

Media typeapplication/json
object
order_tracking_id
required
string format: uuid
Examplegenerated
{
"order_tracking_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Returned for both success and failure. This response has no error key in either case. Read status.

Media typeapplication/json

Returned by cancellation and refund operations. There is no error key in this shape, on success or failure.

object
status

"200" on success, "500" on failure.

string
message
string
Examples
{
"status": "200",
"message": "Order successfully cancelled."
}