ADYEN: Charge card-on-file. Manual capture.
This document is for the ADYEN integration.
Step 1: Create intent
When creating an intent with a card on file, you need both payment_method_id and external_customer_id, you will then need to call the Payment CREATE endpoint.
// POST /v1/payment/intent
{
"external_account_id": "3568-Adyen",
"amount": 49.99,
"external_payment_id": 746631,
"payment_method_id": "BTBQLDZWP6KXWD82",
"external_customer_id": "2520770",
"payment_method_types": "card",
"capture_method": "manual"
}
The response you will get back will have a status of requires_payment_method
. This means it's valid and can be authorized.
// RESPONSE
{
"payment_id": "pi_Rain55B9A3984B8A85B88E30216FF09C",
"status": "requires_payment_method",
"external_transaction_id": 746631,
"request_id": 60629
}
Step2: Authorize payment
Next you will need to authorize the payment using the Payment AUTH endpoint which will also auto-capture the payment.
// POST /v1/payment/auth
{
"external_account_id": "3568-Adyen",
"payment_id": "pi_Rain55B9A3984B8A85B88E30216FF09C"
}
The response should have a status of requires_capture
.
// RESPONSE
{
"payment_id": "pi_Rain55B9A3984B8A85B88E30216FF09C",
"date_created": "2023-07-25T23:15:30+00:00",
"external_transaction_id": "746631",
"status": "requires_capture",
"amount": "49.99",
"amount_authorized": 49.99,
"amount_captured": 0,
"amount_capturable": 0,
"amount_refunded": 0,
"amount_refundable": 0,
"tip_amount": 0,
"donation_amount": 0,
"currency": "USD",
"card_present": false,
"payment_method_id": "BTBQLDZWP6KXWD82",
"notes": null,
"authorization_code": null,
"processor": "Adyen",
"funding_source": null,
"payment": {
"type": "card_not_present",
"brand": "Visa",
"last_4": "1111",
"exp_month": "03",
"exp_year": 2030,
"cardholder_name": null,
"receipt_data": null,
"payment_method_id": "BTBQLDZWP6KXWD82"
},
"avs_response_code": 5,
"avs_response_message": "No AVS data provided",
"request_id": 60630
}
Step3: Capture
Since you specified that you will manually capture the payment, you will need make a call the Payment CAPTURE endpoint to capture the payment.
// POST /v1/payment/capture
{
"external_account_id": "3568-Adyen",
"payment_id": "pi_Rain55B9A3984B8A85B88E30216FF09C",
"amount": 49.99
}
Your response should now have a status of capture_requested
or success
// RESPONSE
{
"payment_id": "pi_Rain55B9A3984B8A85B88E30216FF09C",
"date_created": "2023-07-25T23:15:30+00:00",
"external_transaction_id": "746631",
"status": "capture_requested",
"amount": "49.99",
"amount_authorized": 49.99,
"amount_captured": "49.99",
"amount_capturable": 0,
"amount_refunded": 0,
"amount_refundable": "49.99",
"tip_amount": 0,
"donation_amount": 0,
"currency": "USD",
"card_present": false,
"payment_method_id": "BTBQLDZWP6KXWD82",
"notes": null,
"authorization_code": null,
"processor": "Adyen",
"funding_source": null,
"payment": {
"type": "card_not_present",
"brand": "Visa",
"last_4": "1111",
"exp_month": "03",
"exp_year": 2030,
"cardholder_name": null,
"receipt_data": null,
"payment_method_id": "BTBQLDZWP6KXWD82"
},
"avs_response_code": 5,
"avs_response_message": "No AVS data provided",
"request_id": 60630
}