Skip to Content
Docs

Saved cards

Tokenize cards into reusable pm_card_ payment methods and network tokens without handling raw card data.

A saved card is a reusable payment method (pm_card_…) that lets you charge a returning customer for future purchases, one-click checkouts, or subscriptions without collecting card details again.

Pay.com uses two-stage tokenization so raw card data never touches your servers. Pay.com.js collects the card and returns a card token (tok_card_…), which your server can exchange for a permanent pm_card_… ID.

Token types

Pay.com uses two token types at different stages of the flow:

PropertyCard tokenPermanent payment method
Prefixtok_card_pm_card_, pm_paypal_, and others
LifetimeReusable. The card stays in the vault, and the CVV collected with it is kept for 15 minutes at mostPermanent until deleted or expired
PurposeRaw card data collected by Pay.com.jsStored, reusable payment method
Used inPOST /v1/payment_methods or source_data on charges and holdssource (or its alias payment_method) on charges and holds, and payment_method on subscriptions

Tokenization flow

Follow these four steps to vault a card without handling raw card numbers on your server.

  1. 1

    Create a session

    Your server creates a tokenization session via POST /v1/sessions/tokenization and passes its client_secret to Pay.com.js.

  2. 2

    Collect card details

    Pay.com.js renders a secure card input on your frontend. When the customer submits the form, Pay.com.js sends the card directly to Pay.com and returns a tok_card_ token.

  3. 3

    Exchange for a permanent ID

    Your server calls POST /v1/payment_methods with customer_reference_id, type: "token", and token: { "id": "tok_card_…" } (or POST /v1/payment_methods/create_from_token). The response id is the permanent payment method (for example, pm_card_685217824846643200).

  4. 4

    Charge the saved payment method

    Pass the pm_ ID as source (or its alias payment_method) when you create charges and holds, and as payment_method when you create subscriptions.

Network tokens

Pay.com can add a network token from Visa, Mastercard, or American Express to a card you save. The token keeps working when the issuer replaces the card, so you keep charging the same pm_card_ ID. See Network tokens.

Importing payment methods from an external vault

To migrate cards from an external PCI-compliant vault into Pay.com, call POST /v1/payment_methods/import. It accepts raw card details and returns a permanent pm_ ID you can use across charges, holds, and subscriptions.

POST /v1/payment_methods/import takes raw card data in card (number, expiry_month, expiry_year, and optional cvv, name, and billing_address), not a vault token. It needs an API key enabled for raw card data (PCI), and it doesn't verify the card with the issuer.

Next steps

Follow these guides to implement saved cards:

Was this page helpful?