Skip to Content
Docs

Provision network tokens

Request a network token when saving or charging a card, configure account defaults, and listen for provisioning webhooks.

Pay.com requests a network token from the card network for saved cards. You can enable provisioning at the account level, per payment method, or per payment.

Choose where to enable provisioning

You can enable provisioning in three places. Request-level settings take precedence over your account default.

  • For your account: Set card.network_token.provision.enabled via PATCH /v1/merchants/current/payment_method_options. It applies to every card payment and saved card that doesn't specify its own setting.
  • For one payment method: Set provision_network_token on POST /v1/payment_methods.
  • For one payment: Set payment_method_options.card.network_token.provision.enabled on a charge, a hold, or a payment, setup, or checkout session.

When you create a payment method without setting provision_network_token or payment_method_options.card.network_token.provision.enabled, Pay.com provisions a network token for every card sent without three_ds. If you send both fields, payment_method_options.card.network_token.provision.enabled takes precedence.

Provision when you save a card

Set provision_network_token to true when creating the payment method. This example saves a card token from Pay.com.js. You can also send raw card details with a PCI compliant key.

curl -X POST https://api.sandbox.pay.com/v1/payment_methods \
  -u ':sk-pay-com-sandbox-…' \
  -H "Content-Type: application/json" \
  -d '{
    "customer_reference_id": "cust_ext_abc123",
    "type": "token",
    "token": {
      "id": "tok_card_296645958265997326"
    },
    "provision_network_token": true
  }'

To collect the card and obtain its token, see Set up a new card.

Provision during a payment

Set payment_method_options.card.network_token.provision.enabled to true on a charge, a hold, or a payment, setup, or checkout session (amount is in minor units, so 2000 is $20.00 USD). If provisioning fails, the payment proceeds without a token unless you set decline_on_failure to true.

curl -X POST https://api.sandbox.pay.com/v1/charges \
  -u ':sk-pay-com-sandbox-…' \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2000,
    "currency": "usd",
    "source": "pm_card_296645958265997316",
    "payment_method_options": {
      "card": {
        "network_token": {
          "provision": {
            "enabled": true,
            "decline_on_failure": false
          }
        }
      }
    }
  }'

Set your account's default

Account defaults apply to every payment that doesn't specify its own options. Because PATCH /v1/merchants/current/payment_method_options replaces all defaults, fetch your current settings with GET /v1/merchants/current/payment_method_options, update card.network_token, and send the full object back.

curl -X PATCH https://api.sandbox.pay.com/v1/merchants/current/payment_method_options \
  -u ':sk-pay-com-sandbox-…' \
  -H "Content-Type: application/json" \
  -d '{
    "types": ["card", "applepay", "googlepay"],
    "card": {
      "network_token": {
        "provision": {
          "enabled": true
        },
        "authorization": {
          "enabled": true,
          "full_pan_fallback": true
        }
      }
    }
  }'

This example includes only the network token fields. Include the rest of your existing options when sending PATCH, or Pay.com clears them.

Listen for provisioning webhooks

Pay.com sends payment_method.network_token.provisioned when the card network issues a network token and payment_method.network_token.deleted if the token is deleted later. Verify the Pay-Signature header before acting on webhook events. See Verify webhook signatures.

To read a saved card's token, see Retrieve a network token.

Next steps

Was this page helpful?