This page is part of the REST API Guides. Card capture happens in the frontend through the Payments Library; see the Payments Library Guides.
The Pattern
- At booking, place a hold on the card and save a token for it in one step.
- Later, capture the hold, charge the balance, charge for extras or damage, and refund part of a payment. Every call uses the same token.
- Every payment goes through the operator’s own Payment Gateway Account.
1. At Booking: Hold and Tokenize
Start a Payments Library session with thePREAUTH_AND_TOKENIZE operation. Set amount to the amount you want to hold and paymentGatewayAccountId to the operator’s Payment Gateway Account.
validateResults from your server (see Result Handling). The response contains the parts you need to keep:
2. Collect the Deposit: Capture the Hold
When you are ready to take the deposit, capture the hold. Send the capture to the Payment Gateway Account that placed the hold, with the hold reference inrefTransId:
PUT /PaymentGateway/capture. See Capture for full examples in each language.
A hold does not last forever. How long it stays valid depends on your payment processor and the card, so check with your payment processor and capture before it expires.
3. Charge the Balance on a Set Date
You have two options. Both use the token you stored at booking.- Your own charge
- A payment contract
Your system calls The result comes back on the request, including the transaction reference you need for a later refund. You can also add fallback gateways. See Charge Payments.
POST /PaymentGateway/charge on the due date, with the balance amount and the operator’s Payment Gateway Account:4. Charge for Extras or Damage
For extras, incidentals or damage found after the stay, charge the stored token withPOST /PaymentGateway/charge. The request body is the same as in Your own charge above, with the new amount. The security code (cvv) is optional for a tokenized card.
5. Refund Part of a Payment
To return part of a captured deposit or a charge, sendPUT /PaymentGateway/refund with a smaller amount. Use the Payment Gateway Account that processed the payment and the transaction reference it returned:
6. Release a Hold You Will Not Use
If the booking is cancelled before you capture, void the hold withDELETE /PaymentGateway/void. Send the same hold reference, amount and Payment Gateway Account as for the capture. See Void.
Related
Authorize & Capture
Capture and void in detail
Scheduled Payments
Templates and payment contracts
Refunds & Voids
Return funds or release a hold
Result Handling
Validate the session result on your server