Authorize and capture
Separate payment authorization and capture to create a charge now, but capture funds later.
When initiating a card payment, you have the option to initiate a temporary hold on a valid payment method. This hold effectively reserves the required funds, allowing you to complete the payment process at a later time. An analogous practice is often seen in the hotel industry where the full payment is pre-authorized when a guest makes a reservation, with the actual payment being processed during check-out.
Once a payment is authorized, the specified amount becomes secured and temporarily held on the customer's designated payment method. It's essential to capture the funds prior to the authorization's expiration. If the authorization lapses before fund capture, the reserved funds are released, and the payment status is updated to "canceled." Typically, it's advised to capture the funds within a span of 7 days.
Tell wooshpay to authorize only
To indicate that you want separate authorization and capture, specify capture_method as manual
when creating the PaymentIntent.
Request
{
"amount": 100000,
"currency": "USD",
"confirm": true,
"payment_method_data": {
"type": "card",
"card": {
"exp_month": "**",
"exp_year": "****",
"number": "5204*******01011",
"cvc": "***",
"name": "John Wick"
}
},
"merchant_order_id": "Order112344343",
"capture_method": "manual",
"return_url": "https://wooshpay.com"
}
Response
{
"id": "pi_1693466278934609920",
"object": "payment_intent",
"created": 1692588799000,
"livemode": false,
"currency": "USD",
"amount": 100000,
"status": "requires_action",
"merchant_order_id": "Order112344343",
"client_secret": "pi_1693466278934609920_secret_xjsfriry3X8stv3ROmynz0kz",
"next_action": {
"type": "challenge_redirect",
"challenge_redirect": {
"url": "https://jstest.wooshpay.com/v1/3ds/index.html?c=3.1&type=challenge&dataId=pi_1693466278934609920&force3ds=false&k1=cGtfdGVzdF9OVEUyTmpnMU1EZ3dORFV6T1RZNE1EYzJPREF4T205T2EzcGpOMDQzVTJkWVdFODRWVmhHWm1GNGNUaHZUVEUyT0RZMk16Z3lPVFl6TWpV&clientSecret=pi_1693466278934609920_secret_xjsfriry3X8stv3ROmynz0kz",
"return_url": "https://wooshpay.com"
}
},
"payment_method_types": [
"card"
],
"confirmation_method": "automatic",
"payment_method_options": {
"card": {
"request_three_d_secure": "auto",
}
},
"return_url": "https://wooshpay.com",
"payment_method": "pm_1693466278808780800",
"capture_method": "manual"
}
Capture the funds
After the payment method is authorized, the PaymentIntent status
transitions to requires_capture
. To capture the authorized funds, make the Wooshpay PaymentIntent capture request.
The total authorized amount is captured by default—you can’t capture more than this. To capture less than the initial amount, you can the amount_to_capture
option. Partially capturing will automatically releases the remaining amount.
Request
{
"amount_to_capture":8000
}
Response
{
"id": "pi_1694233070128857088",
"object": "payment_intent",
"created": 1692771616000,
"livemode": false,
"currency": "USD",
"amount": 100000,
"status": "succeeded",
"merchant_order_id": "Order112344343",
"client_secret": "pi_1694233070128857088_secret_NsqzB1sC1nS8DZo7mn6wpoXn",
"payment_method_types": [
"card"
],
"confirmation_method": "automatic",
"payment_method_options": {
"card": {
"request_three_d_secure": "auto"
}
},
"amount_capturable": 92000,
"return_url": "https://wooshpay.com",
"payment_method": "pm_1694233069961084928",
"amount_received": 8000,
"capture_method": "manual",
"latest_charge": "ch_1694233070229520384"
}
You can only capture once on an authorized payment. If you partially capture a payment, you can not make another capture for this payment.
When a customer completes the payment by making the PaymentIntent with manual capture. It will trigger the payment_intent.amount_capturable_updated
event. And you can see the total amount that you can capture by amount_capturable
of PaymentIntent.
Cancel the authorization
If you need to cancel an authorization, you can make a PaymentIntent cancel request.