Capture and cancel
Take the money when you're ready, or let the payment go.
Automatic or manual capture
With capture_method: "AUTOMATIC", the default, the money moves the moment the
payer approves: the payment goes straight to CAPTURED. Use it when you deliver
right away.
With capture_method: "MANUAL", approving only holds the money in the
payer's wallet: the payment becomes AUTHORIZED and waits for you. Use it when
you might not be able to deliver, such as stock to confirm or a booking to
check. You then capture, or cancel to release the hold.
Capturing
curl -X POST https://api.joingladys.com/api/v1/payments/pay_…/capture \
-H "Authorization: Bearer access_…" \
-H "Idempotency-Key: order-1042-capture"- Only an
AUTHORIZEDpayment can be captured. Anything else is400. - Capture takes the full amount. Partial capture isn't supported; to take less, capture and then refund the difference.
- Capturing a payment that is already
CAPTUREDreturns it unchanged, so retrying is safe. - Capture within 7 days of approval. After that the payment becomes
EXPIREDand the hold is released.
Needs the payments:capture scope.
Cancelling
curl -X POST https://api.joingladys.com/api/v1/payments/pay_…/cancel \
-H "Authorization: Bearer access_…" \
-H "Idempotency-Key: order-1042-cancel" \
-H "Content-Type: application/json" \
-d '{ "reason": "Out of stock" }'- You can cancel a
CREATEDpayment (the payer hasn't approved yet) or anAUTHORIZEDone (the hold is released straight away). reasonis optional and becomes the payment'scancellation_reason. It defaults toCancelled by the merchant.- Cancelling a payment that is already
CANCELLEDreturns it unchanged. - A
CAPTUREDpayment can't be cancelled: refund it instead.
Cancelling also uses the payments:capture scope.
When the payer declines
A payer can decline on the checkout page instead of approving. The payment
becomes CANCELLED with the reason Declined by the payer, and you receive
payment.cancelled.