Hold and capture
Reserve funds on a customer's card, then capture them when you're ready or cancel the hold to release them.
The hold and capture flow, also known as authorization and capture, lets you reserve funds on a customer's card and capture them at a later time. It's an advanced flow typically used by businesses that only take money when a service is fulfilled, such as hotels, airlines, or e-commerce platforms that ship physical goods. If you decide not to go ahead, you cancel the hold and the reserved funds go back to the customer.
Requirements
Before performing a hold and capture, make sure you have the following:
- Select your environment base URL. The examples use the sandbox (
https://api.sandbox.pay.com/v1) with ansk-pay-com-sandbox-key. - Have access to your API credentials.
- A unique
idempotency-keyheader for each request.
Create and capture a hold
Reserve the funds with a hold, then capture them in one or more capture requests.
- 1
Create a hold
To reserve funds without capturing them, send a
POSTrequest to the/v1/holdsendpoint. A successful response returns a Hold object withstatus: requires_capture, indicating the funds are reserved on the customer's card but not yet captured. Amounts are in minor units (the smallest currency unit), so10000equals $100.00 USD.You can create a hold using raw card data or a stored payment method.
{ "amount": 10000, "currency": "usd", "source_data": { "type": "card", "card": { "number": "4242424242424242", "expiry_month": "12", "expiry_year": "2028", "cvv": "123", "name": "John Smith" }, "billing_details": { "name": "John Smith", "email": "john.smith@example.com" } }, "description": "Hold for Order #12350", "reference": "order-12350", "payment_method_options": { "card": { "duplicate_card_check": false } } }{ "id": "hld_686178331611104256", "resource": "hold", "amount": 10000, "amount_human_readable": "100.00", "amount_capturable": 10000, "billing_details": { "address": null, "email": "john.smith@example.com", "name": "John Smith", "phone": null }, "created": "2026-03-09T08:00:00.000Z", "currency": "usd", "customer": null, "customer_reference_id": null, "description": "Hold for Order #12350", "failure_code": null, "failure_message": null, "metadata": {}, "payment_method": "pm_card_686178340000000000", "reference": "order-12350", "status": "requires_capture", "test_mode": true }If the API returns the hold with
status: requires_authentication, the issuer requires 3D Secure. Create a linked authentication session withresourceset to the hold ID (hld_…) and show the challenge, as described in create a charge with 3DS. If you passconfirm: false, the hold moves torequires_confirmation. CallPOST /v1/holds/{hold_id}/confirmafter the customer returns. The hold then moves torequires_captureand you can capture it. - 2
Capture funds
When you are ready to capture the funds, send a
POSTrequest to/v1/holds/{hold_id}/capture. Replace{hold_id}with theidreturned when you created the hold.You can capture the full amount in one call, or capture part of it.
To capture the entire reserved amount, omit the
amount_to_capturefield. The API returns the new charge object. The hold transitions tostatus: succeededandamount_capturabledrops to0.POST https://api.sandbox.pay.com/v1/holds/{hold_id}/capture{}
Cancel a hold
If you decide not to proceed with a transaction, cancel the hold to release the reserved funds back to the customer before any funds move to your account. Send a POST request to /v1/holds/{hold_id}/cancel with the hold id returned when you created the hold. You can cancel a hold unless it's fully captured or already canceled.
Cancellation is all or nothing, and it's final:
- Cancellation always releases the full remaining
amount_capturable. Partial releases are not supported. - If you want to release only part of the reserved funds, capture only what you need first (see Capture funds). The rest stays capturable, and you can call this endpoint to release it.
- Once canceled, the hold is permanently closed. It can't be reopened or used for future captures. If you need to charge the customer again, create a new hold or charge.
curl -X POST https://api.sandbox.pay.com/v1/holds/hld_686178331611104256/cancel \
-u ':sk-pay-com-sandbox-…' \
-H "idempotency-key: $(uuidgen)"{
"id": "hld_686178331611104256",
"resource": "hold",
"amount": 10000,
"amount_human_readable": "100.00",
"amount_capturable": 0,
"billing_details": {
"address": null,
"email": "john.smith@example.com",
"name": "John Smith",
"phone": null
},
"created": "2026-03-09T08:00:00.000Z",
"currency": "usd",
"customer": null,
"customer_reference_id": null,
"description": "Hold for Order #12350",
"failure_code": null,
"failure_message": null,
"metadata": {},
"payment_method": "pm_card_686178340000000000",
"reference": "order-12350",
"status": "canceled",
"cancellation_reason": "requested_by_merchant",
"test_mode": true
}When the request succeeds, the hold status changes from requires_capture to canceled and amount_capturable drops to 0. Unlike a refund, which can take several days, a canceled hold usually frees the customer's funds sooner. The customer's card issuer decides when.
The response includes a cancellation_reason field indicating why the hold was canceled:
| Value | Description |
|---|---|
requested_by_merchant | The merchant called the cancel endpoint. |
hold_on_funds_expired | The hold expired because it was not captured within the allowed window. |
Listen for webhooks
Use webhooks to track the lifecycle of the hold and keep your order management system up to date.
hold.requires_capture: Sent when a hold is approved and funds are successfully reserved and awaiting capture.hold.captured: Sent for every capture you perform. If you partially capture funds from the same hold three times, your system receives this webhook three times.hold.succeeded: Sent only for the first capture. It tells your system that the initial capture was successful and does not fire again for subsequent captures against the same hold.hold.canceled: Sent when you cancel the hold or when it expires.hold.failed: Sent if the initial attempt to create the hold is declined.
Verify each event's signature with the Pay-Signature header and your endpoint's signing secret (HMAC SHA-256) to make sure the event is legitimate. See verify webhook signatures.
Next steps
- Refund a charge: return funds after a capture has already settled.
- Create a charge: see how a standard charge differs from the hold and capture flow, or charge the customer after canceling a hold.
- Webhooks: verify signatures and handle hold lifecycle events reliably.