Filling in card details can be a tedious task for most users. To make this easier we offer the ability to vault a card. Once this is done the card can be used in a transaction without having to request these details from the buyer again.

When using Embed we automatically take care of this for you and make it possible for a recurring customer to re-use a card they previously used in your app. The card is automatically vaulted and bound to the buyer ID or external ID provided.

Vaulting a card only stores its information but doesn’t validate it against any PSP. To do so, a CIT (Customer Initiated Transaction) must be performed, even if it’s a zero-value one.

A card can be stored by calling the POST /payment-methods API. The call requires a method, the card number, and its expiration_date.

curl -i -X POST "https://api.example.gr4vy.app/payment-methods" \
    -H "Authorization: Bearer [JWT_TOKEN]" \
    -H "Content-Type: application/json" \
    -d '{
        "method": "card",
        "number": "4111111111111111",
        "expiration_date": "11 / 22"
      }'

The API returns the details for the newly vaulted card.

The API also accepts a buyer_id or buyer_external_identifier which can be used to associate a card to a previously created buyer.