Checking access…

Skip to main content
Audience: CCG Platform Engineers

How to Cancel a Payment

Platform engineers implementing or debugging the actual cancel request/response cycle. For the conceptual model (eligibility, reasons), see Cancel Payment Flow. For the webhook payload and error scenarios, see Cancel Payment β€” Reference.

API Request​

curl -X PATCH "https://api-stg.uhg.com/api/financial/commerce/nonprodcheckout/v2/payments/770e8400-e29b-41d4-a716-446655440000/cancel" \
-H "Authorization: Bearer <token>" \
-H "X-Merchant-Id: b955db5e-aef2-47de-bbb9-c80b9cc16e8f" \
-H "X-Upstream-Env: dev" \
-H "Content-Type: application/json" \
-d '{
"paymentCancellationReason": "REQUESTED_BY_CUSTOMER",
"paymentCancellationMessage": "Customer changed their mind before shipment"
}'

Request Body​

FieldTypeRequiredDescription
paymentCancellationReasonstring (enum)YesOne of: DUPLICATE, FRAUDULENT, REQUESTED_BY_CUSTOMER, ABANDONED
paymentCancellationMessagestringNoFree-text context (for audit trail)

API Response β€” 202 Accepted​

{
"url": "https://api-stg.uhg.com/.../v2/payments/770e8400-e29b-41d4-a716-446655440000",
"data": {
"id": "770e8400-e29b-41d4-a716-446655440000",
"merchantTransactionId": "preauth-20260404-001",
"amount": 25000,
"status": "CANCEL_INITIALIZED",
"paymentAllocations": [
{
"id": "cccc1111-2222-3333-4444-555566667777",
"amount": 25000,
"status": "CANCEL_INITIALIZED"
}
]
}
}

GET β€” After Cancellation (200 OK)​

{
"data": {
"id": "770e8400-e29b-41d4-a716-446655440000",
"amount": 25000,
"status": "CANCELLED",
"paymentAllocations": [
{
"id": "cccc1111-2222-3333-4444-555566667777",
"amount": 25000,
"status": "CANCELED"
}
]
}
}