Saving a European Card While Creating a Payment
Create a payment and store a customer's card payment information in one operation.
A stored card payment method is called a card on file. Sensitive personal identifying information (PII) is stored securely, and the client has access only to the card ID. A card on file can be defined for unrelated payments, installment plans, or recurring payments. You can define a card multiple times for different payment types. 3DS authentication is required only when the card is saved on the first payment, not for future payments.
This procedure is relevant to European card payment method types.
Note
You can accomplish the same result using Add Payment Method to Customer.
Prerequisites
Run Get Payment Method Required Fields for a European card payment method.
How
Create a payment as described in Create Payment, with the following settings:
payment_method
- Specify an object that contains all the required fields for a card payment method.payment_method.fields.recurrence_type
- The type of payment. One of the following:installment - A defined number of payments.
recurring - Indefinitely recurring payments.
unscheduled - Individual unrelated payments.
initiation_type
- Set as customer_present.save_payment_method
- Set as true.
Create Payment request - partial
{ "payment_method": { "type": "gb_visa_card", "fields": { "recurrence_type": "installment", "name": "John Doe", // . . . } }, // . . . "initiation_type": "customer_present", "save_payment_method": true, }
Response - partial
"data": { // . . . "payment_method": "card_e1571fbb1822d5a3dae219545e33d489", "payment_method_data": { // . . . "recurrence_type": "installment", // . . . }, // . . . }
The response shows:
payment_method
- The secure card payment method ID, a string starting with card_. In this example: card_e1571fbb1822d5a3dae219545e33d489payment_method_data.recurrence_type
- The recurrence type value. In this example: installment
For a full code example, see Payment by card - save payment method on Create Payment.
Note
If you did not set 3d_required
to false, the operation is complete when the customer completes 3DS authentication.