> ## Documentation Index
> Fetch the complete documentation index at: https://wpay-feat-edp-guide.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Vault a card

> Store a card for future use.

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.

<Note>
  When using [Embed][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.
</Note>

<Warning>
  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.
</Warning>

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

<CodeGroup>
  ```bash cURL
  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"
        }'
  ```

  ```js Node
  const request = new CardRequest();
  request.method = "card";
  request.number = "4111111111111111";
  request.expirationDate = "11/22";

  const paymentMethod = await client.storePaymentMethod(request);
  ```
</CodeGroup>

The API returns [the details for the newly vaulted card][api].

<Tip>
  The API also accepts a `buyer_id` or `buyer_external_identifier` which can be
  used to associate a card to a previously created [buyer][buyer].
</Tip>

[api]: /reference/payment-methods/new-payment-method

[buyer]: /guides/api/resources/buyers/associate-card

[embed]: /guides/payments/embed
