Checking access…

Skip to main content
Audience: CCG Platform Engineers

How to Authorize and Capture a Payment

Platform engineers implementing or debugging the actual authorize/capture request-response cycle β€” full flow, request/response shapes, and validation rules. For the conceptual model (what pre-auth/capture is, expiry, partial authorization), see Pre-Auth & Capture Flow.

Sequence Diagram β€” Full Flow​

Step 1 β€” Create Pre-Auth Payment​

Request​

Sample Request β€” Pre-Auth
curl -X POST "https://api-stg.uhg.com/api/financial/commerce/nonprodcheckout/v2/payments" \
-H "Authorization: Bearer <token>" \
-H "X-Merchant-Id: b955db5e-aef2-47de-bbb9-c80b9cc16e8f" \
-H "X-Upstream-Env: dev" \
-H "Content-Type: application/json" \
-d '{
"merchantTransactionId": "preauth-20260404-001",
"amount": 25000,
"currencyCode": "USD",
"authorizeCard": true,
"partialAuthorization": true,
"customer": {
"hsid": "b313c1d1-b5b6-4ec7-8b5a-3a9cf7755060"
},
"paymentAllocations": [
{
"amount": 25000,
"paymentMethodId": "b0b3c48d-4cf6-404a-a554-e14640a51c5b"
}
]
}'

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,
"currencyCode": "USD",
"status": "INITIATED",
"authorizeCard": true,
"partialAuthorization": true
}
}

GET β€” After Authorization (200 OK)​

{
"data": {
"id": "770e8400-e29b-41d4-a716-446655440000",
"amount": 25000,
"authorizedAmount": 25000,
"capturedAmount": 0,
"status": "AUTHORIZED",
"authorizeCard": true,
"partialAuthorization": true,
"paymentAllocations": [
{
"id": "cccc1111-2222-3333-4444-555566667777",
"amount": 25000,
"authorizedAmount": 25000,
"capturedAmount": 0,
"status": "AUTHORIZED"
}
]
}
}

Webhook β€” PAYMENT_AUTHORIZED​

{
"name": "PAYMENT_AUTHORIZED",
"source": "merchant-portal",
"payload": {
"id": "770e8400-e29b-41d4-a716-446655440000",
"merchantTransactionId": "preauth-20260404-001",
"amount": 25000,
"status": "AUTHORIZED",
"paymentAllocations": [
{
"id": "cccc1111-2222-3333-4444-555566667777",
"amount": 25000,
"authorizedAmount": 25000,
"status": "AUTHORIZED"
}
]
}
}

Step 2 β€” Capture​

Full Capture (No Request Body)​

Omitting the request body captures the full authorized amount on all allocations.

curl -X PATCH "https://api-stg.uhg.com/api/financial/commerce/nonprodcheckout/v2/payments/770e8400-e29b-41d4-a716-446655440000/capture" \
-H "Authorization: Bearer <token>" \
-H "X-Merchant-Id: b955db5e-aef2-47de-bbb9-c80b9cc16e8f" \
-H "X-Upstream-Env: dev" \
-H "Content-Type: application/json"

Partial Capture (With Request Body)​

Capture less than the authorized amount. The remaining authorized amount is released.

Sample Request β€” Partial Capture
curl -X PATCH "https://api-stg.uhg.com/api/financial/commerce/nonprodcheckout/v2/payments/770e8400-e29b-41d4-a716-446655440000/capture" \
-H "Authorization: Bearer <token>" \
-H "X-Merchant-Id: b955db5e-aef2-47de-bbb9-c80b9cc16e8f" \
-H "X-Upstream-Env: dev" \
-H "Content-Type: application/json" \
-d '{
"paymentAllocations": [
{
"id": "cccc1111-2222-3333-4444-555566667777",
"amount": 18000
}
],
"metadata": {
"captureReason": "partial-fulfillment"
}
}'

Capture Validation Rules​

RuleHTTP StatusError
Payment must be in AUTHORIZED state400INVALID_REQUEST
Capture amount ≀ authorized amount per allocation400INVALID_REQUEST
Allocation id must belong to the payment400INVALID_REQUEST
Combined metadata (existing + new) ≀ 20 entries400INVALID_REQUEST

Capture Response β€” 202 Accepted​

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