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:
- Your API credentials and environment base URL.
- A unique
idempotency-keyheader for eachPOSTrequest.
Authenticate and charge a stored token
Follow these steps to create a charge or hold with CVV and 3DS authentication.
- 1
Create a charge or hold with authentication context
Send a
POSTrequest to/v1/chargesor/v1/holdswith 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. Everybrowser_detailsfield is required, and the customer's IP address (customer_ip_address) is optional. - Billing details: The customer
emailisn'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.typetothree_dsandthree_ds.flow_indicator.typetochallenge, as in the request below. Setflow_indicator.typetofrictionlessinstead 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, setsource_data.typetosource, and send the payment method's ID and the authentication context insource_data.source. A saved payment method takes no CVV.{ "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" } } } } } }{ "id": "chrg_291650715036681216", "resource": "charge", "amount": 10000, "amount_human_readable": "100.00", "currency": "eur", "status": "requires_authentication", "customer_reference_id": "cust-returning-001", "payment_method": "pm_card_291650715036681217", "payment_method_details": { "card": { "brand": "visa", "last4": "4242", "exp_month": "12", "exp_year": "2028", "three_d_secure": null, "token": "tok_card_685104577720095744" }, "type": "card" }, "test_mode": true }The API returns one of these outcomes:
Outcome Description Next 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 error The card was declined or the request data was invalid. Review the error response and retry. - Stored token with CVV: Provide the token ID and CVV under
- 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
POSTrequest to/v1/sessions/authentication/linkedwith: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.
{ "resource": "chrg_291650715036681216", "return_url": "https://your-site.com/payment/complete", "confirm": true }{ "resource": "chrg_291650715036681216", "return_url": "https://your-site.com/payment/complete", "confirm": false }The response includes a
urlfield. Redirect the customer to this URL to complete the bank challenge.The two
confirmmodes differ in when Pay.com authorizes the transaction:Mode Behavior Best 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_urlimmediately after authentication without authorizing. Your server must callPOST /v1/charges/{charge_id}/confirmorPOST /v1/holds/{hold_id}/confirmto finalize.Flows that need server-side checks (such as fraud scoring or inventory verification) between authentication and authorization. - 3
Redirect the customer
Redirect the customer to the
urlreturned from the linked authentication session. The customer completes the 3DS challenge on the bank's page and is then redirected back to yourreturn_url. - 4
Confirm the transaction
How you finalize the transaction depends on the
confirmmode you chose.Pay.com authorizes the transaction automatically after the customer completes authentication. Listen for webhooks to trigger your fulfillment logic.
Event Description 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.
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.