Skip to Content
Docs

Stored token with CVV and 3DS

Charge a stored card token with re-collected CVV and 3D Secure authentication through the API.

When you save a card (through a tokenization session or from a previous transaction), Pay.com returns a tok_card_… token so you can charge the card without collecting the full card number, expiration date, or cardholder name again.

Use this server-to-server flow when charging a stored token requires either:

  • CVV re-collection: A card token keeps the CVV for 15 minutes at most, and a saved payment method doesn't keep it. Some issuers or risk rules require the customer to re-enter their CVV on subsequent payments.
  • 3D Secure authentication: Regulations such as PSD2 Strong Customer Authentication (SCA) can require 3DS even on a card on file.

Requirements

Before you start, make sure you have:

Authenticate and charge a stored token

Follow these steps to create a charge or hold with CVV and 3DS authentication.

  1. 1

    Create a charge or hold with authentication context

    Send a POST request to /v1/charges or /v1/holds with the following data:

    • Stored token with CVV: Provide the token ID and CVV under source_data.token. The CVV is re-collected for this transaction to satisfy card network requirements.
    • Authentication context: The browser metadata 3D Secure needs, under source_data.token.authentication_context. Every browser_details field is required, and the customer's IP address (customer_ip_address) is optional.
    • Billing details: The customer email isn't required, but it raises 3DS approval rates. We also recommend full billing details (address and phone).
    • 3DS flow: To require a challenge, set payment_method_options.authentication_options.type to three_ds and three_ds.flow_indicator.type to challenge, as in the request below. Set flow_indicator.type to frictionless instead to ask the issuer to skip the challenge. The issuer makes the final decision.

    To charge a saved payment method (pm_card_…) instead of a card token, set source_data.type to source, and send the payment method's ID and the authentication context in source_data.source. A saved payment method takes no CVV.

    source_data for a saved payment method

    {
      "type": "source",
      "source": {
        "id": "pm_card_296645958265997316",
        "authentication_context": {
          "browser_details": { ... },
          "customer_ip_address": "203.0.113.45"
        }
      }
    }
    {
      "currency": "eur",
      "amount": 10000,
      "customer_reference_id": "cust-returning-001",
      "source_data": {
        "token": {
          "id": "tok_card_685104577720095744",
          "cvv": "123",
          "authentication_context": {
            "browser_details": {
              "java_enabled": true,
              "javascript_enabled": true,
              "user_agent": "Mozilla/5.0 (Linux; Android 11; SM-A528B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",
              "accept_header": "*/*",
              "language": "en-GB",
              "color_depth": 32,
              "screen_height": 926,
              "screen_width": 428,
              "timezone_offset": "0"
            },
            "customer_ip_address": "203.0.113.45"
          }
        },
        "billing_details": {
          "email": "customer@example.com",
          "address": {
            "line1": "123 Main Street",
            "city": "London",
            "postal_code": "EC1A 1BB",
            "country": "GB"
          },
          "phone": "+447911123456"
        },
        "type": "token"
      },
      "payment_method_options": {
        "authentication_options": {
          "type": "three_ds",
          "three_ds": {
            "flow_indicator": {
              "type": "challenge",
              "challenge": {
                "type": "mandated"
              }
            }
          }
        }
      }
    }

    The API returns one of these outcomes:

    OutcomeDescriptionNext step
    requires_authenticationThe transaction needs a 3DS challenge before it can be approved.Continue to the next step.
    succeededThe bank authenticated the cardholder without a challenge (frictionless flow), and the charge completed.No further action required.
    requires_captureThe frictionless flow completed for a hold, and the funds are reserved.Capture when ready.
    Payment method errorThe card was declined or the request data was invalid.Review the error response and retry.
  2. 2

    Create a linked authentication session

    When the transaction status is requires_authentication, create a linked authentication session to generate the URL where the customer completes the bank challenge.

    Send a POST request to /v1/sessions/authentication/linked with:

    • resource: The charge or hold ID from the previous step.
    • return_url: The URL to redirect the customer to after the challenge.
    • confirm: Controls whether Pay.com automatically confirms the transaction after authentication.

    The response includes a url field. Redirect the customer to this URL to complete the bank challenge.

    The two confirm modes differ in when Pay.com authorizes the transaction:

    ModeBehaviorBest for
    confirm: truePay.com authorizes the transaction immediately after authentication, then redirects to your return_url. Results are delivered via webhooks.Webhook-driven fulfillment flows.
    confirm: falsePay.com redirects to your return_url immediately after authentication without authorizing. Your server must call POST /v1/charges/{charge_id}/confirm or POST /v1/holds/{hold_id}/confirm to finalize.Flows that need server-side checks (such as fraud scoring or inventory verification) between authentication and authorization.

    With confirm: true, a client-side network failure could prevent the customer from reaching your return_url even though the transaction was authorized. Always use webhooks as the definitive trigger for order fulfillment. Don't rely only on the redirect.

  3. 3

    Redirect the customer

    Redirect the customer to the url returned from the linked authentication session. The customer completes the 3DS challenge on the bank's page and is then redirected back to your return_url.

  4. 4

    Confirm the transaction

    How you finalize the transaction depends on the confirm mode you chose.

    Pay.com authorizes the transaction automatically after the customer completes authentication. Listen for webhooks to trigger your fulfillment logic.

    EventDescription
    charge.succeededThe charge completed successfully. Fulfill the order.
    charge.failedThe charge was declined after the challenge.
    hold.requires_captureThe hold was authorized. Capture when ready.
    hold.failedThe hold was declined after the challenge.

    Always verify webhook signatures with the Pay-Signature header and your endpoint's signing secret (HMAC SHA-256) to make sure each event came from Pay.com.

Next steps

Related payment guides:

  • Webhooks: Set up listeners for payment events and automate your fulfillment logic.
  • 3D Secure: How 3DS authentication works on Pay.com and protects against fraud.
  • Create a charge with 3DS: The full 3D Secure flow with raw card details.
Was this page helpful?