Skip to main content

Cancel payment

Cancels payment by payment_details_id.

Endpoint​

POST /payments/cancel

Query Parameters​

  • version (string, required) - API contract version. Use exactly 2024-10-01.
  • diagnostics (boolean, optional) - Non-production docs only. Set true to include extra diagnostic metadata (for example observed_client_ip).

Header Parameters​

  • PW-subscription-key (string, required)
  • PW-origin-country (string, required)
  • PW-request-date (string, required)
  • PW-ip-address (string, required)
  • User-Agent (string, required)

Request Body​

Schema-defined JSON body (no concrete example provided).

Responses​

200 - Wrapper-normalized response envelope (success cases).​

Example: cancel_success​

{
"status": "success",
"code": 200,
"message": "Transaction canceled successfully.",
"request_id": "4eb0f132-7b4a-4968-acfd-5f3ca1116e2e",
"timestamp": "2026-03-14T04:52:09.000Z"
}

Example: already_cancelled​

{
"status": "error",
"code": 409,
"message": "Transaction already cancelled.",
"request_id": "f5a2ef80-a9af-4f07-b1ef-0e690b9a3d8e",
"timestamp": "2026-03-14T04:50:16.000Z"
}

400 - Wrapper-normalized response envelope (400)​

Example: error​

{
"status": "error",
"code": 400,
"message": "payment_details_id is required",
"request_id": "f1297691-052b-485d-8474-045b40ea29f9",
"timestamp": "2026-02-11T03:59:45.739Z",
"observed_client_ip": {
"request_ip": "172.64.80.1",
"socket_remote_address": "172.64.80.1"
}
}

Example: invalid_api_key_from_upstream​

{
"status": "error",
"code": 400,
"message": "Unauthorized: invalid `api_key` ",
"request_id": "8c1ef274-aefc-4c41-ad4a-febfb67cd5b5",
"timestamp": "2026-03-14T04:45:41.000Z",
"errorCode": "PW_UNAUTHORIZED_INVALID_API_KEY"
}

403 - Wrapper-normalized response envelope (403)​

Example: captured_primary​

{
"status": "error",
"code": 403,
"message": "Invalid or unauthorized `PW-subscription-key`",
"request_id": "45edfc0e-bf7d-4a30-bd40-22c40c10a235",
"timestamp": "2026-02-11T03:59:45.734Z",
"observed_client_ip": {
"request_ip": "172.64.80.1",
"socket_remote_address": "172.64.80.1"
}
}

Notes​

This endpoint page is generated from openapi/pw-wrappers.2024-10-01.yaml.