Secure Fields with stored cards
Use Secure Fields to collect the CVV for cards previously stored.
It is possible to use Secure Fields to collect card details on a profile page to store the card on a buyer’s account.
Secure Fields can then be used to collect the security code at checkout, allowing a buyer to use a stored card together with a securely collected security code.
1. Store card for future use
The first step is to store the card data for future use. Use the checkout session as described in our quick-start to store the card details as a new payment method in our vault.
This will delete the security code from our system. We recommend not collecting the security code with Secure Fields in this use case. Instead, the security code will be collected in the next step.
The returned payment method includes details about the card that was used, as well
as the id
of the payment method that we can use in the next step.
{
"type": "payment-method",
"id": "77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5",
"method": "card",
"scheme": "visa",
"expiration_date": "07/24",
...
}
2. Collect the CVV
At checkout, Secure Fields can be used to collect the CVV for a previously stored card.
When initializing Secure Fields, make sure to pass the id
of the previously stored card.
With this ID in place, you capture the security code securely.
When using the paymentMethodId
with Secure Fields, only the
security code can be captured. Attempting to add any of the other
fields (number, expiration date) will result in an error.
3. Create a transaction
When Secure Fields is submitted, it will collect the security code for the stored payment method. You can then create a transaction with the checkout session much like a regular Secure Fields transaction.
The returned transaction includes details about the payment method used, and the status of the transaction.
{
"type": "transaction",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"status": "authentication_succeeded",
"amount": 1299,
"currency": "AUD",
"payment_method": {
"type": "payment-method",
"id": "77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5",
"method": "card",
"scheme": "visa",
"expiration_date": "07/24",
...
},
...
}
Was this page helpful?