# Pay.com developer docs: full text > Every page of the Pay.com developer docs. Any page as Markdown: append .md to its URL. > API reference entries here give each endpoint's first level of parameters and its responses. For the full request > and response schema with examples, fetch its page as Markdown, for example > /api-reference/endpoints/charges/create-charge.md. ## Instructions for AI agents integrating Pay.com - Base URLs: sandbox (testing, no real money) https://api.sandbox.pay.com/v1, live https://api.pay.com/v1. A sandbox key works only in the sandbox, a live key only on live. - Authenticate every API request with HTTP Basic auth: the API key is the password and the username is empty (`curl -u ":$PAY_COM_API_KEY"`). Only a live key that serves several workspaces puts the workspace's merchant id in the username. Keys start with `sk-pay-com-sandbox-` or `sk-pay-com-live-`. Never put an API key in browser or mobile code. - Send an `idempotency-key` header on every POST and DELETE, and the same key when you retry. - Amounts are integers in the currency's minor unit (1000 = 10.00 USD). Currencies are lowercase ISO 4217 codes ("usd", "eur"). - IDs are prefixed: charges chrg_, holds hld_, refunds rfnd_, payouts po_, payment sessions ps_, setup sessions ss_, payment methods pm__. - For a web checkout: create a payment session on your server (POST /v1/sessions/payment), pass its client_secret to the browser, then `Pay.com({ identifier: })` and `pay.checkout({ clientSecret, onSuccess, onFailure })`. The SDK loads from https://js.pay.com/v1 in the sandbox and live (it works in the environment of the session it's given), or with the npm loader @pay-com/js (`live: true` for live). `identifier` is the merchant ID, never a session ID. - Confirm outcomes on your server: verify the `Pay-Signature` header of webhooks before trusting them, or retrieve the object with the API. Don't trust a redirect or a client callback alone. - Most lists are cursor-paginated (`limit`, `starting_after`, `ending_before`, `has_more`); each endpoint page says which style it uses. - Every page is available as Markdown: append .md to its URL. Endpoint pages include the full request and response schema. # Bring your own processor (/commerce/bring-your-own-processor) Keep your existing processor and run Commerce's checkout, subscriptions, entitlements, tax, invoices, and reporting on top of it. You don't need to move your payment processing to adopt Commerce. ## How it works [#how-it-works] Commerce sends the payment to your processor through Pay.com's orchestration service. Your customers see the same checkout, and your reports show these sales alongside the ones Pay.com processes. * **You're the seller.** Pay.com sells as the merchant of record only on accounts it controls, so a sale on your own processor always has you as the seller. * **Certified first.** Each processor and payment method is certified with Pay.com before it runs live. * **Fails closed.** If a credential your processor needs is missing, the payment fails rather than going another way. ## Subscriptions on your processor [#subscriptions-on-your-processor] Subscriptions run on your processor with Pay.com's engine or one you connect. You can move them from one of your processors to another without asking your customers, as long as the same business stays the seller. Pay.com sends `subscription.moved` when a subscription moves. See [Subscriptions](/commerce/subscriptions). ## See which processor a subscription uses [#see-which-processor-a-subscription-uses] Each subscription records its processor in `processor`. `service` is `orchestration` for your own processor, which `provider` names, and `acquiring` for Pay.com's. `settlement_account` is the account its payments use, and renewals and retries stay on that account. A checkout session returns the same object in `subscription_options.resolved.processor`. ```bash curl https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "customer_reference_id": "cust-jane-doe-001", "seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" }, "processor": { "service": "orchestration", "account_owner": "merchant", "settlement_account": "sa_473768761812321280" }, "engine": { "type": "pay_com", "connection": null, "collection_model": "native" }, "current_period_end": "2026-12-25T10:30:00.000Z" } ``` See [Retrieve a subscription](/api-reference/commerce/subscriptions/get-subscription) in the Commerce API reference for every field. ## Next steps [#next-steps] * [Choose who sells](/commerce/choose-who-sells): when to sell as yourself and when to let Pay.com sell. * [Checkout](/commerce/checkout): the forms of the checkout your customers see. # Checkout (/commerce/checkout) One checkout covers taking a payment, starting a subscription, and saving a payment method. You create one session, and show it in whichever form fits the page or app the customer is on. Card details are typed into Pay.com's card fields, so they never touch your pages or your servers. ## One session, every form [#one-session-every-form] Show a session in any of these forms: * **Hosted page**: a page on checkout.pay.com or on your own domain. Send customers to it from your site, an email, a [payment link](/api-reference/commerce/paymentlinks/create-payment-link), or your app. * **Inline**: the checkout inside your own page, from [Pay.com.js](/sdks/pay-com-js). * **Overlay**: the checkout over your page, from Pay.com.js, so the customer never leaves it. * **Native drop-ins**: the iOS, Android, and React Native drop-ins, on the same session. Each form takes the same session and follows the same [design profile](/commerce/customize-the-checkout). The checkout renders on one page or as a multi-step flow, controlled by the session's [`flow`](/commerce/customize-the-checkout#one-page-or-steps) parameter. ## Create a checkout session [#create-a-checkout-session] Create the session on your server with [`POST /v1/checkout`](/api-reference/commerce/checkout/create-checkout). Set `mode` to `payment`, `subscription`, or `setup`, and send what the customer buys in `line_items`, from your catalog or inline. Amounts are in the smallest currency unit, so `2000` is $20.00 USD. Then send the customer to the session's `url`, or show the same session inline or as an overlay. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [ { "price_data": { "currency": "usd", "unit_amount": 2000, "product_data": { "reference": "design-templates", "name": "Design templates" } }, "quantity": 2 } ], "metadata": { "cart_id": "cart-58213" } }' ``` ```json { "id": "cs_691204557318275072", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/9VbQ2xK7wPz4", "amount": 4000, "currency": "usd", "customer_reference_id": "cust-jane-doe-001", "line_items": [ { "product": "prod_691180251832786944", "price": "prc_691180255557328896", "price_version": 1, "name": "Design templates", "quantity": 2, "unit_amount": 2000, "amount_subtotal": 4000, "amount_total": 4000 } ], "seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" }, "order": null, "expires_at": "2026-11-26T10:30:00.000Z" } ``` See [Create a checkout session](/api-reference/commerce/checkout/create-checkout) in the Commerce API reference for every field, and [Products and prices](/commerce/products-and-prices) for sending your catalog inline. ## What customers see [#what-customers-see] At checkout, customers see: * The seller and the merchant, named. * Wallets first, then the other payment methods in an accordion. * Prices in their own currency, and the tax for their country. See [Currencies and tax at checkout](/commerce/currencies-and-tax-at-checkout). * English or one of the most-used languages, in a layout ready for right-to-left languages. * Guest checkout, or their Pay.com account if they have one. See [Guests and Pay.com accounts](/commerce/guests-and-pay-com-accounts). ## Your own domain [#your-own-domain] The hosted checkout can run on a domain of yours. Each domain needs its own Apple Pay verification, and a return domain that's different from the checkout's domain. Pay.com checks both automatically when you add a domain or register an app. [`GET /v1/payment_method_domains`](/api-reference/endpoints/paymentmethoddomains/get-payment-method-domains) lists the domains registered for Apple Pay on the web. ## From your app [#from-your-app] Native apps and games can also link out to the hosted checkout in the browser, and bring the customer back with a **Return to app** button. See [Sell from your app](/commerce/sell-from-your-app). ## Fulfill from the webhook [#fulfill-from-the-webhook] The payment webhook is the proof of payment. Fulfill the order or start the subscription's access when it arrives, not when the customer comes back to your page or app. A customer can close the window before returning. Listen for these events: * `checkout_session.completed`: the customer paid, or saved a payment method in `setup` mode. * `order.paid`: the session's order, with its items. Fulfill one-time purchases from it. * `subscription.access.updated`: a subscription's `access.status` changed. Grant access when it's `granted`. * `checkout_session.failed`: the session failed. Verify the `Pay-Signature` header on every event before you act on it. See [Webhooks](/developer-resources/webhooks). # Choose a subscription engine (/commerce/choose-a-subscription-engine) Keep the subscription engine you already run, or use Pay.com's, without changing how your checkout, entitlements, or reports work. You can even run both, and pick the engine for each price or each session. ## One option, resolved in order [#one-option-resolved-in-order] Pass one `subscription_options` object on the Commerce routes that start a subscription: checkout sessions in `subscription` mode, payment links, and subscriptions. Payment sessions, setup sessions, charges, and holds don't take it. Pay.com resolves the engine in this order: 1. The session, when it sets one. 2. Otherwise the price. 3. Otherwise your account. When none of them sets one, Pay.com's engine runs the subscription. Set your account's default with [`PATCH /v1/subscription_settings`](/api-reference/commerce/subscriptionsettings/update-subscription-settings), and a price's default in the price's `subscription_options`. The engine is locked when the customer confirms. This session picks Stripe Billing for a price you've mapped to a Stripe Billing price in the Commerce tab. The response shows the result in `subscription_options.resolved`, with `resolved_from` naming where the engine came from. Amounts are in the smallest currency unit, so `9900` is $99.00 USD. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "subscription", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180278147072000", "quantity": 1 }], "subscription_options": { "engine": "stripe", "reference": "cust-jane-doe-001-annual", "external": { "customer": "cus_R4tLm8NqVx2pKd" } } }' ``` ```json { "id": "cs_691224127905239040", "resource": "checkout_session", "mode": "subscription", "status": "open", "url": "https://checkout.pay.com/a/Yb3nQ7kTm5Rc", "subscription_options": { "engine": "stripe", "reference": "cust-jane-doe-001-annual", "resolved": { "engine": "stripe", "connection": "subconn_691177409318932480", "collection_model": "directed", "resolved_from": "session", "seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" }, "responsibilities": { "scheduler": "engine", "collector": "pay_com", "dunning": "engine", "invoice_issuer": "engine", "tax": "engine" }, "due_now": { "amount": 9900, "currency": "usd" }, "then": { "amount": 9900, "currency": "usd", "interval": "year", "interval_count": 1 } } } } ``` See [Subscription options](/commerce/commerce-api#subscription-options) for the routes that take the object, and [Create a subscription](/api-reference/commerce/subscriptions/create-subscription) in the Commerce API reference for every field. ## One owner for each job [#one-owner-for-each-job] Each supported way of working with an engine has exactly one owner for each job, so it's always clear which system charged a customer. The subscription's `engine.collection_model` names the way, and `responsibilities` names the owners: | How it works | `collection_model` | Schedules renewals | Collects payments | Retries failures | Issues the invoice | Calculates tax | | ----------------------------------------------------------- | -------------------- | ------------------ | -------------------------------------- | ---------------- | ----------------------------- | -------------------------------------------------------- | | **Pay.com's engine** | `native` | Pay.com | Pay.com | Pay.com | Pay.com, in the seller's name | Pay.com's tax calculation, or your figures when you sell | | **Stripe Billing, with Pay.com collecting** | `directed` | Stripe Billing | Pay.com, each time Stripe Billing asks | Stripe Billing | Stripe Billing | Stripe Billing | | **An engine with its own collection off** | `handoff` | The engine | Pay.com | Pay.com | The engine | The engine | | **An engine that charges through a Pay.com connector** | `engine_gateway` | The engine | The engine | The engine | The engine | The engine | | **Your own system or shop plugin** | `merchant_scheduled` | You | You, through the API | You | You | You | | **Mirrored (app stores or an engine on its own processor)** | `mirror` | Outside Pay.com | Outside Pay.com | Outside Pay.com | Outside Pay.com | Outside Pay.com | A subscription never has two collectors. An engine's own automatic collection can't run alongside Pay.com's, and Pay.com never retries a charge another system retries. When you charge from your own system, Pay.com never retries. With your own system, set `engine` to `external`. Collect each payment with [`POST /v1/subscriptions/{subscription_id}/payments`](/api-reference/commerce/subscriptions/collect-subscription-payment), with your invoice's ID in `external_invoice`, so the payment is tied to its subscription. Charges and holds don't take a subscription. An engine that collects payments on its own hosted pages is mirrored. It only sends Pay.com its events, which keep entitlements and reports up to date. ## External engines [#external-engines] External engines, such as Stripe Billing, connect through an adapter. You connect an engine's account in the Commerce tab, and the API reads it as a [subscription connection](/api-reference/commerce/subscriptionconnections/get-subscription-connection), with its `collection_model`, its `status`, and the result of its collection safety check. Pay.com sends `subscription_connection.action_required` when a connection needs your attention. When Pay.com and an engine disagree about a subscription, Pay.com sends `subscription.engine_sync.failed`, then `subscription.engine_sync.restored` once they agree again. The engine's own status stays in `engine.external.status`. A subscription mirrored from an external engine counts once in your reports, never twice. See [Insights and metrics](/commerce/insights-and-metrics). ## When Pay.com sells [#when-paycom-sells] When Pay.com sells as the merchant of record, Pay.com's engine runs the subscription. An external engine runs one only where Pay.com still collects the payment, calculates the tax, and issues the only invoice. A request that names an external engine for a sale that can resolve to Pay.com as the seller returns `422` with `seller_engine_conflict`. Seller and engine refusals like this one come when the subscription is created, never at a renewal. ## Entitlements stay the same [#entitlements-stay-the-same] Whichever engine runs a subscription, you check what the customer can use through [entitlements](/commerce/entitlements) in the same way. # Choose who sells (/commerce/choose-who-sells) You decide sale by sale whether you sell directly or Pay.com sells as the merchant of record. Sell as yourself where you already have tax registrations and support in place, and let Pay.com sell where you'd rather not take those on. Both run through the same checkout, catalog, subscriptions, and reporting. ## Compare the two [#compare-the-two] Who sells changes who's named at checkout, who handles tax, support, and disputes, and how you're paid: | | You sell | Pay.com sells, as the merchant of record | | ---------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | **Seller named at checkout** | You | Pay.com, with your business named as the merchant | | **Card statement** | Your name, and your website on your subscriptions | PAY.COM\* and your name | | **Tax** | Your figures, or Pay.com's calculation on your tax setup | Pay.com calculates, collects, and files | | **Customer support** | You | Pay.com (first-line support) | | **Refunds** | You | You from the order, or Pay.com's support. Pay.com processes them. | | **Chargebacks and disputes** | You | Pay.com | | **Emails to customers** | In your name | In Pay.com's name | | **Processor** | Pay.com, or your own | Pay.com | | **Subscription engine** | Pay.com's, or one you connect | Pay.com's | | **Money** | [Settlements](/commerce/settlements) as in Payments, or from your own processor | Net settlements every week, with a reserve | | **What you can sell** | What Pay.com's risk policy allows | Digital goods, software, SaaS, and app subscriptions | ## The seller stays with the sale [#the-seller-stays-with-the-sale] The seller is fixed when the customer pays. A subscription keeps the same seller on every renewal, so a customer's receipts, tax, and support stay with whoever they bought from. Pay.com sells only on accounts it controls. A sale on your own processor always has you as the seller. ## When Pay.com is the only seller [#when-paycom-is-the-only-seller] If you only want Pay.com to sell for you, you get a normal workspace with the Commerce tab. Your sales run on accounts Pay.com controls and links to your workspace, which you don't see or manage, and the Payments tab stays hidden until you process payments as yourself. ## Set the seller in the API [#set-the-seller-in-the-api] Pay.com resolves each sale's seller from your account's default, then your seller rules, such as the customer's country and the product. To choose the seller for one checkout session, send `seller_of_record` with `type` set to `merchant` or `pay_com`, among the sellers your account is approved for. The session returns the resolved seller and its legal entity in `entity`, and the order and any subscription it starts keep them. Amounts are in the smallest currency unit, so `2000` is $20.00 USD. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180255557328896", "quantity": 1 }], "seller_of_record": { "type": "pay_com" } }' ``` ```json { "id": "cs_691211938406862848", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/Lr7nD3sWq8Ke", "amount": 2000, "currency": "usd", "customer_reference_id": "cust-jane-doe-001", "seller_of_record": { "type": "pay_com", "entity": "ent_685022401904148480" } } ``` The seller is locked when the customer confirms. See [Create a checkout session](/api-reference/commerce/checkout/create-checkout) in the Commerce API reference for every field. ## Next steps [#next-steps] * [Merchant of record](/commerce/merchant-of-record): what Pay.com does as the seller, and what it sells. * [Bring your own processor](/commerce/bring-your-own-processor): sell as yourself on the processor you already use. * [Tax](/commerce/tax): whose figures are charged in each case. # The Commerce API (/commerce/commerce-api) The Commerce API runs checkout sessions and their design profiles, payment links, your catalog, orders, invoices, credit notes, Insights, and subscriptions. It's a separate API on the same hosts as the Pay.com API, and it takes the same [API keys](/get-started/api-keys), so your workspace's keys call both and there's no Commerce account to create. Every route is in the [Commerce API reference](/api-reference/commerce/checkout/create-checkout). ## How the two APIs split the work [#how-the-two-apis-split-the-work] Each resource belongs to either Commerce or the Pay.com API, never both. Commerce doesn't add routes or request fields to Pay.com API resources, so every route has one owner and every object has one shape. Both APIs share everything else: * **Base URLs**: `https://api.sandbox.pay.com/v1` in the sandbox and `https://api.pay.com/v1` live. * **Authentication**: HTTP Basic, with your secret key as the password and an empty username. See [Authentication](/developer-resources/authentication). * **Idempotency**: an `idempotency-key` header makes a `POST` safe to retry. See [Idempotency and retries](/developer-resources/idempotency-and-retries). * **Lists**: the same `limit`, cursor, and `created` filters, sorted by creation time, oldest first. See [Pagination and filtering](/developer-resources/pagination-and-filtering). * **Errors**: the same error envelope, with `error.type`, `error.code`, and `error.message`. The Commerce API's `error.type` can also be `authentication_error`, `permission_error`, `not_found_error`, or `rate_limit_error`, so read the HTTP status first, as [Handle errors](/developer-resources/handle-errors) describes. * **Webhooks**: Commerce's events reach your existing [webhook endpoints](/developer-resources/webhooks), in the same envelope and with the same signature. Amounts are integers in the smallest currency unit, for example `1999` for $19.99 USD. IDs start with a prefix that names the object, such as `ord_691204561890402304`, and timestamps are ISO 8601, in UTC. Objects created with a sandbox key have `test_mode` set to `true`. ## What Commerce owns [#what-commerce-owns] Commerce owns these resources and every route under them: | Resource | Routes | Reference | | ------------------------ | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | Checkout sessions | `/v1/checkout`, `/v1/checkout/{checkout_session_id}`, and its actions | [Checkout sessions](/api-reference/commerce/checkout/create-checkout) | | Payment links | `/v1/payment_links`, `/v1/payment_links/{link_id}` | [Payment links](/api-reference/commerce/paymentlinks/create-payment-link) | | Products | `/v1/products`, `/v1/products/{product_id}` | [Products](/api-reference/commerce/products/create-product) | | Prices | `/v1/prices`, `/v1/prices/{price_id}` | [Prices](/api-reference/commerce/prices/create-price) | | Shipping rates | `/v1/shipping_rates`, `/v1/shipping_rates/{shipping_rate_id}` | [Shipping rates](/api-reference/commerce/shippingrates/create-shipping-rate) | | Orders | `/v1/orders`, `/v1/orders/{order_id}`, its refund, and its refunds | [Orders](/api-reference/commerce/orders/get-order) | | Invoices | `/v1/invoices`, `/v1/invoices/{invoice_id}`, and its actions | [Invoices](/api-reference/commerce/invoices/get-invoice) | | Credit notes | `/v1/credit_notes`, `/v1/credit_notes/{credit_note_id}` | [Credit notes](/api-reference/commerce/creditnotes/get-credit-note) | | Commerce settings | `/v1/commerce_settings` | [Commerce settings](/api-reference/commerce/commercesettings/get-commerce-settings) | | Design profiles | `/v1/design_profiles`, `/v1/design_profiles/{design_profile_id}` and its actions, and `/v1/design_profile_previews` | [Design profiles](/api-reference/commerce/designprofiles/create-design-profile) | | Insights | `/v1/insights` | [Insights](/api-reference/commerce/insights/get-insights) | | Subscriptions | `/v1/subscriptions` and every route under it | [Subscriptions](/api-reference/commerce/subscriptions/create-subscription) | | Subscription settings | `/v1/subscription_settings` | [Subscription settings](/api-reference/commerce/subscriptionsettings/get-subscription-settings) | | Subscription connections | `/v1/subscription_connections` and its actions | [Subscription connections](/api-reference/commerce/subscriptionconnections/get-subscription-connection) | | Portal sessions | `/v1/portal_sessions` | [Customer portal sessions](/api-reference/commerce/portalsessions/create-portal-session) | | Entitlements | `/v1/entitlements` | [Entitlements](/api-reference/commerce/entitlements/list-entitlements) | | Customer claims | `/v1/customer_claims` | [Customer claims](/api-reference/commerce/customerclaims/create-customer-claim) | | Report runs | `/v1/report_runs`, `/v1/report_runs/{report_run_id}` | [Report runs](/api-reference/commerce/reportruns/create-report-run) | Prices replace subscription packages. A recurring price has a `schedule`, and a subscription bills prices the same way a checkout session's line items do. Your [subscription settings](/api-reference/commerce/subscriptionsettings/update-subscription-settings) hold the failed-renewal and dispute rules that subscription packages previously held. An API key's [permissions](/developer-resources/authentication/scoped-api-keys#commerce-resources) set which of these resources it can call, in the Checkout, Catalog, Orders, Subscriptions, and Financial reporting groups. ## What the Pay.com API keeps [#what-the-paycom-api-keeps] The Pay.com API continues to own refunds, customers, payment sessions, setup sessions, tokenization sessions, charges, holds, tax quotes, settlements, payment method domains, and webhook endpoints. Charges and refunds made for an order include a read-only `order` field linking the payment back to what was sold. It's the only field Commerce adds to them. ## Refunds go through what billed them [#refunds-go-through-what-billed-them] A refund goes through the Commerce object that billed it, so orders, invoices, and credit notes stay in sync: | What was billed | How to refund it | | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | An order | [`POST /v1/orders/{order_id}/refund`](/api-reference/commerce/orders/refund-order). Calling [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) for the order's charge returns `422` with `use_order_refund`. | | A renewal, on an invoice Pay.com issued | [`POST /v1/invoices/{invoice_id}/refund`](/api-reference/commerce/invoices/refund-invoice). Calling [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) for the invoice's charge returns `422` with `use_invoice_refund`. | | A renewal, on an invoice another engine issued | At that engine. When Pay.com collected the charge, the engine asks Pay.com to refund it. | | A payment your system scheduled (`merchant_scheduled`) | [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund), since Commerce has no order or invoice for it. | The order and invoice routes refund what's left by default, or the items or lines you send, with their tax. They return the same refund object (`rfnd_`) as the Pay.com API, so [`GET /v1/refunds/{id}`](/api-reference/endpoints/refunds/get-refund-by-id) returns it as well. When there's an invoice to credit, Pay.com issues a credit note. This works regardless of who sells. When Pay.com is the seller, Pay.com processes the refund on its own accounts. See [Orders and refunds](/commerce/orders-and-refunds). ## Subscription options [#subscription-options] `subscription_options` specifies which engine runs a subscription and what it starts with. Only Commerce routes accept it: * [`POST /v1/checkout`](/api-reference/commerce/checkout/create-checkout), in `subscription` mode, with the items in `line_items`. * [`POST /v1/payment_links`](/api-reference/commerce/paymentlinks/create-payment-link) and [`PUT /v1/payment_links/{link_id}`](/api-reference/commerce/paymentlinks/update-payment-link). The seller and engine resolve when the link is opened, and lock when the customer confirms. * [`POST /v1/subscriptions`](/api-reference/commerce/subscriptions/create-subscription), with the items in `items`. Payment sessions, setup sessions, charges, and holds don't take `subscription_options`. For an `external` (`merchant_scheduled`) subscription billed by your system, collect each payment with [`POST /v1/subscriptions/{subscription_id}/payments`](/api-reference/commerce/subscriptions/collect-subscription-payment). A price's own `subscription_options` sets the default engine, connection, failed-payment rules, and dispute rules for subscriptions on that price, overriding your account's subscription settings. Pay.com takes the engine from the session or request, then the price, then your account default, then `pay_com`. When Pay.com sells, the engine is `pay_com`. The engine is locked when the customer confirms, and the response shows how it resolved, with the seller and processor, in `subscription_options.resolved`. See [Choose a subscription engine](/commerce/choose-a-subscription-engine). ## Webhook events [#webhook-events] [Commerce events](/api-reference/commerce/events) lists every event Commerce sends, grouped by the object it carries. The checkout session and subscription events Pay.com sends today keep their names under Commerce, except `subscription.payment_method.upcoming_expiry`, which Commerce doesn't send. Each one carries the Commerce object in `data`, so check the fields your listeners read. For example, a canceled subscription's `cancellation_reason` is `requested`, `ended`, `withdrawn`, `payment_failed`, or `dispute`, and a subscription has `trial_end` and `canceled_at`, not `trial_period_end` and `ended_at`. Pay.com sends `subscription.upcoming_renewal` when a renewal is 7 days away. Commerce also adds events, such as `checkout_session.expired`, `subscription.created`, and `subscription.paused`. ## Earlier reference pages [#earlier-reference-pages] The Pay.com API reference's checkout, payment links, and subscriptions pages now redirect to their Commerce pages, and the subscription package pages to prices. ## Next steps [#next-steps] * [Checkout](/commerce/checkout): create a session and fulfill from its webhook. * [Orders and refunds](/commerce/orders-and-refunds): follow a sale from payment to refund. * [Choose a subscription engine](/commerce/choose-a-subscription-engine): set the engine per session, price, or account. * [Commerce API reference](/api-reference/commerce/checkout/create-checkout): every route, with its fields and errors. # Create a subscription (/commerce/create-a-subscription) Create a subscription from your server when you already have the customer's saved payment method. The subscription bills a recurring price from your catalog, on the price's schedule. To collect the payment method and start the subscription in one step, use [checkout](/commerce/checkout) with `mode` set to `subscription` instead. This guide runs the subscription on Pay.com's engine. To run subscriptions on another engine, see [Choose a subscription engine](/commerce/choose-a-subscription-engine). ## Requirements [#requirements] Before you begin, make sure you have the following set up: * A payment method saved for off-session use (`pm_card_...`), with the customer it belongs to. See [Save a payment method](/payments/set-up-a-card/save-a-payment-method). * A product for what you sell, from [`POST /v1/products`](/api-reference/commerce/products/create-product) or the Commerce tab. See [Products and prices](/commerce/products-and-prices). * Your [API keys](/get-started/api-keys). The examples use the sandbox (`https://api.sandbox.pay.com/v1`) with an `sk-pay-com-sandbox-` key. ## Set up the subscription [#set-up-the-subscription] Create a recurring price for the product, then create a subscription that bills it to the customer's saved payment method. ### Create a recurring price [#create-a-recurring-price] A price is an amount for a product. A recurring price adds a `schedule`, so it defines how much to charge, in which currency, and how often. You create it once and use it for as many customers as you need. Send a `POST` request to [`/v1/prices`](/api-reference/commerce/prices/create-price) with the following parameters: | Parameter | Description | | -------------- | ---------------------------------------------------------------------------------------------------------------------- | | `product` | The product (`prod_...`) the price belongs to. | | `currency` | Three-letter ISO currency code in lowercase (for example, `usd`). | | `unit_amount` | The amount for each period, in the smallest currency unit. For example, `1999` equals $19.99 USD. | | `schedule` | Object with `interval` (`day`, `week`, `month`, or `year`) and `interval_count` (number of intervals between charges). | | `tax_behavior` | Optional. `exclusive` adds tax to `unit_amount`, and `inclusive` includes it. | | `reference` | Optional. Your ID for the price, unique for its product. | ```bash curl https://api.sandbox.pay.com/v1/prices \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "product": "prod_691180236711641088", "currency": "usd", "unit_amount": 1999, "schedule": { "interval": "month", "interval_count": 1 }, "reference": "premium-monthly" }' ``` ```json { "id": "prc_691180240037724160", "resource": "price", "product": "prod_691180236711641088", "reference": "premium-monthly", "type": "recurring", "currency": "usd", "unit_amount": 1999, "schedule": { "interval": "month", "interval_count": 1 }, "tax_behavior": "exclusive", "version": 1, "active": true, "created": "2026-11-25T10:30:00.000Z", "test_mode": true } ``` Store the `id` from the response (`prc_...`). You'll use it when creating subscriptions in the next step. A later change to the amount adds a version of the price, and live subscriptions keep theirs. See [Prices are kept as versions](/commerce/products-and-prices#prices-are-kept-as-versions). ### Create the subscription [#create-the-subscription] A subscription links a customer and their saved payment method to the prices it bills. Once active, Pay.com charges the customer on the prices' schedule. Send a `POST` request to [`/v1/subscriptions`](/api-reference/commerce/subscriptions/create-subscription) with the following parameters: | Parameter | Description | | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `customer_reference_id` | Your internal customer identifier. | | `items` | What the subscription bills, each with `price` (`prc_...`) and `quantity`. | | `payment_method` | Optional. The saved payment method ID (`pm_card_...`). Defaults to the customer's default payment method. | | `subscription_options` | Optional. The engine, a trial, your `reference` for the subscription, and how it starts. See [Subscription options](/commerce/commerce-api#subscription-options). | ```bash curl https://api.sandbox.pay.com/v1/subscriptions \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "customer_reference_id": "cust-jane-doe-001", "items": [{ "price": "prc_691180240037724160", "quantity": 1 }], "payment_method": "pm_card_684790996696828928", "subscription_options": { "reference": "sub-jane-doe-premium-001" } }' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "version": 1, "status": "active", "customer_reference_id": "cust-jane-doe-001", "reference": "sub-jane-doe-premium-001", "items": [ { "id": "subitem_684790996696828930", "price": "prc_691180240037724160", "price_version": 1, "quantity": 1 } ], "currency": "usd", "current_period_start": "2026-11-25T10:30:00.000Z", "current_period_end": "2026-12-25T10:30:00.000Z", "payment_method": "pm_card_684790996696828928", "engine": { "type": "pay_com", "connection": null, "collection_model": "native" }, "created": "2026-11-25T10:30:00.000Z" } ``` The subscription is `active` once its first payment succeeds, or once its trial ends and the first period is paid. If the first payment is declined, the subscription is `failed`, and Pay.com sends `subscription.failed`. When a renewal fails, Pay.com retries it on your [subscription settings](/api-reference/commerce/subscriptionsettings/update-subscription-settings)' `failed_payment` rules, or the price's own. See [Failed renewals](/commerce/how-subscriptions-work#failed-renewals). ## Listen for webhooks [#listen-for-webhooks] Pay.com charges subscriptions in the background on your behalf. Subscribe to these events to keep your system in sync: * `subscription.active`: the subscription started, or recovered after a failed charge. * `subscription.charged`: a renewal charge succeeded. * `subscription.unpaid`: a renewal charge failed, and retries started. * `subscription.canceled`: the subscription ended. `cancellation_reason` indicates why. * `subscription.access.updated`: the customer's access changed. Grant or revoke access from it. See [Commerce events](/api-reference/commerce/events#subscriptions) for all subscription events. Always verify webhook signatures using the `Pay-Signature` header and your endpoint's signing secret before acting on any event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures) for the full verification steps. ## Next steps [#next-steps] * [Manage subscriptions](/commerce/manage-subscriptions): handle renewals, failed charges, payment method updates, and cancellations. * [Trials, plan changes, and canceling](/commerce/trials-plan-changes-and-canceling): add a trial, preview a plan change, and cancel. * [Checkout](/commerce/checkout): start a subscription and collect the payment method in one step. # Currencies and tax at checkout (/commerce/currencies-and-tax-at-checkout) Customers see a price they understand, in their currency and with their country's tax, before they pay. Clear totals mean fewer abandoned checkouts and fewer disputes. ## Local currencies [#local-currencies] Customers pay in their own currency, from the prices you set in it, or from your prices converted and rounded. A currency conversion offer can appear at checkout whether you or Pay.com sells. It's never pre-selected. The customer chooses it. ## Country-based tax [#country-based-tax] The checkout shows the tax for the customer's country before they pay. Whose figures are charged depends on who sells. See [Tax](/commerce/tax). ## Tax IDs and reverse charge [#tax-ids-and-reverse-charge] Business customers can enter their tax ID at checkout, and Pay.com checks it in real time. When Pay.com calculates the tax, it applies reverse charge for a valid ID. When Pay.com sells as the merchant of record, a business customer with a validated tax ID can buy even in a country where Pay.com doesn't sell to consumers. See [Merchant of record](/commerce/merchant-of-record). Enable the tax ID field for a session with `collection.tax_id.enabled`. The order records the customer's ID in `customer_details.tax_ids`, with the verification result in `verification`, and sets `taxability_reason` to `reverse_charge` in `tax.breakdown` when reverse charge applies. Amounts are in the smallest currency unit, so `2000` is €20.00. Unlike integer `amount_*` totals, `amount` and `taxable_amount` inside `tax.breakdown` are numeric strings in minor units. ```bash curl https://api.sandbox.pay.com/v1/orders/ord_691236785913139200 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "ord_691236785913139200", "resource": "order", "status": "paid", "currency": "eur", "amount_subtotal": 2000, "amount_tax": 0, "amount_total": 2000, "customer_details": { "tax_ids": [{ "type": "eu_vat", "value": "DE123456789", "verification": "valid" }] }, "tax": { "source": "pay_com", "breakdown": [ { "amount": "0", "inclusive": false, "taxable_amount": "2000", "tax_rate_details": { "country": "DE", "tax_type": "vat" }, "taxability_reason": "reverse_charge" } ] }, "seller_of_record": { "type": "pay_com", "entity": "ent_685022401904148480" }, "created": "2026-11-25T12:02:44.000Z" } ``` See [Retrieve an order](/api-reference/commerce/orders/get-order) in the Commerce API reference for every field. ## Checkout languages [#checkout-languages] The checkout is in English and the most-used languages, and its layout is ready for right-to-left languages. # Customer portal (/commerce/customer-portal) Customers handle the everyday changes to their subscriptions themselves, so your support team doesn't have to. The portal is a Pay.com page, and it works the same whichever engine runs the subscription. ## What customers can do [#what-customers-can-do] In the portal, customers can: * **Change plans**, with the proration shown before they confirm. * **Cancel**, online, at the end of the period. * **Update payment methods**. * **See their invoices**. * **Ask for a refund**. * **Withdraw**, where the law gives them that right. See [Trials, plan changes, and canceling](/commerce/trials-plan-changes-and-canceling) for how each change works. A cancellation in the portal always takes effect at the end of the period. To cancel on another date, cancel from your server with `cancel_at`. ## Send customers to the portal [#send-customers-to-the-portal] Create a portal session on your server with [`POST /v1/portal_sessions`](/api-reference/commerce/portalsessions/create-portal-session) and the customer's `customer_reference_id`, and send the customer to its `url`. `return_url` sets the portal's back link. To open the portal on one subscription, send `subscription`, and to open it on one action, add `flow` set to `change_plan`, `cancel`, `update_payment_method`, or `withdraw`. The URL is short-lived, so create a session each time the customer opens the portal. ```bash curl https://api.sandbox.pay.com/v1/portal_sessions \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "customer_reference_id": "cust-jane-doe-001", "return_url": "https://app.example.com/account", "subscription": "sub_684790996696828928", "flow": "change_plan" }' ``` ```json { "id": "cps_691260883004694528", "resource": "portal_session", "url": "https://checkout.pay.com/p/Hq3rT8mWc2Ld", "return_url": "https://app.example.com/account", "customer_reference_id": "cust-jane-doe-001", "subscription": "sub_684790996696828928", "flow": "change_plan", "expires_at": "2026-11-25T11:00:00.000Z", "created": "2026-11-25T10:55:00.000Z", "test_mode": true } ``` See [Create a customer portal session](/api-reference/commerce/portalsessions/create-portal-session) in the Commerce API reference. ## When Pay.com sells [#when-paycom-sells] When Pay.com sells as the merchant of record, Pay.com handles first-line customer support and refund requests. You can still refund from the order yourself. See [Orders and refunds](/commerce/orders-and-refunds). # Customize Commerce checkout (/commerce/customize-the-checkout) Make the checkout look like the rest of your product, on every surface, without building it yourself. You change the design in the Commerce tab or with the API, and every form of the checkout follows. ## Design profiles [#design-profiles] A design profile sets how the checkout looks and what it asks for, and applies it on every surface: the hosted page, inline, the overlay, and the native drop-ins. Each profile has an ID that starts with `dprof_`, and you manage profiles in the Commerce tab or with the [design profiles API](/api-reference/commerce/designprofiles/create-design-profile). A profile's values set these parts of the checkout: | Values | What they set | | :--------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `display_name` | The business name customers see. | | `flow` | One page or steps. See [One page or steps](#one-page-or-steps). | | `layout`, `summary_position` | The layout, `two_panes`, `one_column`, or `compact`, and whether the order summary sits on the left, on the right, or at the top. | | `blocks`, `header_image_url` | Whether the shipping section shows when an order has items that ship, and whether a header image shows, from `header_image_url`. | | `colors`, `theme` | The accent, background, and text colors as `#RRGGBB`, and a `light`, `dark`, or `system` theme. Without colors, the checkout has Pay.com's default look in light and dark. | | `font`, `corner_radius` | The font, `system`, `google_sans`, or `serif`, and how round the corners are. | | `express_methods` | Where express methods show. See [Express methods and billing details](/commerce/express-methods-and-billing-details). | | `collection` | The details the checkout asks for, such as the customer's name, phone number, billing address, and tax ID. Pay.com adds any detail a payment method or tax needs. | | `submit_label` | The word on the button before the total: `pay`, `buy`, `book`, or `donate`. | A checkout session or payment link can override the profile's `flow`, `collection`, and `express_methods`. ## Edit, preview, and publish [#edit-preview-and-publish] Each profile has a draft and published versions. Customers see the published version, so nothing you change shows until you publish it. ### Save the draft [#save-the-draft] Create a profile with [`POST /v1/design_profiles`](/api-reference/commerce/designprofiles/create-design-profile), or save a profile's draft with [`PATCH /v1/design_profiles/{design_profile_id}`](/api-reference/commerce/designprofiles/update-design-profile). The `draft` you send replaces the whole draft. A new profile has a draft and nothing published. ### Preview it [#preview-it] Send the values to [`POST /v1/design_profile_previews`](/api-reference/commerce/designprofiles/create-design-profile-preview). It returns a `url` that shows the checkout with those values and sample items, and expires about 10 minutes after it's made. Set `sample` to `physical` to add an item that ships, so the preview shows shipping, and `width` to `phone` to see the phone layout. Nothing is published, no session is created, and nothing on the preview can be paid. ### Publish it [#publish-it] [`POST /v1/design_profiles/{design_profile_id}/publish`](/api-reference/commerce/designprofiles/publish-design-profile) publishes the draft as a new version. Sessions created from then on use it, and open sessions keep the version they started with. A publish with no unpublished changes returns the profile as it is and adds no version. In the Commerce tab, publishing asks you to confirm it's you. A publish returns `422` in these cases: * `display_name_required`: the draft has no `display_name`. * `low_contrast`: white text on `colors.accent`, or `colors.text` on `colors.background`, has less than 4.5:1 contrast. * `custom_css_not_approved`: the draft's changed [custom CSS](#custom-css) isn't approved yet. To drop the unpublished changes, [discard the draft](/api-reference/commerce/designprofiles/discard-design-profile-draft), and the draft equals the published version again. A profile with nothing published has nothing to go back to, so the request returns `422` with `profile_not_published`. ## Versions and rollback [#versions-and-rollback] [`GET /v1/design_profiles/{design_profile_id}/versions`](/api-reference/commerce/designprofiles/list-design-profile-versions) lists every published version, newest first, and pages by version number. Each version has its `values`, `published_at`, and `published_by`, which is the person who published it or `api` for an API key. Its `changes` lists the groups that changed from the version before, as the Commerce tab names them, such as `Colors` and `Flow`. The first version's `changes` is empty. To go back to an earlier version, [roll back](/api-reference/commerce/designprofiles/roll-back-design-profile) with its `version`. Pay.com publishes that version's values again as a new version, and leaves the draft as it was. In the Commerce tab, a rollback asks you to confirm it's you, as publishing does. To start a profile from another, [duplicate](/api-reference/commerce/designprofiles/duplicate-design-profile) it. The copy's draft is the original's published values, or its draft when nothing is published, and nothing is published on the copy. ## Your default profile [#your-default-profile] Sessions and payment links that name no profile use your default profile. Set `is_default` to `true` on a profile to make it your default, and the others stop being default. The profile must be published and not archived, or the request returns `422` with `profile_not_published` or `profile_archived`. [Archive](/api-reference/commerce/designprofiles/archive-design-profile) a profile to stop new sessions from using it. A checkout session or payment link that names it from then on returns `422` with `profile_archived`. Open sessions keep it, and payment links that named it before keep opening sessions with it. Your default profile can't be archived, so the request returns `422` with `default_profile`. ## One page or steps [#one-page-or-steps] The checkout renders on one page or as a multi-step flow. Set a design profile's flow in its `flow`, or in the checkout builder under **Layout** → **Flow**. For one session or payment link, send `flow`: * `one_page`: everything on one page. * `steps`: Details, then Shipping, then Payment, with no review step. Shipping appears only when something ships and there's more than one rate. Details asks for the country when tax needs it, so the total is final before Payment, and billing details sit in Payment. A session or payment link without `flow` takes its design profile's. ## Choose a profile for a session [#choose-a-profile-for-a-session] Every session uses your default design profile unless you pass a different profile ID in `design_profile` when you create the session. The profile must be published and not archived, or the request returns `422` with `profile_not_published` or `profile_archived`. The response returns the profile ID, and the published version the session shows in `design_profile_version`. Amounts are in the smallest currency unit, so `2000` is $20.00 USD. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180255557328896", "quantity": 1 }], "design_profile": "dprof_690011254180941824" }' ``` ```json { "id": "cs_691213706360524800", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/Tz5hM1pVr6Qa", "amount": 2000, "currency": "usd", "design_profile": "dprof_690011254180941824", "design_profile_version": 4 } ``` A payment link takes `design_profile` the same way, and a link whose `design_profile` is `null` uses your default profile. See [Create a checkout session](/api-reference/commerce/checkout/create-checkout) in the Commerce API reference for every field. ## Custom CSS [#custom-css] On hosted pages, you can add your own CSS to a profile's draft, in `custom_css`, up to 20,000 characters: * CSS only, with no scripts. * Remote assets, such as fonts and images, only from allowed hosts. * It can't change the parts that [stay locked](#what-stays-locked). Pay.com reviews and sanitizes custom CSS before it applies. Submit the draft's CSS with [`POST /v1/design_profiles/{design_profile_id}/custom_css_review`](/api-reference/commerce/designprofiles/request-custom-css-review), and follow `custom_css_review.status` on the profile, which moves from `in_review` to `approved` or `not_approved`. A profile whose CSS isn't approved lists why in `custom_css_review.reasons`, and you can publish changed CSS only once it's approved. ## What stays locked [#what-stays-locked] Some parts can't be hidden or restyled, by a profile or by CSS: * The seller line. * The totals. * The consents. * The words on buttons that commit the customer to pay. * The card fields. ## When Pay.com sells [#when-paycom-sells] When Pay.com sells as the merchant of record, it reviews changes to your name and logo, and the checkout always displays "Powered by Pay.com". ## In your app [#in-your-app] The native drop-ins follow your profile too, and they can use fonts your app ships, inside the drop-in only. # Entitlements (/commerce/entitlements) Query one endpoint to check what a customer can use, whether they subscribed on your website, in your app, or through an app store, and whichever engine runs their subscription. You don't need separate access logic for each engine or store. ## What entitlements cover [#what-entitlements-cover] Each entitlement type tracks one dimension of customer access: | Entitlement | Purpose | | ------------------- | -------------------------------------------------------- | | **Access** | Whether the customer can use your product now | | **Features** | Which features their plan includes | | **Seats** | How many seats they have, as seats are added and removed | | **Balances** | What's left of an allowance, such as credits | | **Store purchases** | What they bought through Apple's or Google's stores | You define features and map them to products in the Commerce tab. ## Read a customer's entitlements [#read-a-customers-entitlements] Retrieve a customer's entitlements with [`GET /v1/entitlements`](/api-reference/commerce/entitlements/list-entitlements) and their `customer_reference_id`. Each one has its `type`, the `key` you gave the feature in the Commerce tab, its `status`, and where it came from in `source`. The customer can use an entitlement while its `status` is `granted` or `grace`, and loses it at `revoked`. ```bash curl -G https://api.sandbox.pay.com/v1/entitlements \ -u ':sk-pay-com-sandbox-…' \ -d customer_reference_id=cust-jane-doe-001 ``` ```json { "resource": "entitlements", "data": [ { "id": "entl_691204573645987840", "resource": "entitlement", "type": "access", "key": "pro", "status": "granted", "expires_at": null, "source": { "type": "subscription", "subscription": "sub_684790996696828928", "engine": "pay_com" } }, { "id": "entl_691204574121451520", "resource": "entitlement", "type": "seats", "key": "team-seats", "status": "granted", "quantity": 12, "source": { "type": "subscription", "subscription": "sub_684790996696828928", "engine": "pay_com" } } ], "has_more": false } ``` Pay.com sends `entitlement.updated` when what a customer can use changes, and `subscription.access.updated` when a subscription's access changes. A payment event doesn't mean the customer has access, so grant and revoke access from these events. See [List entitlements](/api-reference/commerce/entitlements/list-entitlements) in the Commerce API reference. ## Whatever the engine [#whatever-the-engine] Entitlements work the same for subscriptions on Pay.com's engine, on an external engine such as Stripe Billing, and for app store purchases. See [Choose a subscription engine](/commerce/choose-a-subscription-engine). ## Fulfill orders from the webhook [#fulfill-orders-from-the-webhook] You fulfill one-time orders and bookings from the payment webhook, `order.paid`. Use entitlements for ongoing access, features, seats, and balances. ## In your reports [#in-your-reports] App store subscriptions reported through entitlements count in your MRR and subscribers, once each, alongside the subscriptions Pay.com and your engines run. See [Insights and metrics](/commerce/insights-and-metrics). # Express methods and billing details (/commerce/express-methods-and-billing-details) Customers find their wallet wherever they look for it, and they're asked only for the details you need. Fewer fields mean faster checkouts, and you keep only the data you asked for. ## Where express methods appear [#where-express-methods-appear] Every method that supports express checkout, such as Apple Pay and Google Pay, appears in two places: * **The express row**, at the top of the checkout, where the wallet fills in the customer's details and pays in one step. * **The method list**, alongside the other payment methods, where it only pays, and the customer fills in the details on the page. You can turn either place off, for a design profile or for a single session. For a session, set `express_methods.express_row.enabled` or `express_methods.method_list.enabled` to `false`. ## Collect only what you need [#collect-only-what-you-need] For each session, choose which billing details the checkout collects, in the session's [`collection`](/api-reference/commerce/checkout/create-checkout) object: | Detail | Options | `collection` field | | ------- | ------------------------------------------- | -------------------------------------------------------------------------- | | Name | Collect or not | `name.enabled` | | Email | Collect or not | `email.enabled` | | Phone | Collect or not | `phone_number.enabled` | | Address | None, country, postal code, or full address | `billing_address.level` set to `none`, `country`, `postal_code`, or `full` | Wallets ask only for the details you chose that the page hasn't collected yet. The same `collection` object also turns on the shipping address and the tax ID. ## When Pay.com needs more [#when-paycom-needs-more] When the seller, the tax, the payment method, or shipping needs more than you chose, Pay.com asks the customer for it too. The session lists each added field in `collection.added`, with `reason` set to `seller`, `tax`, `payment_method`, or `shipping`. A payment method that needs more than the customer can give isn't shown. In this session, Pay.com sells as the merchant of record and adds the email address, which it needs to send the receipt in its name: ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180255557328896", "quantity": 1 }], "collection": { "name": { "enabled": false }, "email": { "enabled": false }, "phone_number": { "enabled": false }, "billing_address": { "level": "postal_code" } }, "express_methods": { "method_list": { "enabled": false } } }' ``` ```json { "id": "cs_691215118460661760", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/Wm2kR9cXb4Nd", "seller_of_record": { "type": "pay_com", "entity": "ent_685022401904148480" }, "collection": { "name": { "enabled": false }, "email": { "enabled": false }, "phone_number": { "enabled": false }, "billing_address": { "level": "postal_code" }, "added": [{ "field": "email", "reason": "seller" }] }, "express_methods": { "express_row": { "enabled": true }, "method_list": { "enabled": false } } } ``` See [Create a checkout session](/api-reference/commerce/checkout/create-checkout) in the Commerce API reference for every field. ## Apple Pay and postal codes [#apple-pay-and-postal-codes] Apple Pay can't ask for a postal code alone. When you collect only the postal code, Pay.com asks Apple Pay for the billing address, keeps the postal code and country, and drops the rest before storing anything. # Find your use case (/commerce/find-your-use-case) Every Commerce sale is controlled by three settings covering who sells, who processes the payment, and which subscription engine runs it. Each use case below configures them differently. They aren't exclusive. One workspace can sell some products as itself and let Pay.com sell others as the merchant of record, because the seller is chosen sale by sale. ## Compare the use cases [#compare-the-use-cases] Each use case sets the three switches like this: | Use case | Who sells | Who processes | Subscription engine | Start with | | ------------------------------------------------------------------------------------------ | -------------------------------------------------------- | ------------------------- | ----------------------------- | ---------------------------------------------------------------------- | | [Sell SaaS as yourself](#sell-saas-as-yourself) | You | Pay.com | Pay.com's, or one you connect | [Checkout](/commerce/checkout) | | [Sell with Pay.com as the merchant of record](#sell-with-paycom-as-the-merchant-of-record) | Pay.com | Pay.com | Pay.com's | [Merchant of record](/commerce/merchant-of-record) | | [Keep your processor](#keep-your-processor) | You | Your processor | Pay.com's, or one you connect | [Bring your own processor](/commerce/bring-your-own-processor) | | [Keep Stripe Billing](#keep-stripe-billing) | You | Pay.com or your processor | Stripe Billing | [Choose a subscription engine](/commerce/choose-a-subscription-engine) | | [Sell from an app](#sell-from-an-app) | You, or Pay.com where the stores, wallets, and law allow | Pay.com | Pay.com's, or one you connect | [Sell from your app](/commerce/sell-from-your-app) | | [Sell from a game](#sell-from-a-game) | You | Pay.com | Pay.com's, or one you connect | [Unity](/commerce/unity) | ## Sell SaaS as yourself [#sell-saas-as-yourself] You keep your name on the sale and your own tax registrations, and get a checkout, subscriptions, entitlements, and reporting without building them. Customers pay on a hosted page, inline, or in an overlay on your site, and manage their plans in the customer portal. Start with [Checkout](/commerce/checkout), then [Subscriptions](/commerce/subscriptions) and the [Customer portal](/commerce/customer-portal). ## Sell with Pay.com as the merchant of record [#sell-with-paycom-as-the-merchant-of-record] Pay.com becomes the seller. It takes on tax registration, calculation, collection, and filing, handles first-line customer support, and manages refunds and chargebacks. You build the product and fulfill the order, and Pay.com pays out net settlements weekly. Start with [Choose who sells](/commerce/choose-who-sells) and [Merchant of record](/commerce/merchant-of-record). ## Keep your processor [#keep-your-processor] When you sell as yourself, you can keep the processor you already use and still run Commerce's checkout, subscriptions, tax, and invoices on it. Start with [Bring your own processor](/commerce/bring-your-own-processor). ## Keep Stripe Billing [#keep-stripe-billing] Your subscriptions stay in Stripe Billing, connected through an adapter. You still get Pay.com's checkout, entitlements, and reporting, and each subscription is counted once in your reports. Pay.com collects each payment Stripe Billing asks for, on Pay.com or your own processor, and Stripe Billing keeps the schedule, the retries, and the invoices. If Stripe already processes those payments, or Stripe Billing collects on its own hosted pages, Stripe Billing keeps collecting and only sends Pay.com its events. Start with [Choose a subscription engine](/commerce/choose-a-subscription-engine) and [Entitlements](/commerce/entitlements). ## Sell from an app [#sell-from-an-app] Link out from your iOS, Android, or React Native app to checkout in the browser, and bring customers back to the app when they've paid. The SDK applies the stores' rules for you, and Pay.com can report link-out sales to Apple and Google if you opt in. In native drop-ins, Pay.com acts as the merchant of record only where app-store policies, wallet rules, and local law permit alternative in-app billing. Otherwise, digital goods sell through link-out to the hosted checkout. Start with [Sell from your app](/commerce/sell-from-your-app) and [Store rules and reporting to the stores](/commerce/store-rules). ## Sell from a game [#sell-from-a-game] Sell from Unity games on mobile, WebGL, and PC, with the same link-out and drop-in as native apps. Your game's server creates the checkout session, and you grant items from the payment webhook. Start with [Unity](/commerce/unity). # Guests and Pay.com accounts (/commerce/guests-and-pay-com-accounts) Nobody has to sign up to pay you. Customers who want a faster checkout next time can use a Pay.com account, which keeps their payment methods across every merchant that uses Pay.com. ## Guest checkout always works [#guest-checkout-always-works] Customers can always pay as guests. When a checkout session has no `customer_reference_id`, Pay.com creates a guest customer for it, so every purchase still has its customer record. A guest's `reference_id` is its `cust_` ID until it's claimed. Customers are shared with Payments, with one record for each [`customer_reference_id`](/api-reference/endpoints/customers/create-customer). Read and update them with the [customers API](/api-reference/endpoints/customers/get-customer-by-reference), which Commerce leaves as it is. Commerce's orders, subscriptions, and entitlements name the customer by its `customer_reference_id`. ## A Pay.com account, if customers want one [#a-paycom-account-if-customers-want-one] Customers can choose a Pay.com account, secured with a passkey. It saves their payment methods, so they can pay with them at any merchant that uses Pay.com. On their account's page, they can see their saved methods, remove one, or delete the account. ## Claiming a guest purchase [#claiming-a-guest-purchase] A purchase made as a guest links to the customer's account with you in one of two ways. Either your server tells Pay.com it belongs to them, or the customer opens a single-use link that Pay.com emails to them. Pay.com never links purchases to an account by matching an email address. Both ways use [`POST /v1/customer_claims`](/api-reference/commerce/customerclaims/create-customer-claim) with your `customer_reference_id` for the customer. From your server, send the guest's `cust_` ID in `guest_customer`. Claim from your server only when your system can prove that the customer's account started the purchase. A session ID from a return URL alone isn't proof. ```bash curl https://api.sandbox.pay.com/v1/customer_claims \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "guest_customer": "cust_691204560741163008", "customer_reference_id": "cust-jane-doe-001" }' ``` ```json { "id": "cclm_691274409227436032", "resource": "customer_claim", "customer": "cust_691204560741163008", "customer_reference_id": "cust-jane-doe-001", "method": "server", "created": "2026-11-25T10:41:09.000Z", "test_mode": true } ``` With the emailed link, the customer opens your claim page with a `token`. After they sign in, your server sends that `token` in place of `guest_customer`, with your `customer_reference_id`. Either way, the guest's subscriptions, orders, and entitlements end up under your reference, nothing about the payments changes, and Pay.com sends `customer_claim.created`. # How subscriptions work (/commerce/how-subscriptions-work) A subscription charges a customer's saved payment method on a schedule. On Pay.com's engine, Pay.com runs the whole billing cycle. It charges on time, retries failed payments, and tracks each change of state. This page covers how Pay.com's engine bills a subscription. For how subscriptions fit into Commerce, with external engines, entitlements, and the customer portal, see [Subscriptions](/commerce/subscriptions). A subscription bills one or more **recurring prices** from your catalog. Each price defines how much to charge and how often, and the **subscription** links a customer and their payment method to the prices it bills. Your **subscription settings** define what happens when a renewal fails or a payment is disputed. Subscriptions need a payment method saved for off-session use. See [Save a payment method](/payments/set-up-a-card/save-a-payment-method) for setup instructions. ## Subscriptions vs. recurring payments [#subscriptions-vs-recurring-payments] Both models use saved payment methods to charge customers without them being present. The difference is in who manages the schedule. | | Recurring payments | Subscriptions | | ------------------ | ----------------------------------------------------------------------------- | --------------------------------------------------------- | | **Charge trigger** | You call [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) | Pay.com charges automatically | | **Schedule** | Your system | Defined on the price | | **Retry logic** | You implement | Your subscription settings, or the price's | | **Webhook events** | `charge.succeeded`, `charge.failed` | `subscription.charged`, `subscription.unpaid`, and others | | **Use when** | You need full control over timing and amount | You want Pay.com to manage the billing lifecycle | ## Recurring prices [#recurring-prices] A recurring price is a reusable billing term. You create it once, for a product, and use it for any number of subscriptions. A change to its amount adds a version of the price, and live subscriptions keep the version they were sold at until you schedule a price change for them. See [Products and prices](/commerce/products-and-prices#prices-are-kept-as-versions). ### Billing schedule and amount [#billing-schedule-and-amount] A price's `schedule` sets how often it bills, with `interval` and `interval_count`. | Billing frequency | `interval` | `interval_count` | | ----------------- | ---------- | ---------------- | | Weekly | `week` | `1` | | Monthly | `month` | `1` | | Quarterly | `month` | `3` | | Annual | `year` | `1` | | Every 14 days | `day` | `14` | Each period, the subscription charges each price's `unit_amount` times the item's `quantity`. Amounts are in the smallest currency unit, so `1999` is $19.99 USD. ### Failed renewals [#failed-renewals] When a renewal fails, the subscription moves to `unpaid` and Pay.com starts retrying. The `failed_payment` rules in your [subscription settings](/api-reference/commerce/subscriptionsettings/update-subscription-settings) control the retries and what follows them: | Field | Description | | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | `retry_after_days` | The days after the failed renewal for each retry, up to 8, for example `[3, 5, 7]`. Pay.com also retries soon after the customer updates their card. | | `final_action` | Action taken after the last retry fails. `cancel` ends the subscription, `pause` suspends billing, and `leave_unpaid` leaves it `unpaid`. | | `grace_days` | The days the customer keeps access while the subscription is unpaid. | These rules retry three times and then cancel the subscription, with a week of access while it's unpaid: ```json { "failed_payment": { "retry_after_days": [3, 5, 7], "final_action": "cancel", "grace_days": 7 } } ``` A price can override the rules for the subscriptions on it, in its own `subscription_options.failed_payment`. Only Pay.com's engine applies them, because Pay.com never retries a charge another system retries. ### Disputes [#disputes] When one of a subscription's payments is disputed, Pay.com applies the `disputes` rule in your subscription settings. Its `action` is `cancel`, `pause`, or `none`. A price can override it in its own `subscription_options.disputes`. ### Trials [#trials] Set `trial` in `subscription_options` when you create the subscription, with `interval` and `interval_count`, for example `{ "interval": "day", "interval_count": 14 }`, or with `end_at`. The subscription starts as `trialing`, with the trial's end in `trial_end`, and nothing is due until the trial ends. See [Trials, plan changes, and canceling](/commerce/trials-plan-changes-and-canceling#trials). ### Subscription term [#subscription-term] To end a subscription on a set date, send `cancel_at` in `subscription_options` when you create it. When that date comes, the subscription moves to `canceled` with `cancellation_reason` set to `ended`. Leave `cancel_at` unset for a subscription that runs until it's canceled. ## Billing lifecycle [#billing-lifecycle] A subscription moves from setup through billing cycles, failure handling, and cancellation: ### Subscription statuses [#subscription-statuses] A subscription moves through these statuses as billing events occur: | Status | Meaning | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `draft` | Not started yet. The subscription waits for its start date, or an external engine is still setting it up. | | `trialing` | In a trial, until `trial_end`. The customer has access, and nothing is due until the trial ends. | | `active` | Billing normally. Pay.com charges on each scheduled date and advances the current period. | | `unpaid` | A renewal failed. Pay.com retries on your `failed_payment` rules, or you can [retry it yourself](/api-reference/commerce/subscriptions/retry-subscription). | | `paused` | Billing is suspended after retries are used up with `final_action` set to `pause`, after a dispute with `disputes.action` set to `pause`, or after a trial ends without a payment method when `trial.missing_payment_method` is `pause`. | | `canceled` | The subscription has ended. No further charges are made. | | `failed` | The first payment was declined. Pay.com sends `subscription.failed`. | ### Subscription events [#subscription-events] Pay.com sends an event each time a subscription changes, such as `subscription.charged` for a paid renewal and `subscription.unpaid` for a failed one. See [Commerce events](/api-reference/commerce/events#subscriptions) for every subscription event. ## Cancellation [#cancellation] A subscription doesn't end the moment you cancel it. You choose when the cancellation takes effect: | Method | Request | When it ends | | ------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | | End of period | [`POST /v1/subscriptions/{subscription_id}/cancel`](/api-reference/commerce/subscriptions/cancel-subscription) with an empty body | At the end of the current billing period | | Specific date | [`POST /v1/subscriptions/{subscription_id}/cancel`](/api-reference/commerce/subscriptions/cancel-subscription) with `cancel_at` | On the date you specify, after the current period ends | `cancel_at` accepts an ISO 8601 datetime string (for example, `2026-12-31T00:00:00Z`). The customer keeps access until the subscription ends. Customers can also cancel in the [customer portal](/commerce/customer-portal), at the end of the period. `canceled_at` is set and `subscription.canceled` fires when the cancellation takes effect, not when you make the cancellation request. Scheduling a future cancellation doesn't fire a webhook until that date is reached. The `cancellation_reason` field records why the subscription ended: | Value | Cause | | ---------------- | ------------------------------------------------------------------------------------------------------------------ | | `requested` | You or the customer canceled it. | | `ended` | It reached its `cancel_at` date. | | `withdrawn` | The customer withdrew from the contract. See [Withdrawal](/commerce/trials-plan-changes-and-canceling#withdrawal). | | `payment_failed` | Retries were used up, with `final_action` set to `cancel`. | | `dispute` | A dispute canceled it, with the `disputes` action set to `cancel`. | ## Refunds and disputes [#refunds-and-disputes] Renewals don't create orders, so you refund a renewal through its invoice. See [Refunds go through what billed them](/commerce/commerce-api#refunds-go-through-what-billed-them). A dispute on a subscription payment also applies your [`disputes` rule](#disputes). ## Next steps [#next-steps] * [Create a subscription](/commerce/create-a-subscription): create a recurring price and attach a customer's saved payment method. * [Manage subscriptions](/commerce/manage-subscriptions): list subscriptions, handle failed charges, update payment methods, and cancel. * [Choose a subscription engine](/commerce/choose-a-subscription-engine): run subscriptions on Pay.com's engine or an external one. # Commerce (/commerce) Pay.com Commerce adds a checkout, a catalog and orders, subscriptions, entitlements, tax, and optional merchant-of-record selling on top of Pay.com's payment rails. It runs on the same API keys and workspace as Payments, so there's no new account, key, or integration style to learn. ## What Commerce includes [#what-commerce-includes] Commerce combines selling, billing, and reporting on the same payment infrastructure as Payments: | Area | Capabilities | Start with | | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Shared platform and rails** | Checkout, subscriptions, entitlements, merchant of record, your own processor, and the app SDKs all work through the Commerce API, which shares the Pay.com API's hosts, keys, authentication, idempotency, and webhooks. Commerce is a tab in your workspace, with the same people and roles. Insights, Settlements, Customers, Payment links, and Reports mean the same in both products, and they're shared pages in the Pay.com dashboard. | [The Commerce API](/commerce/commerce-api), [Settlements](/commerce/settlements) | | **Who sells** | Sell as yourself, or have Pay.com sell as the merchant of record, sale by sale. The seller is set when the customer pays and never changes on renewal. When Pay.com sells, it calculates, collects, and files the tax, provides first-line customer support, handles refunds and disputes, and pays you net settlements every week. You fulfill the order, and you can still refund it yourself. | [Choose who sells](/commerce/choose-who-sells), [Merchant of record](/commerce/merchant-of-record) | | **Your own processor** | When you're the seller, run checkout, subscriptions, tax, and invoices on the processor you already use. | [Bring your own processor](/commerce/bring-your-own-processor) | | **Checkout** | Show one session as a hosted page, inline or as an overlay on your site, or in the native drop-ins in your app, on your own domain if you like. Versioned design profiles and custom CSS within fixed limits match it to your brand. | [Checkout](/commerce/checkout) | | **Express methods and accounts** | Apple Pay, Google Pay, and other express methods appear in the express row and in the method list, and wallets ask only for the billing details you set. Guest checkout always works, and customers can choose a Pay.com account, secured with a passkey, that saves their payment methods across merchants. | [Express methods and billing details](/commerce/express-methods-and-billing-details), [Guests and Pay.com accounts](/commerce/guests-and-pay-com-accounts) | | **Catalog and tax** | Send product data with your own reference, the way `customer_reference_id` works for customers, or manage products in the Commerce tab. Pay.com keeps its copy in sync and keeps each price as a version, so past orders and live subscriptions keep theirs. When you sell, charge the tax figures you send, or let Pay.com calculate the tax on your tax setup. When Pay.com sells, it calculates and charges its own figure and keeps yours alongside it. | [Products and prices](/commerce/products-and-prices), [Tax](/commerce/tax) | | **Subscriptions and entitlements** | Run subscriptions on Pay.com's engine, or on an external engine such as Stripe Billing through an adapter. One `subscription_options` object picks the engine for a checkout session, a payment link, or a subscription, and a price or your whole account can set a default. Entitlements tell you what each customer can use (access, features, seats, balances, and store purchases), whatever the engine. | [Choose a subscription engine](/commerce/choose-a-subscription-engine), [Entitlements](/commerce/entitlements) | | **Trials, plan changes, and canceling** | Customers get reminders 7 days before a trial ends and before a yearly renewal, and see the proration before they change plans. They cancel online at the end of the period, get a withdrawal button where the law needs one, and manage plans, payment methods, invoices, and refund requests in the customer portal. | [Trials, plan changes, and canceling](/commerce/trials-plan-changes-and-canceling), [Customer portal](/commerce/customer-portal) | | **Apps and games** | Link out to checkout from native iOS and Android apps, React Native apps, and Unity games (on mobile, WebGL, and PC), and bring customers back to the app afterward. The SDK applies the stores' rules from a remote table, and Pay.com can report link-out sales to Apple and Google for you if you opt in. | [Sell from your app](/commerce/sell-from-your-app) | | **Reporting** | Insights covers sales, conversion, MRR and ARR with their movements, subscribers and seats, churn, retention, trials, recovery, cohorts, refunds, disputes, tax, and settlements. Every subscription counts once, whichever engine runs it. Every figure shows its definition, and every report exports as CSV, can be emailed on a schedule, and has a reporting API. | [Insights and metrics](/commerce/insights-and-metrics) | ## How it fits [#how-it-fits] Every surface your customers and your team use goes through one Commerce layer, which runs on Pay.com's existing payment rails. Three switches decide how each sale runs: * **Who sells**: you, or Pay.com as the merchant of record. * **Who processes**: Pay.com, or your own processor when you're the seller. * **Which subscription engine**: Pay.com's, or an external engine you connect. Pay.com sells only on accounts it controls, never on your own processor, and a subscription keeps its seller on every renewal. Card details stay in Pay.com's card fields and vault. ## Find your use case [#find-your-use-case] Start from the use case closest to how you sell. Compare them side by side in [Find your use case](/commerce/find-your-use-case). ## In your workspace [#in-your-workspace] Commerce is a tab in each workspace, alongside Payments and Banking, with the same people, roles, API keys, and webhooks. There's no new account or entity to manage. If you only want Pay.com to sell for you, you get a workspace with the Commerce tab. Your sales run on accounts Pay.com controls, and the Payments tab stays hidden until you process payments as yourself. Subscriptions, checkout design, payment links, and app registrations are shared pages, so they also work for merchants who use Payments alone. # Insights and metrics (/commerce/insights-and-metrics) Insights brings sales, checkout conversion, recurring revenue movements, and upcoming settlements together on one page. Every figure displays what it counts, how it changed, and the underlying records so you can verify and act on it. ## Insights [#insights] Commerce's Insights works like Payments' Insights: * Every figure displays its change against the previous period of the same length, marked good or bad by whether the move is good for you. * Every card opens the list behind it, filtered the same way, and the list adds up to the card. * Switch between each currency and your reporting currency. * Figures show when they were last updated, in the time zone you set. Filter by date range, seller (you or Pay.com), country, product, subscription source, and currency. ### The cards [#the-cards] The Insights page has these cards: | Card | What it shows | | ------------------------- | ---------------------------------------------------------------------------------------------------- | | **Sales** | Gross, and net of refunds, by seller | | **Orders** | Orders, and the average order value | | **Checkout conversion** | Sessions that ended paid, with the drop-off at each step | | **MRR and ARR** | MRR and ARR, with the month's MRR movements (new, expansion, contraction, churned, and reactivation) | | **Subscribers and seats** | Active, new, churned, and reactivated subscribers, plus seats added and removed | | **Churn** | Subscriber churn rate and revenue churn rate, with scheduled cancellations shown separately | | **Trials** | Started, converted, and the conversion rate | | **Recovery** | Failed renewals, recovered, and the recovery rate | | **Refunds and disputes** | Count, amount, and rate | | **Settlements** | The next settlement, the reserve held, and the last settlement | | **Tax** | The tax calculated at checkout on your sales, by country | Breakdowns by product, country, payment method, and seller each show how they moved over time. ### Read the figures with the API [#read-the-figures-with-the-api] [`GET /v1/insights`](/api-reference/commerce/insights/get-insights) returns the figures for a period, each with the previous period of the same length, with the same definitions as the Insights page: * `period_start` and `period_end` are days in your workspace's time zone, and the period includes its last day. It can end up to 366 days after it starts. * With `currency`, figures count only sales in that currency, in its own amounts. Without it, every figure is in your reporting currency, each sale converted at the rate on the day it was paid. * `country` counts only sales to customers in that country, and `product` only that product's lines. With `product`, `sales.shipping` is `0`. * Figures are up to `updated`, a few minutes behind. * Settlements aren't included. List them with the Pay.com API's [`GET /v1/settlements`](/api-reference/endpoints/settlements/list-settlements). ```bash curl -G https://api.sandbox.pay.com/v1/insights \ -u ':sk-pay-com-sandbox-…' \ -d period_start=2026-11-01 \ -d period_end=2026-11-30 \ -d currency=usd ``` ```json { "resource": "insights", "currency": "usd", "period": { "start": "2026-11-01", "end": "2026-11-30" }, "previous_period": { "start": "2026-10-02", "end": "2026-10-31" }, "updated": "2026-11-30T21:55:00.000Z", "sales": { "gross": { "value": 1284500, "previous": 1093200 }, "net": { "value": 1241300, "previous": 1060400 }, "shipping": 38400 }, "conversion": { "sessions": 1640, "paid": 410, "rate": { "value": 0.25, "previous": 0.2314 }, "drop_off": [ { "step": "details", "sessions": 520 }, { "step": "shipping", "sessions": 190 }, { "step": "payment", "sessions": 520 } ] } } ``` The response also has `orders`, `refunds`, `disputes`, `tax`, and the `products`, `countries`, and `payment_methods` breakdowns. Amounts are in the smallest currency unit, so `1284500` is $12,845.00 USD. ## Which subscriptions count [#which-subscriptions-count] Every subscription counts once across Pay.com's engine, external engines such as Stripe Billing, and app store subscriptions reported through [entitlements](/commerce/entitlements). Filter by source to see one of them. A subscription mirrored from an engine is never counted twice. ## Definitions [#definitions] Commerce uses these definitions, with the standard SaaS ones for recurring revenue. Each figure displays its definition one click away in the Pay.com dashboard, in exports, and in the API docs. | Metric | Definition | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Net sales** | Gross sales less refunds. Disputes aren't taken off. | | **Conversion rate** | Paid checkout sessions as a fraction of sessions, such as `0.25`, rounded to four places. | | **Drop-off** | Sessions that didn't pay, each counted once at the furthest step it reached: details, shipping, or payment. A one-page checkout counts as one step, payment. | | **Orders shipped** | Orders marked shipped in the period. | | **Open disputes** | The period's orders that are under dispute now. | | **Breakdowns** | The top 10 products, countries, or payment methods by value. Orders without a country are left out of the country breakdowns. | | **MRR** | The recurring price of every active paid subscription, per month, after discounts. It leaves out tax, one-time charges, setup fees, and usage charges, which are reported separately as usage revenue. Yearly prices are divided by 12, and weekly prices multiplied by 52 and divided by 12. A subscription made free by a 100% discount adds 0. | | **ARR** | MRR × 12. | | **Trials** | Not in MRR. A subscription counts as a trial until its first paid period starts. | | **Past due** | Stays in MRR until its grace period ends, then churns. Recovered within the grace period, it never churned. | | **MRR movements** | Counted on the day they take effect, covering new (first paid period), expansion (price, plan, or seat increases), contraction (decreases), churned (access ended), and reactivation (a churned customer paying again). Net new MRR is their sum. | | **Churn** | Counts when access ends, not when the customer cancels. A cancellation for the end of the period appears as a scheduled cancellation until then. | | **Subscriber churn rate** | Subscribers churned in the period ÷ subscribers active at its start. | | **Revenue churn rate** | Churned and contraction MRR ÷ MRR at the start of the period. | | **Net revenue retention** | MRR at the end of the period from customers active at its start ÷ their MRR at the start. | | **Gross revenue retention** | Net revenue retention without expansion. | | **ARPA** | MRR ÷ paying customers. | | **Lifetime value** | ARPA ÷ revenue churn rate, shown once there are 3 months of history. | | **Cohorts** | Customers grouped by the month they first paid, with the share still subscribed and the MRR kept, month by month. | | **Seats** | Quantity added and removed on plans priced by seat, with the MRR they moved. | | **Refunds** | Don't change MRR. A refund that ends access is churn. | | **Currency** | Each movement converted to your reporting currency at that day's rate. By currency shows the original amounts. | | **Store subscriptions** | MRR at the price the customer pays, without tax. The store's fee is reported separately. | ## The same number everywhere [#the-same-number-everywhere] A card, its list, its export, and the [reporting API](/api-reference/commerce/reportruns/create-report-run) read the same data with the same definitions, so they always agree. See [Reports and exports](/commerce/reports-and-exports). # Manage subscriptions (/commerce/manage-subscriptions) Once a subscription is active, Pay.com handles billing automatically. From your server, you can still find a customer's subscriptions, read their state, respond to failed charges, update the payment method, and cancel. Customers can make the same changes themselves in the [customer portal](/commerce/customer-portal). ## Requirements [#requirements] Before you can manage subscriptions, you need: * A subscription ID (`sub_...`). Follow the [create a subscription](/commerce/create-a-subscription) guide to create one. * A payment method saved for off-session use if you plan to update the billing card. See [save a payment method](/payments/set-up-a-card/save-a-payment-method). ## List a customer's subscriptions [#list-a-customers-subscriptions] Send a `GET` request to [`/v1/subscriptions`](/api-reference/commerce/subscriptions/list-subscriptions) with `customer_reference_id` to find every subscription a customer has, from both sellers and every engine. Filter by `status`, and page through the results with `limit` and `starting_after`. ```bash curl -G https://api.sandbox.pay.com/v1/subscriptions \ -u ':sk-pay-com-sandbox-…' \ -d customer_reference_id=cust-jane-doe-001 ``` ```json { "resource": "subscriptions", "data": [ { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "customer_reference_id": "cust-jane-doe-001", "engine": { "type": "pay_com", "connection": null, "collection_model": "native" }, "access": { "status": "granted", "ends_at": null }, "current_period_end": "2026-12-25T10:30:00.000Z" } ], "has_more": false } ``` ## Retrieve a subscription [#retrieve-a-subscription] Send a `GET` request to [`/v1/subscriptions/{subscription_id}`](/api-reference/commerce/subscriptions/get-subscription) to get the current state of a subscription: ```bash curl https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "customer_reference_id": "cust-jane-doe-001", "payment_method": "pm_card_684790996696828928", "reference": "sub-jane-doe-premium-001", "items": [ { "id": "subitem_684790996696828930", "price": "prc_691180240037724160", "price_version": 1, "quantity": 1 } ], "current_period_start": "2026-11-25T10:30:00.000Z", "current_period_end": "2026-12-25T10:30:00.000Z", "latest_invoice": { "id": "inv_691230018734120960", "number": "INV-2026-0042", "status": "paid", "issuer": "pay_com" } } ``` The `status` field reflects the current billing state. See [Subscription statuses](/commerce/how-subscriptions-work#subscription-statuses) for each status and what causes each transition. ## Handle a failed charge [#handle-a-failed-charge] When a renewal fails, the subscription moves to `unpaid` and Pay.com retries it on the `failed_payment` rules in your [subscription settings](/api-reference/commerce/subscriptionsettings/update-subscription-settings), or the price's own. Each attempt fires a `subscription.attempted` event. Once the retries are used up, Pay.com applies `final_action`. With `cancel`, the subscription ends with `cancellation_reason` set to `payment_failed` and fires `subscription.canceled`. With `pause`, billing is suspended and the subscription moves to `paused`. With `leave_unpaid`, it stays `unpaid`. See [Failed renewals](/commerce/how-subscriptions-work#failed-renewals). You can also retry the renewal yourself. Send a `POST` request to [`/v1/subscriptions/{subscription_id}/retry`](/api-reference/commerce/subscriptions/retry-subscription) with no body. It charges the payment method on the subscription, so to use another card, [update the payment method](#update-a-payment-method) first. The retry takes only `unpaid` subscriptions on Pay.com's engine. Other engines retry on their own, so the request returns `422` with `not_collector`. ```bash curl -X POST https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928/retry \ -u ':sk-pay-com-sandbox-…' \ -H "idempotency-key: $(uuidgen)" ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "current_period_end": "2026-12-25T10:30:00.000Z", "last_failure": null } ``` A successful retry returns `status: active`. A failed retry returns `status: unpaid`. Subscribe to these events to automate retry and recovery logic: * `subscription.attempted`: fires for each renewal attempt. * `subscription.active`: fires when a retry succeeds and the subscription recovers. ## Update a payment method [#update-a-payment-method] To replace the billing card on an active subscription, send a `PATCH` request to [`/v1/subscriptions/{subscription_id}`](/api-reference/commerce/subscriptions/patch-subscription) with the new payment method ID. The card must already be saved for off-session use. See [save a payment method](/payments/set-up-a-card/save-a-payment-method). ```bash curl -X PATCH https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928 \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "payment_method": "pm_card_685125114794084354" }' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "payment_method": "pm_card_685125114794084354" } ``` ## Change the plan or quantity [#change-the-plan-or-quantity] To move a subscription to another price or quantity, preview the change with [`POST /v1/subscriptions/{subscription_id}/previews`](/api-reference/commerce/subscriptions/create-subscription-preview), then apply the preview with [`PATCH /v1/subscriptions/{subscription_id}`](/api-reference/commerce/subscriptions/patch-subscription). See [Plan changes](/commerce/trials-plan-changes-and-canceling#plan-changes). ## Cancel a subscription [#cancel-a-subscription] Canceling a subscription stops future billing without immediately ending access. Send a `POST` request to [`/v1/subscriptions/{subscription_id}/cancel`](/api-reference/commerce/subscriptions/cancel-subscription). You can cancel at the end of the current billing period or on any later date. Send an empty body. The subscription stays `active` until the current period ends, then Pay.com cancels it automatically. ```bash curl https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928/cancel \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{}' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "cancel_at": "2026-12-25T10:30:00.000Z", "current_period_end": "2026-12-25T10:30:00.000Z", "canceled_at": null } ``` Include a `cancel_at` date after the current period ends to schedule the cancellation for that date. ```bash curl https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928/cancel \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "cancel_at": "2027-01-15T00:00:00.000Z" }' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "cancel_at": "2027-01-15T00:00:00.000Z", "canceled_at": null } ``` In both cases the subscription doesn't end immediately, and the customer keeps access until it does. The `canceled_at` field is set when the cancellation takes effect. The `cancellation_reason` field records why it ended (`requested` when you or the customer canceled it, `ended` when it reached its `cancel_at` date, `withdrawn` when the customer withdrew from the contract, `payment_failed` when retries were used up, or `dispute` after a dispute action). ## Test a renewal in the sandbox [#test-a-renewal-in-the-sandbox] You don't have to wait for a billing date to test a renewal. In the sandbox, send a `POST` request to [`/v1/subscriptions/{subscription_id}/simulate/charge`](/api-reference/commerce/subscriptions/simulate-charge) to run the next renewal immediately without waiting for the scheduled billing date. The request returns the subscription after the renewal, and Pay.com sends the renewal's [subscription events](/api-reference/commerce/events#subscriptions), such as `subscription.charged`. Live keys return `403`. ```bash curl -X POST https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928/simulate/charge \ -u ':sk-pay-com-sandbox-…' \ -H "idempotency-key: $(uuidgen)" ``` ## Next steps [#next-steps] * [Trials, plan changes, and canceling](/commerce/trials-plan-changes-and-canceling): add a trial, preview a plan change, and let customers cancel online. * [Save a payment method](/payments/set-up-a-card/save-a-payment-method): store a card for off-session use before updating a subscription's billing method. * [How subscriptions work](/commerce/how-subscriptions-work): statuses, lifecycle, and failed renewals. # Merchant of record (/commerce/merchant-of-record) With Pay.com as the merchant of record, Pay.com is the seller of each sale. You sell in more countries without registering for tax in each of them, and without running customer support, refunds, and chargebacks yourself. You build and deliver the product, and Pay.com pays out net settlements weekly. ## What Pay.com does [#what-paycom-does] As the seller, Pay.com takes on these jobs: * **Tax**: calculates, collects, and files the tax on every sale, through Pay.com's selling entities in the EU and the US. Pay.com and its filing partners file and pay the returns. * **Customer support**: handles first-line customer support in Pay.com's name. * **Refunds and chargebacks**: processes refunds and handles chargebacks and disputes. * **Emails**: sends receipts and notices in Pay.com's name. * **Settlements**: pays you net settlements every week, with a reserve set by risk. ## What you do [#what-you-do] You handle the rest: * Deliver what was bought. Fulfill when the payment webhook arrives, and use [entitlements](/commerce/entitlements) for access, features, and seats. * Keep your products' data accurate, in your system or in the Commerce tab. * Refund from the order when you choose to. Pay.com processes the refund. See [Orders and refunds](/commerce/orders-and-refunds). ## What Pay.com sells [#what-paycom-sells] Pay.com acts as the merchant of record for digital goods, software, SaaS, and app subscriptions. Pay.com never sells physical goods, human services, or real-money gambling as the merchant of record. You can still sell those as yourself where Pay.com's risk policy allows. ## Where Pay.com sells [#where-paycom-sells] Pay.com sells where it's registered for tax. Elsewhere, sales to consumers are blocked, and business customers with a validated tax ID can still buy. ## Seller and product review [#seller-and-product-review] Before Pay.com sells for you, it reviews your business and your products, and it keeps monitoring them. A product that first reaches Pay.com in a request is screened immediately, and a person reviews it afterward. A product that fails screening is refused, or you sell it as yourself where the seller rules allow. A product's `review_status` shows where its review stands. It's `screened` once the product passes automatic screening, then `approved` or `refused` after a person's review. When a product in a request fails screening and you can't sell it yourself, the request returns `422` with `product_refused`. ```bash curl https://api.sandbox.pay.com/v1/products/prod_691180236711641088 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "prod_691180236711641088", "resource": "product", "reference": "pro-plan", "name": "Pro plan", "tax_code": "txcd_10103001", "managed_by": "api", "review_status": "screened", "active": true, "created": "2026-11-25T10:30:00.000Z", "test_mode": true } ``` See [Retrieve a product](/api-reference/commerce/products/get-product) in the Commerce API reference for every field. ## Settlements and the reserve [#settlements-and-the-reserve] Pay.com pays out net settlements weekly, covering gross sales minus refunds, chargebacks, fees, and collected tax. Part of each settlement can be held in a risk-based reserve and released later. Every line appears in the settlement's breakdown, the same way as in Payments. See [Settlements](/commerce/settlements). Losses you cause are deducted from your settlements and the reserve. ## In your app [#in-your-app] In native drop-ins, Pay.com runs in-app as the merchant of record only where app-store policies, wallet rules, and local law permit alternative in-app billing, displaying the seller line, tax-inclusive totals, consents, and wallet merchant identity. Otherwise, digital goods sell through link-out to the hosted checkout. See [Sell from your app](/commerce/sell-from-your-app). # Orders and refunds (/commerce/orders-and-refunds) Every sale becomes an order you can follow from checkout to refund in one place, with its items, its payments, and anything that happened after. ## Orders [#orders] An order is the sale with its items. Pay.com creates one when a checkout session or a payment link is paid, including the first payment of a subscription. Each order links to its payments in Activity, and each payment links back to its order, so you can move between what was sold and how it was paid. The order shows how it was paid in `payment_method_details`, from its charge. It has the payment method's `type`, and for a card, including one in a wallet, `card` with the `brand`, `last4`, `exp_month`, and `exp_year`. `wallet` names the wallet the card was in, such as `apple_pay`, or is `null`. Fulfill an order when the `order.paid` webhook arrives. It's the proof of payment, and it carries the order's items. For access, features, and seats, use [entitlements](/commerce/entitlements). Retrieve an order with [`GET /v1/orders/{order_id}`](/api-reference/commerce/orders/get-order), or list a customer's orders with [`GET /v1/orders`](/api-reference/commerce/orders/list-orders). ## Mark an order shipped [#mark-an-order-shipped] When you ship an order's items, mark the order shipped in the Commerce tab, or send `shipped_at` with [`PATCH /v1/orders/{order_id}`](/api-reference/commerce/orders/update-order). The time can't be in the future or before the order was paid. Pay.com sends `order.updated`, and the order shows the time in `shipped_at`. ```bash curl -X PATCH https://api.sandbox.pay.com/v1/orders/ord_691204561890402304 \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "shipped_at": "2026-11-25T16:00:00.000Z" }' ``` ```json { "id": "ord_691204561890402304", "resource": "order", "number": "CL-10478", "status": "paid", "shipped_at": "2026-11-25T16:00:00.000Z", "created": "2026-11-25T10:30:00.000Z", "test_mode": true } ``` To undo it, send `shipped_at` as `null`. An order with nothing that ships returns `422` with `order_not_shippable`. Orders come from checkout sessions and payment links, so `shipped_at` and `metadata` are the only fields you can change. To find the orders left to ship, list orders with `shipping` set to `not_shipped`, which returns the orders with items that ship and no `shipped_at` yet. `shipped` returns the orders marked shipped. Orders with nothing that ships match neither. ## Refunds [#refunds] Refund an order from the order in the Commerce tab, or with [`POST /v1/orders/{order_id}/refund`](/api-reference/commerce/orders/refund-order). It's the only way to refund an order. Calling [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) for an order's charge returns `422` with `use_order_refund`, so the order, its invoice, and its credit notes stay in sync. Without a body, the request refunds what's left to refund. Send `line_items` to refund particular items with their tax, and `include_shipping` to refund the shipping with them, or send `amount` alone for part of the order. Amounts are in the smallest currency unit, so `2170` is $21.70 USD. ```bash curl https://api.sandbox.pay.com/v1/orders/ord_691204561890402304/refund \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "line_items": [{ "line_item": "oli_691204561890402306", "quantity": 1 }], "reason": "Arrived broken", "reference": "refund-ord-0042" }' ``` ```json { "id": "rfnd_691298114536923136", "resource": "refund", "status": "succeeded", "amount": 2170, "currency": "usd", "order": "ord_691204561890402304", "charge": "chrg_685125114794084352", "line_items": [{ "line_item": "oli_691204561890402306", "quantity": 1, "amount": 2170 }], "amount_shipping": 0, "credit_note": "cn_691298114536923199", "reason": "Arrived broken", "reference": "refund-ord-0042", "created": "2026-11-26T09:12:40.000Z", "test_mode": true } ``` The refund is the same object as the Pay.com API's refunds, so [`GET /v1/refunds/{id}`](/api-reference/endpoints/refunds/get-refund-by-id) finds it too. [`GET /v1/orders/{order_id}/refunds`](/api-reference/commerce/orders/list-order-refunds) lists an order's refunds, oldest first. Pay.com sends the usual refund events and `order.refunded` with the updated order. When the order has an invoice, Pay.com issues a credit note, and the refund names it in `credit_note`. Everything else about refunds works as in Payments. See [Refunds](/payments/refunds). When a refund doesn't go through, the request returns one of these: * `422` with `refund_failed`: the payment method refused the refund, and nothing was refunded. * `502` with `refund_unconfirmed`: the payment processor's answer didn't arrive. The refund shows as `pending` until Pay.com confirms it. A retry with the same idempotency key returns the same answer, never a second refund. Subscription renewals don't create orders, so you refund a renewal through its invoice, with [`POST /v1/invoices/{invoice_id}/refund`](/api-reference/commerce/invoices/refund-invoice). It refunds what's left, an `amount`, or particular `lines`, and issues the credit note. A renewal on an invoice another engine issued is refunded at that engine, and a payment your own system scheduled with [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund). See [Refunds go through what billed them](/commerce/commerce-api#refunds-go-through-what-billed-them). When Pay.com sells as the merchant of record: * You can still issue a refund from the order, and Pay.com processes it. * Pay.com's support can refund too, when a customer asks for one. * Customers can ask for a refund in the [customer portal](/commerce/customer-portal). ## Invoices and credit notes [#invoices-and-credit-notes] Whether an order gets an invoice comes from its session's or payment link's `invoice_creation`, and defaults to your Commerce settings. A refund of an invoiced order issues a credit note. Invoices and credit notes show when Pay.com emailed them to the customer in `sent_at`. An invoice's `hosted_invoice_url` and `invoice_pdf`, and a credit note's `credit_note_pdf`, are `null` until Pay.com renders them. Set how your invoices are numbered and what they show in the Commerce tab, or with [`PATCH /v1/commerce_settings`](/api-reference/commerce/commercesettings/update-commerce-settings). The sandbox and live have separate settings, and each key reads and changes its own environment's: | Setting | What it sets | | :------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `invoicing.enabled` | Whether orders get an invoice when the session doesn't say. | | `invoicing.number_prefix`, `invoicing.next_number` | The invoice series' prefix, such as `CL-2026-`, and the next number after it. | | `invoicing.credit_note_prefix`, `invoicing.next_credit_note_number` | The credit note series' prefix and next number. | | `invoicing.footer` | Text printed at the foot of every invoice and credit note, up to 500 characters. | | `seller` | The `legal_name`, `address`, `tax_id`, and `email` on your invoices and credit notes. Until you set them, they're your legal entity's. Customers' replies to invoice emails go to `email`. | A `next_number` the series has already used returns `422` with `number_in_use`. Changes apply to orders, invoices, and credit notes from then on. Documents already issued keep the details they were issued with. ## Disputes [#disputes] A dispute appears on its order and in **Fraud & Disputes** → **Disputes** in the Pay.com dashboard. When Pay.com sells, Pay.com handles the dispute and its chargeback. When you sell, you respond to it the same way as in Payments. See [Disputes](/risk/disputes). A dispute on a subscription payment can also cancel or pause the subscription. See [Disputes](/commerce/how-subscriptions-work#disputes). ## In your reports [#in-your-reports] Orders, order items by product, refunds, and disputes each have a report. See [Reports and exports](/commerce/reports-and-exports). # Products and prices (/commerce/products-and-prices) Your catalog can stay where it is. Send product data with your own reference and Pay.com keeps its copy in sync, so you never maintain the same products in two places. Or create and edit products in the Commerce tab, if that's easier. ## Send products with your reference [#send-products-with-your-reference] Send the product's data in the request, with your own reference for it, the way [`customer_reference_id`](/api-reference/endpoints/customers/create-customer) works for customers. Pay.com finds the product by that reference, or creates it, and keeps its own copy, mapped from what you sent. When you send different data for a reference Pay.com already has, it updates its copy. The latest data wins. On a checkout session, send each product in `line_items[].price_data.product_data`, alongside its price. The response names the product and price Pay.com found or created, and the price version the customer pays. Amounts are in the smallest currency unit, so `1999` is $19.99 USD. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [ { "price_data": { "currency": "usd", "unit_amount": 1999, "product_data": { "reference": "brand-kit", "name": "Brand kit", "tax_code": "txcd_10000000" } }, "quantity": 1 } ] }' ``` ```json { "id": "cs_691218322858614784", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/Pd8sF4vLq1Hy", "amount": 1999, "currency": "usd", "line_items": [ { "product": "prod_691180270883479552", "price": "prc_691180274607050752", "price_version": 1, "name": "Brand kit", "quantity": 1, "unit_amount": 1999, "amount_subtotal": 1999, "amount_total": 1999 } ] } ``` You can also create products and prices with [`POST /v1/products`](/api-reference/commerce/products/create-product) and [`POST /v1/prices`](/api-reference/commerce/prices/create-price), and update them with [`PATCH /v1/products/{product_id}`](/api-reference/commerce/products/update-product) and [`PATCH /v1/prices/{price_id}`](/api-reference/commerce/prices/update-price). ## Prices are kept as versions [#prices-are-kept-as-versions] A changed price is a new version. Past orders keep the price they were sold at, and a live subscription moves to a new price only after its customer gets a price-change notice. A price keeps its `prc_` ID across versions, and `version` numbers them. An inline price is found by its own `reference`, or by its currency and schedule when it has none. A different `unit_amount` or tax behavior adds a version, and the same data reuses the current one. Orders, invoices, and subscription items record the `price_version` they were sold at. To move a live subscription to a new version, schedule a price change with [`PATCH /v1/subscriptions/{subscription_id}`](/api-reference/commerce/subscriptions/patch-subscription) and `price_change`. Until the change takes effect, the subscription records the scheduled amount and date in `price_change`, and the last day to cancel before it in `next_payment.cancel_by`. ## Products managed in your system [#products-managed-in-your-system] Products you send with your reference appear in the Commerce tab as managed by your system, alongside your reference. They can't be edited there, so your system stays the source of truth. In the API, these products have `managed_by` set to `api`. ## When Pay.com sells [#when-paycom-sells] When Pay.com sells as the merchant of record, a product that first reaches Pay.com in a request is screened immediately, and a person reviews it afterward. A product that fails screening is refused, or you sell it as yourself where the seller rules allow. The product's `review_status` shows where its review stands. See [Merchant of record](/commerce/merchant-of-record#seller-and-product-review). # Reports and exports (/commerce/reports-and-exports) Export reports as CSV spreadsheets, deliver them on a schedule by email, or fetch them programmatically through the reporting API. Each method reads the same data with the same definitions as Insights, so the figures always match. ## One Reports page [#one-reports-page] Each workspace has one Reports page, shared with Payments, with every report type on it. ## Report types [#report-types] The Reports page has these report types: * Orders, and order items by product. * Subscriptions, as a snapshot on any date, and MRR movements, each change with its reason. * Subscribers and seats, and cohorts. * Trials and recovery. * Invoices and credit notes. * Refunds and disputes. * Tax, by country, period, and source (merchant-supplied figures or Pay.com's calculation). * Settlements, with each line of their breakdown. * Customers. * Checkout conversion, by step, payment method, and country. * Payment methods. ## Three ways to get a report [#three-ways-to-get-a-report] You can export a report, schedule it, or request it from the API: * **Export**: every report and every list exports as CSV. * **Schedule**: email a report daily, weekly, or monthly to people in your workspace. * **Reporting API**: create a report run with its type, period, filters, and reporting currency. It runs in the background, and an event tells you when it's ready, with a short-lived link to download it. Lists keep their own API routes, with the same filters. Every report uses the definitions in [Insights and metrics](/commerce/insights-and-metrics). ## Run a report from the API [#run-a-report-from-the-api] Start a report run with [`POST /v1/report_runs`](/api-reference/commerce/reportruns/create-report-run). Set `type` to the report, `period` to its dates, and optionally `filters` and `reporting_currency`. The run starts as `pending`. ```bash curl https://api.sandbox.pay.com/v1/report_runs \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "type": "mrr_movements", "period": { "start": "2026-11-01T00:00:00Z", "end": "2026-12-01T00:00:00Z" }, "filters": { "seller": "merchant" }, "reporting_currency": "usd" }' ``` ```json { "id": "rptrun_691281126391320576", "resource": "report_run", "type": "mrr_movements", "status": "pending", "period": { "start": "2026-11-01T00:00:00Z", "end": "2026-12-01T00:00:00Z" }, "filters": { "seller": "merchant" }, "reporting_currency": "usd", "file": null, "created": "2026-12-01T08:00:00.000Z", "test_mode": true } ``` When the file is ready, Pay.com sends `report_run.succeeded` with the run, and `file.url` downloads the CSV until `file.expires_at`. A run that fails sends `report_run.failed`. See [Report runs](/api-reference/commerce/reportruns/create-report-run) for every report type and filter. # Sell from your app (/commerce/sell-from-your-app) Sell from your app with the same catalog, checkout, entitlements, and reports as your website. Link-out sends customers from the app to checkout in the browser and back again, and the SDK applies the stores' rules, so you don't track them yourself. ## How link-out works [#how-link-out-works] A link-out purchase goes through these steps: 1. Your server creates the session and receives a short-lived checkout URL. It carries no personal data, and your server can request a new one if it expires. 2. The app opens the URL. Checkout opens in the system browser by default, and in Custom Tabs on Android. 3. The customer pays, then taps **Return to app**. 4. The payment webhook notifies your server that the customer paid. It's the proof of payment. Fulfill from it, not from the customer's return. ## Create the session for a link-out [#create-the-session-for-a-link-out] Your server creates a checkout session with `return_url` set to your app's return link, and `client_state` set to the value the SDK gave the app. The return link's domain must differ from the checkout's. Set `duration`, in minutes, to at least 30. Amounts are in the smallest currency unit, so `999` is $9.99 USD. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180281980665856", "quantity": 1 }], "return_url": "https://app.example.com/pay/return", "client_state": "Xq7Lm2Nv9Rt4Kp8Wz3Bc5D", "duration": 30 }' ``` ```json { "id": "cs_691229731271139328", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/Nf4wB8xKs2Ve", "amount": 999, "currency": "usd", "return_url": "https://app.example.com/pay/return", "client_state": "Xq7Lm2Nv9Rt4Kp8Wz3Bc5D", "expires_at": "2026-11-25T11:00:00.000Z" } ``` When the customer taps **Return to app**, the link carries `session_id`, `outcome`, and `client_state`. The outcome is a hint for the app's screen, not proof of payment. If the URL expires before the customer opens it, generate a new one for the same session with [`POST /v1/checkout/{checkout_session_id}/refresh`](/api-reference/commerce/checkout/refresh-checkout), whose `duration` can be as short as 5 minutes. See [Create a checkout session](/api-reference/commerce/checkout/create-checkout) in the Commerce API reference for all fields. ## In-app browsers [#in-app-browsers] You can choose an in-app browser instead, for physical goods and services, and in the EU where it's allowed. ## One core on every platform [#one-core-on-every-platform] Link-out is built once, into the iOS and Android SDKs, and the [Unity](/commerce/unity) and React Native packages use it underneath, so every platform links out the same way. ## The total the customer saw [#the-total-the-customer-saw] Before paying, the SDK checks the total again against the one the customer saw, and the API checks at payment that it's the same amount. ## Native drop-ins and merchant of record [#native-drop-ins-and-merchant-of-record] Pay.com acts as the merchant of record for digital goods, software, SaaS, and app subscriptions. In native drop-ins, Pay.com runs in-app as the merchant of record only where app-store policies, wallet rules, and local law permit alternative in-app billing, showing the seller line, tax-inclusive totals, consents, and wallet merchant identity. Where alternative in-app billing isn't permitted, digital goods sell through link-out to the hosted checkout. ## Store rules and reporting [#store-rules-and-reporting] The SDK applies the stores' rules, and Pay.com can report your link-out sales to Apple and Google for you if you opt in. See [Store rules and reporting to the stores](/commerce/store-rules). # Settlements (/commerce/settlements) A settlement is what Pay.com pays you, net, with a breakdown of how it got there. Commerce's settlements work the same way as [Payments' settlements](/data/reconciliation/settlements), on the same page in the Pay.com dashboard, so you read one statement whichever product you sell with. A settlement isn't a payout. A [payout](/payouts) sends money out to a recipient's payment method. ## What's in a settlement [#whats-in-a-settlement] Each settlement breaks down into lines, as in Payments: * Processed sales. * Refunds. * Chargebacks, and their fees. * Processing and service fees. * The rolling reserve, held and released. * VAT. * Adjustments. * The net amount paid. ## Read a settlement's breakdown [#read-a-settlements-breakdown] List your settlements with [`GET /v1/settlements`](/api-reference/endpoints/settlements/list-settlements), and read one settlement's lines with [`GET /v1/settlements/{settlement_id}/breakdown`](/api-reference/endpoints/settlements/get-settlement-breakdown). Amounts are in the smallest currency unit, and deductions are negative, so `-9071` is $90.71 USD held in the reserve. `amount` is the sum of `processed_amount` and every fee, chargeback, reserve, VAT, and adjustment line. `refund_amount` and `payout_amount` are positive totals already deducted inside `processed_amount` and excluded from the sum. ```bash curl https://api.sandbox.pay.com/v1/settlements/stlmnt_691311208513171456/breakdown \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "stbrk_stlmnt_691311208513171456", "resource": "settlement_breakdown", "amount": 170439, "currency": "usd", "processed_amount": 181420, "refund_amount": 0, "chargeback_amount": 0, "chargeback_fees": 0, "interchange_fees": -1180, "network_fess": -138, "processing_fees": -592, "vat": 0, "rolling_reserve": -9071, "rolling_reserve_released": 0, "general_adjustments": 0 } ``` Pay.com sends `settlement.paid` when it pays a settlement. For what each line means and how the lines add up, see [What a settlement contains](/data/reconciliation/settlements#what-a-settlement-contains). ## When Pay.com sells [#when-paycom-sells] When Pay.com sells as the merchant of record, it pays you net settlements every week. Part of each one can be held in a reserve, set by risk, and released later. Losses you cause are deducted from your settlements and the reserve. ## Settlement accounts [#settlement-accounts] Each settlement belongs to a settlement account (`sa_...`), which represents one configured acquirer or provider connection per settlement currency, and is paid out to the bank account linked to that settlement account. See [Settlement accounts](/data/reconciliation/settlements#settlement-accounts). ## In Insights and reports [#in-insights-and-reports] Insights shows the next settlement, the reserve held, and the last settlement. The Settlements report lists every settlement with each line of its breakdown. See [Insights and metrics](/commerce/insights-and-metrics) and [Reports and exports](/commerce/reports-and-exports). # Store rules and reporting to the stores (/commerce/store-rules) The stores' rules on linking out of an app change, and differ by store and country. The SDK applies them for you, and Pay.com can report your link-out sales to Apple and Google, so you don't build either. ## Rules from a remote table [#rules-from-a-remote-table] The SDK reads the stores' rules from a remote table, so they can change without a new release of your app. When no valid rule allows a link for digital goods, the SDK hides it. ## Reporting to Apple and Google [#reporting-to-apple-and-google] Pay.com can report your link-out sales to Apple and Google for you, as an opt-in service. You stay liable for the stores' fees. For reporting, the SDK retrieves the store's tokens and the time the customer tapped the link, and your server sends them with the checkout session in `store_link`. Pay.com keeps the first store link on the subscription, in `store_link`, and never overwrites it, so renewals and refunds report against the original purchase. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "subscription", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180240037724160", "quantity": 1 }], "return_url": "https://app.example.com/pay/return", "client_state": "Xq7Lm2Nv9Rt4Kp8Wz3Bc5D", "store_link": { "platform": "apple", "tokens": [{ "type": "services", "value": "Rk9LZ3JhVm1wcWxLdEJzNnF6ZEhXdWI3" }], "tapped_at": "2026-11-25T10:29:41.000Z" } }' ``` ```json { "id": "cs_691231337760874496", "resource": "checkout_session", "mode": "subscription", "status": "open", "url": "https://checkout.pay.com/a/Gs9pV3dMw7Ta", "store_link": { "platform": "apple", "tokens": [{ "type": "services", "value": "Rk9LZ3JhVm1wcWxLdEJzNnF6ZEhXdWI3" }], "tapped_at": "2026-11-25T10:29:41.000Z" } } ``` A Google Play token has no `type`. When you request a new URL with [`POST /v1/checkout/{checkout_session_id}/refresh`](/api-reference/commerce/checkout/refresh-checkout), send the fresh tokens and tap time in its `store_link`, and Pay.com keeps the earlier ones too. ## In your reports [#in-your-reports] Store subscriptions count in your MRR at the price the customer pays, without tax. The store's fee is reported separately. See [Insights and metrics](/commerce/insights-and-metrics). # Subscriptions (/commerce/subscriptions) Run recurring billing on Pay.com's engine or on an external engine you already use. Whichever engine runs a subscription, your checkout, entitlements, and reports work from the same subscription, so you can change engines without rebuilding the rest. ## One control plane [#one-control-plane] Every subscription goes through one control plane, whichever engine runs it. It works with Commerce's checkout or your own, and whether you sell or Pay.com sells as the merchant of record. * **Pay.com's engine** schedules renewals, collects the payments, retries the failures, and issues the invoices. * **An external engine**, such as Stripe Billing, connects through an adapter. See [Choose a subscription engine](/commerce/choose-a-subscription-engine). ## One subscription object [#one-subscription-object] Each subscription is one `sub_` object with one set of events, whichever engine runs it. It records its seller, its engine, who owns each job, whether the customer has access, and the next payment with its last day to cancel. Amounts are in the smallest currency unit, so `1999` is $19.99 USD. ```bash curl https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "sub_684790996696828928", "resource": "subscription", "status": "active", "version": 3, "customer_reference_id": "cust-jane-doe-001", "seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" }, "engine": { "type": "pay_com", "connection": null, "collection_model": "native" }, "access": { "status": "granted", "ends_at": null }, "current_period_start": "2026-11-25T10:30:00.000Z", "current_period_end": "2026-12-25T10:30:00.000Z", "next_payment": { "amount": 1999, "currency": "usd", "due_on": "2026-12-25", "cancel_by": { "at": "2026-12-25T05:00:00Z", "last_day": "2026-12-24", "time_zone": "America/New_York" } }, "latest_invoice": { "id": "inv_691230018734120960", "number": "INV-2026-0042", "status": "paid", "issuer": "pay_com" } } ``` See [Retrieve a subscription](/api-reference/commerce/subscriptions/get-subscription) in the Commerce API reference for every field. ## Billing dates [#billing-dates] Billing dates follow these rules: * A subscription keeps its billing anchor, the day of the period it renews on. * After a late recovery, Pay.com doesn't charge for the periods the subscription missed. The next period ends at the first renewal date after the payment. See [Failed renewals](/commerce/how-subscriptions-work#failed-renewals). * Periods run to the exact time they started. * The last day to cancel is shown to the customer, and canceling by then stops the next charge. On a direct debit, it's the day before the debit is submitted. The subscription returns it in `next_payment.cancel_by`. ## Trials, plan changes, and canceling [#trials-plan-changes-and-canceling] Trials take a payment method by default, customers get reminders before a trial ends and before a yearly renewal, plan changes show their proration first, and canceling is online. See [Trials, plan changes, and canceling](/commerce/trials-plan-changes-and-canceling). ## Start and manage subscriptions [#start-and-manage-subscriptions] Start a subscription at [checkout](/commerce/checkout) with `mode` set to `subscription`, or from your server with a recurring price and a saved payment method. The **Subscriptions** page in the Pay.com dashboard is shared with Payments, so merchants who use Payments alone manage the same subscriptions. * [How subscriptions work](/commerce/how-subscriptions-work): recurring prices, statuses, failed renewals, and cancellation. * [Create a subscription](/commerce/create-a-subscription): create a recurring price and attach a customer's saved payment method. * [Manage subscriptions](/commerce/manage-subscriptions): list, retry, update, and cancel subscriptions. * [Customer portal](/commerce/customer-portal): let customers change, cancel, and pay for their own subscriptions. ## What you can measure [#what-you-can-measure] Insights shows MRR and ARR with their movements, subscribers and seats, churn, retention, trials, recovery, and cohorts, each with its definition. See [Insights and metrics](/commerce/insights-and-metrics). # Tax (/commerce/tax) Use the tax figures your own system calculates, or let Pay.com calculate them for you. When Pay.com sells as the merchant of record, Pay.com calculates, collects, and files the tax. ## When you sell [#when-you-sell] You choose one of two ways: * **Your own figures**: send the tax figures with the sale. Those alone are the tax charged, and Pay.com doesn't calculate its own. * **Pay.com's calculation**: Pay.com calculates the tax on your tax setup. Checkout sessions, payment links, and subscriptions take the same [`tax_options`](/api-reference/endpoints/charges/create-charge) that charges take. Each order and invoice records the tax it charged in `tax`, with `source` set to `merchant` for your figures or `pay_com` for Pay.com's calculation. ### Send your own figures [#send-your-own-figures] Send your figures in `tax_options.tax_quote_data.tax_breakdown`. Each entry has the tax `amount`, whether it's `inclusive`, the `taxable_amount`, and `tax_rate_details`. Amounts are in the smallest currency unit, so `1999` is $19.99 USD. ```bash curl https://api.sandbox.pay.com/v1/checkout \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "mode": "payment", "customer_reference_id": "cust-jane-doe-001", "line_items": [{ "price": "prc_691180274607050752", "quantity": 1 }], "tax_options": { "tax_quote_data": { "tax_breakdown": [ { "amount": 170, "inclusive": false, "taxable_amount": 1999, "tax_rate_details": { "country": "US", "state": "NY", "tax_type": "sales_tax", "rate_type": "percentage", "percentage_decimal": "8.5" } } ] } } }' ``` ```json { "id": "cs_691220410429075456", "resource": "checkout_session", "mode": "payment", "status": "open", "url": "https://checkout.pay.com/a/Kc6tW2nRz9Fb", "amount": 2169, "currency": "usd", "tax": { "source": "merchant", "amount": 170 }, "seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" } } ``` ### Let Pay.com calculate [#let-paycom-calculate] Pay.com calculates the tax on your tax setup whenever you don't send figures. To get the figure before the sale, for example to show a total, create a [tax quote](/api-reference/endpoints/taxquotes/create-tax-quote) with [`POST /v1/tax_quotes`](/api-reference/endpoints/taxquotes/create-tax-quote), then pass its ID as `tax_options.tax_quote`. A quote is valid until its `expires` time. ```bash curl https://api.sandbox.pay.com/v1/tax_quotes \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "currency": "usd", "customer_reference_id": "cust-jane-doe-001", "customer_details": { "address": { "line1": "123 Main Street", "city": "San Francisco", "state": "CA", "postal_code": "94102", "country": "US" }, "address_source": "billing" }, "line_items": [ { "amount": 1999, "quantity": 1, "reference": "brand-kit", "tax_behavior": "exclusive" } ] }' ``` ```json { "id": "txq_691221545613258752", "resource": "tax_quote", "amount_total": 2169, "amount_total_human_readable": "21.69", "tax_amount_exclusive": 170, "tax_amount_inclusive": 0, "currency": "usd", "customer_reference_id": "cust-jane-doe-001", "line_items": [ { "id": "txq_li_691221545613258753", "resource": "tax_quote_line_item", "amount": 1999, "quantity": 1, "reference": "brand-kit", "tax_amount": 170, "tax_behavior": "exclusive" } ], "expires": "2026-11-25T11:30:00.000Z", "created": "2026-11-25T10:30:00.000Z", "test_mode": true } ``` ## When Pay.com sells [#when-paycom-sells] You can still send your figures. Pay.com calculates the tax on its own entity's tax account and charges its own figure. It keeps yours alongside it, in `tax.merchant_amount` and `tax.merchant_breakdown` on the order or invoice, and never charges them. Both are `null` unless Pay.com sells and you sent your own figures. Pay.com and its filing partners file and pay the returns. ## Your figures on renewals [#your-figures-on-renewals] When you sell a subscription with your own figures, Pay.com stores the rates from the first payment and applies them to each renewal. Each `tax_breakdown` entry on a subscription needs a `percentage_decimal` or a `flat_amount`, or the request returns `422` with `tax_rate_required`. To send figures for each renewal instead, set `subscription_options.tax_figures` to `per_invoice`. Pay.com then sends `invoice.drafted` for each renewal invoice and accepts your figures through [`POST /v1/invoices/{invoice_id}/tax`](/api-reference/commerce/invoices/send-invoice-tax) during a draft window (1 hour by default). If none arrive, the stored rates apply. When the customer's country or tax ID changes, or a price change takes effect, Pay.com sends `subscription.tax_inputs_changed` and keeps applying the stored rates until you send new ones. ## Invoices issued elsewhere [#invoices-issued-elsewhere] Pay.com doesn't calculate the tax on an invoice another system issues, such as an external subscription engine that issues its own. That system calculates the tax. See [One owner for each job](/commerce/choose-a-subscription-engine#one-owner-for-each-job). ## Where tax appears [#where-tax-appears] Tax appears in three places: * **At checkout**: the tax for the customer's country, and reverse charge for a valid tax ID when Pay.com calculates the tax. See [Currencies and tax at checkout](/commerce/currencies-and-tax-at-checkout). * **In Insights**: the tax calculated at checkout on your sales, for your top 10 countries. See [Insights and metrics](/commerce/insights-and-metrics). * **In reports**: tax by country and period, and by where the figures came from, your system or Pay.com's calculation. See [Reports and exports](/commerce/reports-and-exports). # Trials, plan changes, and canceling (/commerce/trials-plan-changes-and-canceling) Customers who know what they'll be charged, and when, trust you more and dispute less. Commerce's subscriptions start from defaults that keep customers informed, and you don't have to build any of them. ## Trials [#trials] Trials follow these rules: * A trial takes a payment method by default. You can turn that off. * Customers get a reminder 7 days before a trial or an introductory price ends. * Where it's required, the button that starts a trial says the customer will pay when it ends. A trial isn't in your MRR. It counts as a trial until its first paid period starts. ### Start a trial [#start-a-trial] Set `trial` in `subscription_options`, with `interval` and `interval_count`, or with `end_at`. To start a trial without a payment method, set `trial.payment_method_required` to `false`, and set `trial.missing_payment_method` to `cancel` or `pause` for when the trial ends with no method. The subscription starts as `trialing`, with the trial's end in `trial_end`, and nothing is due until the trial ends. Pay.com sends `subscription.trial_will_end` 7 days before the end, and `subscription.active` when the first payment succeeds. ```bash curl https://api.sandbox.pay.com/v1/subscriptions \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "customer_reference_id": "cust-jane-doe-001", "items": [{ "price": "prc_691180240037724160", "quantity": 1 }], "payment_method": "pm_card_684790996696828928", "subscription_options": { "trial": { "interval": "day", "interval_count": 14 } } }' ``` ```json { "id": "sub_691226648512843776", "resource": "subscription", "status": "trialing", "customer_reference_id": "cust-jane-doe-001", "payment_method": "pm_card_684790996696828928", "items": [ { "id": "subitem_691226648512843778", "price": "prc_691180240037724160", "price_version": 1, "quantity": 1 } ], "trial_end": "2026-12-09T10:30:00.000Z", "created": "2026-11-25T10:30:00.000Z" } ``` ## Renewals [#renewals] Customers get a reminder 7 days before a yearly renewal. Pay.com also sends you `subscription.upcoming_renewal` 7 days before each renewal. ## Plan changes [#plan-changes] Before a customer confirms a change of plan, they see its proration. To change a plan from your server, preview the change with [`POST /v1/subscriptions/{subscription_id}/previews`](/api-reference/commerce/subscriptions/create-subscription-preview) and show the customer what's due now and on the next invoice. Amounts are in the smallest currency unit, so `1500` is $15.00 USD. A preview lasts 15 minutes. ```bash curl https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928/previews \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "items": [{ "price": "prc_691180262046953472", "quantity": 1 }], "proration": "prorate_now" }' ``` ```json { "id": "subprv_691255520390475776", "resource": "subscription_preview", "subscription": "sub_684790996696828928", "lines": [ { "description": "Unused time on Pro plan", "amount": -1000, "proration": true }, { "description": "Remaining time on Business plan", "amount": 2500, "proration": true } ], "due_now": { "amount": 1500, "currency": "usd" }, "next_invoice": { "amount": 4999, "currency": "usd", "due_on": "2026-12-25" }, "expires_at": "2026-12-10T10:45:00.000Z" } ``` When the customer confirms, apply the preview: ```bash curl -X PATCH https://api.sandbox.pay.com/v1/subscriptions/sub_684790996696828928 \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "preview": "subprv_691255520390475776" }' ``` The change applies exactly as previewed, and Pay.com sends `subscription.updated`. If the subscription, its prices, or its tax inputs changed after the preview, the request returns `409` with `preview_stale`, so create a new preview. See [Preview a change of plan or quantity](/api-reference/commerce/subscriptions/create-subscription-preview). ## Canceling [#canceling] Canceling follows these rules: * Customers cancel online in the [customer portal](/commerce/customer-portal), and the cancellation takes effect at the end of the period. * The customer keeps access until the cancellation takes effect. * The last day to cancel before the next charge is shown, and the subscription returns it in `next_payment.cancel_by`. From your server, cancel at the end of the period or on any later date with [`POST /v1/subscriptions/{subscription_id}/cancel`](/api-reference/commerce/subscriptions/cancel-subscription) and an optional `cancel_at`. See [Cancel a subscription](/commerce/manage-subscriptions#cancel-a-subscription). In your reports, churn counts when access ends, and a cancellation scheduled for the end of the period appears as a scheduled cancellation until then. ## Withdrawal [#withdrawal] Where the law needs one, customers get a withdrawal button, with a confirm step and a receipt. Withdrawing ends the subscription immediately, and Pay.com never charges anything owed automatically. When a customer withdraws through you, send [`POST /v1/subscriptions/{subscription_id}/withdraw`](/api-reference/commerce/subscriptions/withdraw-subscription) with `sent_at`, the time they sent it. The subscription ends with `cancellation_reason` set to `withdrawn`, and returns `withdrawal_charge` and `refund_due_by`. After `withdrawal_ends_at`, the request returns `422` with `withdrawal_period_ended`. # Unity (/commerce/unity) Sell from your Unity game on every platform you ship to, with one package. The Unity package wraps the same native core as the iOS and Android SDKs, so your game gets the same link-out, drop-in, and store rules as native apps. ## Where it runs [#where-it-runs] How checkout opens depends on the platform: | Platform | How checkout opens | | ------------------- | -------------------------------------------------------------------------- | | **iOS and Android** | Link-out to the browser or native drop-in through the iOS and Android SDKs | | **WebGL** | In the browser the game runs in | | **PC** | In the browser | ## The pre-payment hook on Android [#the-pre-payment-hook-on-android] On Android, the pre-payment hook works only with Unity's GameActivity entry point. The classic activity pauses the player while the payment sheet is open, so the drop-in rejects that hook immediately under the classic activity. ## Store rules [#store-rules] The same store rules apply as in native apps, and Pay.com can report link-out sales to Apple and Google for you if you opt in. See [Store rules and reporting to the stores](/commerce/store-rules). ## Your server's part [#your-servers-part] Your game's server creates the checkout session the same way as a mobile app server and grants purchased items from the payment webhook. See [Create the session for a link-out](/commerce/sell-from-your-app#create-the-session-for-a-link-out). # Bulk queries (/data/bulk-queries) The list endpoints return your transactions in pages, oldest first. Use them to back-fill a data store, to find transactions, and to check your copy against Pay.com's. ## Choose a source [#choose-a-source] Bulk queries are one of four ways to get your transaction data. | You want | Use | | :------------------------------------------------------------------ | :-------------------------------------------------------------------- | | Each transaction and change as it happens | [Webhooks](/data/reporting/webhooks) | | The transactions in a time window, or the ones that match a filter | Bulk queries, on this page | | One file a day, for your finance team or data warehouse | [Daily reports](/data/reporting/daily-reports) | | Cleared transactions with their fees, by settlement or clearing day | [Reconcile transactions](/data/reconciliation/reconcile-transactions) | ## List endpoints [#list-endpoints] Every list takes the `created.*` filters, `limit`, and the cursors `starting_after` and `ending_before`. These lists also take their own filters: | List | Endpoint | Other filters | | :--------------------- | :-------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Charges | [`GET /v1/charges`](/api-reference/endpoints/charges/get-charges) | `customer_reference_id`, `id`, `currency`, `created`, `amount` and `amount.*`, `payment_method_details.card.bin` and `.last_four_digits`, `underlying_network_details.auth_code` and `.arn` | | Holds | [`GET /v1/holds`](/api-reference/endpoints/holds/get-holds) | `customer_reference_id`, `status` | | Refunds | [`GET /v1/refunds`](/api-reference/endpoints/refunds/get-refunds-bulk) | `customer_reference_id` | | Payouts | [`GET /v1/payouts`](/api-reference/endpoints/payouts/get-payouts-bulk) | `customer_reference_id` | | Cash flow transactions | [`GET /v1/cashflow/transactions`](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk) | `customer_reference_id`, `settlement_id` | | Payment sessions | [`GET /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/list-payment-sessions) | `customer_reference_id` | | Disputes | [`GET /v1/disputes`](/api-reference/endpoints/disputes/list-disputes) | None | | Fraud warnings | [`GET /v1/fraud_warnings`](/api-reference/endpoints/fraudwarnings/list-fraud-warnings) | `customer_reference_id` | | Settlements | [`GET /v1/settlements`](/api-reference/endpoints/settlements/list-settlements) | None | Each filter matches the whole value. See [Pagination and filtering](/developer-resources/pagination-and-filtering) for the filters, and for the lists that use page numbers. ## What a list returns [#what-a-list-returns] A list returns each object as it stands when you query it, in a shorter form than a retrieve by ID: * **Charges:** no refunds, so `refunds.data` is empty, `amount_refunded` is `0`, and `refunded` is `false`. No retry attempts. Captures of holds are listed as charges. * **Holds:** no captures in `charges.data`, and no retry attempts. * **Disputes:** `reason_code`, `arn`, and `processor_dispute_id` are `null`, and there's no evidence. Retrieve an object by its ID for its full details, for example with [`GET /v1/charges/{charge_id}`](/api-reference/endpoints/charges/get-charge). ## Page through a list [#page-through-a-list] Pass the last ID of a page as `starting_after` to get the next page, and stop when `has_more` is `false`. `limit` is `10` by default, and up to `100`. This function lists every charge created in a time window, and waits after a `429`: ```js const BASE_URL = 'https://api.sandbox.pay.com/v1'; // Basic auth: an empty username, then ":", then the key, in base64. const AUTH = `Basic ${Buffer.from(`:${process.env.PAY_COM_API_KEY}`).toString('base64')}`; async function listCharges(from, to) { const charges = []; let startingAfter; for (;;) { const params = new URLSearchParams({ 'created.greater_than_or_equals': from, 'created.less_than': to, limit: '100', }); if (startingAfter) params.set('starting_after', startingAfter); const response = await fetch(`${BASE_URL}/charges?${params}`, { headers: { Authorization: AUTH }, }); if (response.status === 429) { // Another list query is running. Wait, then ask for the same page again. const seconds = Number(response.headers.get('retry-after') ?? 1); await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); continue; } if (!response.ok) throw new Error(`GET /v1/charges returned ${response.status}`); const page = await response.json(); charges.push(...page.data); if (!page.has_more) return charges; startingAfter = page.data.at(-1).id; } } const charges = await listCharges('2026-03-06T00:00:00Z', '2026-03-07T00:00:00Z'); ``` ## Limits [#limits] Bulk queries have these limits: | Limit | What happens | What to do | | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | | One query at a time | A list request while another list request for the same merchant is running returns `429` with `code: request_in_progress` and `Retry-After: 1`. The limit covers every list endpoint above, together. | Request pages one after another. After a `429`, wait the `Retry-After` seconds and send the request again. | | Page size | `limit` is at most `100`. | Page through with `starting_after`. | | Repeated queries | Pay.com keeps the response to a list query for 10 minutes. The same query in that time returns the same page, even if new transactions arrived. An identical query sent while the first is still running can return `408`. | Query a time window after it has ended. To read new transactions, change the window or the cursor. | | Turned off | On some accounts, Pay.com turns off bulk queries on charges, holds, refunds, payouts, and cash flow transactions. These lists then return `403` with the message `Bulk queries are disabled.` | Use webhooks and daily reports, or contact your Pay.com account team. | ## Keep a copy in sync [#keep-a-copy-in-sync] Objects change after they're created. A charge gets refunds, disputes, and its ARN at clearing, and a list by `created` shows those changes only when you query that window again. To keep a copy current: 1. Back-fill with a list for each past window, such as one day at a time. 2. Add a [webhook endpoint](/developer-resources/webhooks) for the events that change your objects, such as `charge.refunded`, `charge.updated`, the `dispute.*` events, and `cashflow_transaction.created`. See [Reporting webhooks](/data/reporting/webhooks). 3. Each day, list the previous day's window and compare it with your copy, to catch an event your endpoint missed. ## Find a transaction [#find-a-transaction] Filter charges by what you have, for example the card's BIN and last four digits from a customer's email: ```bash curl -G https://api.sandbox.pay.com/v1/charges \ -u ":$PAY_COM_API_KEY" \ --data-urlencode 'payment_method_details.card.bin=424242' \ --data-urlencode 'payment_method_details.card.last_four_digits=4242' \ --data-urlencode 'created.greater_than_or_equals=2026-03-01T00:00:00Z' ``` The `underlying_network_details.auth_code` and `underlying_network_details.arn` filters find a charge from the authorization code or ARN on a customer's bank statement. To find a charge by your own reference, use [`GET /v1/charges/reference/{reference_id}`](/api-reference/endpoints/charges/get-charge-by-reference). ## Next steps [#next-steps] * [Pagination and filtering](/developer-resources/pagination-and-filtering): Every filter, and the lists that use page numbers. * [Read transaction data](/data/transaction-data): The fields on each transaction, and when they're set. * [Reporting webhooks](/data/reporting/webhooks): The events that keep your copy current. # Data (/data) Pay.com records every transaction from authorization to the payout to your bank, across every acquirer and processor your payments go through. This section shows how to read that data and bring it into your own systems. ## Find the data you need [#find-the-data-you-need] Each question has a place in the API, the events, or the reports. | Question | Where to look | | :--------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | | Which acquirer and settlement account processed a payment? | `underlying_processing_details` on the charge. See [Where a transaction was processed](/data/transaction-data/processing-details). | | Was the payment retried, and why? | `retry_attempts` on the charge. See [Attempts and retries](/data/transaction-data/attempts-and-retries). | | What are its ARN, RRN, PAR, and authorization code? | `underlying_network_details` on the charge or refund. See [Network data](/data/transaction-data/network-data). | | Why was it declined? | `failure_code`, the network's raw response code, and the processor's own code. See [Failure codes](/data/transaction-data/failure-codes). | | What did it cost, and what did I receive? | The cash flow transaction, or the [transaction reconciliation report](/data/reporting/transaction-reconciliation-report) | | When will I be paid? | `available_on` on the cash flow transaction, and your [settlements](/data/reconciliation/settlements) | | What did yesterday's transactions add up to? | The [daily reports](/data/reporting/daily-reports) | | What's in a deposit to my bank? | The [settlement](/data/reconciliation/settlements) the deposit's reference names | ## How your data builds up [#how-your-data-builds-up] A payment's data arrives in stages. Each stage adds fields to its objects and sends events. 1. **Authorization.** The charge has its status, where it was processed, its retries, and the network's response. Pay.com sends `charge.succeeded` or `charge.failed`. 2. **Clearing.** The acquirer's clearing data confirms the transaction. Pay.com books the final fees, adds network data such as the ARN, and creates the cash flow transaction. It sends `cashflow_transaction.created`, and `charge.updated` when the ARN arrives. 3. **Reports.** Once the day's clearing data from all your providers is in, Pay.com generates the daily reports. 4. **Settlement.** On your schedule, Pay.com pays out the cleared transactions, sends `settlement.paid`, and generates the settlement report. ## Settlement accounts [#settlement-accounts] All payout data is scoped to a **settlement account**: an account with an acquirer or processor, in one settlement currency, with the prefix `sa_`. If you process transactions in more than one currency, you have a settlement account for each, with its own balance and settlements. See [Settlements](/data/reconciliation/settlements#settlement-accounts). ## Next steps [#next-steps] * [Read transaction data](/data/transaction-data): The fields that describe how a transaction was processed. * [Reporting](/data/reporting): Choose how to receive your data. * [Reconciliation](/data/reconciliation): Match cleared transactions and settlements to your records. # Changelog (/changelog) Track releases and documentation updates across Pay.com APIs, SDKs, and guides. ## November 2026 [#november-2026] ### The docs have a new structure [#the-docs-have-a-new-structure] The guides, API reference, and SDK references used to live in three separate trees. The guides are now organized into eight top-level areas at the top of every page, with references under **APIs & SDKs**: * [Get started](/get-started): Set up your account, environments, API keys, your first payment, testing, and going live. * [Payments](/payments): Accept payments on your website, mobile apps, or e-commerce store, manage saved cards, configure 3D Secure, wallets, network tokens, routing, and vault forwarding. * [Payouts](/payouts): Send money to recipients' cards, bank accounts, and wallets. * [Commerce](/commerce): Sell digital goods and subscriptions with Pay.com Commerce. * [Risk](/risk): Run risk assessments, manage reviews, respond to disputes and early fraud warnings, and configure rules. * [Data](/data): Track balances and cash flow, settlements, adjustments, reconciliation, and exchange rates. * [Connections](/payment-methods): Browse supported payment methods, payout methods, and providers. * [Developer resources](/developer-resources): Use server SDKs, the CLI, webhooks, authentication guides, idempotency, pagination, and AI tools. * **APIs & SDKs**: Open the [API reference](/api-reference/get-started), [Pay.com.js](/sdks/pay-com-js), [iOS](/sdks/ios), [Android](/sdks/android), and [React Native](/sdks/react-native) references. Your old links and bookmarks redirect to the new pages. ### Where to find things now [#where-to-find-things-now] Old sections moved to these pages. | Before | Now | | :------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Introduction | [Get started](/get-started) and [How Pay.com works](/get-started/how-pay-com-works) | | Choose your integration, and the SDK's integration modes | [Find your use case](/payments/find-your-use-case) | | Core concepts | [How Pay.com works](/get-started/how-pay-com-works), and the concepts in Payments, such as [Payment lifecycle](/payments/concepts/payment-lifecycle) | | Payment guides | [Payments](/payments) and [Payouts](/payouts) | | SDK setup | The guide for each way to integrate: [Universal checkout](/payments/universal-checkout), [Headless checkout](/payments/headless-checkout), [Hybrid checkout](/payments/hybrid-checkout), and [Tokenize a card](/payments/set-up-a-card/tokenize-a-card) | | SDK methods | The [Pay.com.js reference](/sdks/pay-com-js) | | "Customize the universal component" | [Customize the checkout](/payments/customize-the-checkout) | | Orchestration | [Routing](/payments/routing) | | Risk, disputes, and fraud | [Risk](/risk) | | Reporting and reconciliation | [Data](/data) | | Environments, in the API reference | [Environments](/get-started/environments) | | Testing cards, in the API reference | [Test cards](/get-started/test-your-integration/test-cards) | | HTTP response codes and failure codes | [Errors](/api-reference/get-started/errors) | | The docs MCP server | [Build with AI](/developer-resources/build-with-ai) | ### New pages [#new-pages] Get started includes three new pages. * [API keys](/get-started/api-keys): Create your sandbox and live keys and keep them safe. * [Test your integration](/get-started/test-your-integration): Test cards, simulate endpoints, and test webhooks in the sandbox. * [Go live](/get-started/go-live): Review what changes in the live environment and complete a checklist before your first live payment. # Build with AI (/developer-resources/build-with-ai) Pay.com provides an MCP (Model Context Protocol) server that lets AI coding tools search and read Pay.com documentation directly. Once connected, your AI assistant can answer questions about the API, SDKs, and payment flows using up-to-date content from this site. The MCP server is available at [`https://docs.pay.com/mcp`](https://docs.pay.com/mcp). ## Connect your tool [#connect-your-tool] Add `https://docs.pay.com/mcp` as an MCP server in your tool. Add the connector from [Connectors](https://claude.ai/settings/connectors) in your Claude settings: 1. Select **Add custom connector**. 2. Fill in the details: * **Name**: `Pay.com Docs` * **URL**: `https://docs.pay.com/mcp` 3. Select **Add**. With the connector added, open a new chat, select the attachments button (the plus icon), and select **Pay.com Docs**. Run the following command to add the MCP server: ```bash claude mcp add --transport http pay-com-docs https://docs.pay.com/mcp ``` Verify the connection by listing your configured servers: ```bash claude mcp list ``` See the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp#installing-mcp-servers) for more details. 1. Press `Cmd+Shift+P` (`Ctrl+Shift+P` on Windows) to open the command palette. 2. Search for "Open MCP settings" and select **Add custom MCP** to open the `mcp.json` file. 3. Add the following entry: ```json { "mcpServers": { "pay-com-docs": { "url": "https://docs.pay.com/mcp" } } } ``` In Cursor's chat, ask "What tools do you have available?" to confirm the connection. See [MCP in Cursor](https://docs.cursor.com/context/model-context-protocol) for more details. **VS Code** Create a `.vscode/mcp.json` file in your project and add: ```json { "servers": { "pay-com-docs": { "type": "http", "url": "https://docs.pay.com/mcp" } } } ``` See the [VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more details. **Windsurf** Create a `.windsurf/mcp.json` file in your project and add: ```json { "mcpServers": { "pay-com-docs": { "url": "https://docs.pay.com/mcp" } } } ``` ## Read the docs as Markdown [#read-the-docs-as-markdown] Every page of these docs is also available as Markdown. Add `.md` to its URL, for example `https://docs.pay.com/get-started/create-your-first-payment.md`. To give your assistant the whole site, use [`llms.txt`](/llms.txt), which lists every page with its description, or [`llms-full.txt`](/llms-full.txt), which has every page in one file. `llms-full.txt` gives a short version of each endpoint. For the whole request and response schema, add `.md` to that endpoint's URL. # Handle errors (/developer-resources/handle-errors) The API returns a `4xx` or `5xx` status and an `error` object when a request fails. A decline is one of these failures. The request worked, but the payment didn't. Decide in code what to do with each, and look up the codes themselves in [Errors](/api-reference/get-started/errors). ## Branch on status, type, and code [#branch-on-status-type-and-code] Read the HTTP status first, then `error.type` and `error.code`. Error messages are written for developers and can change without notice, so don't match on message text in code. | Status | `error.type` | `error.code` | What your code does | | :----------- | :---------------------- | :----------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `2xx` | None | None | Read the object's `status`. `pending` or `requires_authentication`, for example, means the payment isn't finished. | | `400` | `payment_method_error` | `card_declined` (see `decline_code`) | Handle the [decline](#handle-declines). | | `400` | `invalid_request_error` | `invalid_parameters`, `merchant_conflict`, and others | Fix the request. When present, `params` lists the fields that failed validation. | | `400` | `idempotency_error` | `invalid_parameters` | The idempotency key was used for another endpoint or request body. Send a new key with a new request. | | `401` | `invalid_request_error` | `invalid_key`, `invalid_token`, and others | Stop and check the API key and its target environment. | | `403` | `invalid_request_error` | `resource_not_allowed`, `network_not_allowed`, `merchant_required`, and others | Stop and update the key or request based on `error.code`. See [Manage API keys](/developer-resources/authentication/scoped-api-keys#errors). | | `404` | `invalid_request_error` | `resource_missing` | Check the ID and confirm it belongs to the same environment and workspace as the key. | | `408` | None | None | The request timed out before finishing. [Check whether the object was created](/developer-resources/idempotency-and-retries#find-out-what-was-created), or retry later with the same idempotency key. | | `409` | `idempotency_error` | `request_in_progress` | Wait, then [retry with the same key](/developer-resources/idempotency-and-retries#when-to-retry). | | `422` | `invalid_request_error` | Varies | The object or your account can't complete this operation in its current state. Retrieve the object before retrying. | | `429` | `invalid_request_error` | `request_in_progress` | Another bulk query is running. Wait for `Retry-After`, then [retry](/developer-resources/idempotency-and-retries#when-to-retry). | | `500` | `api_error` | Varies | [Check whether the object was created](/developer-resources/idempotency-and-retries#find-out-what-was-created) before sending the request again, and use a new key only if it wasn't. | | `502`, `504` | None | None | Gateway error or upstream timeout. Wait, then [retry with the same key and body](/developer-resources/idempotency-and-retries#when-to-retry). | | `503` | `api_error` | `unavailable` | Wait for `Retry-After` (or a few seconds if omitted), then [retry with the same key and body](/developer-resources/idempotency-and-retries#when-to-retry). | ## Handle declines [#handle-declines] A declined or blocked charge, hold, refund, or payout returns `400` with the type `payment_method_error`, and the object is still created: * The object's ID is in the field named after it: `charge`, `hold`, `refund`, or `payout`. Save it. Retrieve it to see whether its `status` is `failed` or `blocked`. * `decline_code` is the reason, and can be null. The [error codes](/api-reference/get-started/errors#error-codes) have a message for each that you can show the customer. * Retrying with the same idempotency key returns the same decline response. A new payment attempt (for example, with another card) requires a new idempotency key. ## Read errors safely [#read-errors-safely] These examples create a charge and read a decline or an error from the response. ```js export async function createCharge(charge, idempotencyKey) { const response = await fetch('https://api.sandbox.pay.com/v1/charges', { method: 'POST', headers: { Authorization: `Basic ${Buffer.from(`:${process.env.PAY_COM_API_KEY}`).toString('base64')}`, 'Content-Type': 'application/json', 'idempotency-key': idempotencyKey, }, body: JSON.stringify(charge), }); const text = await response.text(); let body = {}; try { body = JSON.parse(text); } catch {} if (response.ok) return { declined: false, id: body.id, status: body.status }; const error = body.error ?? body; if (error.type === 'payment_method_error') { return { declined: true, id: error.charge, reason: error.decline_code }; } const requestId = response.headers.get('x-paycom-request-id'); throw new Error(`Pay.com ${response.status} ${error.code ?? ''}: ${error.message ?? text} (request ${requestId})`); } ``` ```python import os import requests def create_charge(charge, idempotency_key): response = requests.post( "https://api.sandbox.pay.com/v1/charges", auth=("", os.environ["PAY_COM_API_KEY"]), headers={"idempotency-key": idempotency_key}, json=charge, timeout=60, ) try: body = response.json() except ValueError: body = {} if response.ok: return {"declined": False, "id": body["id"], "status": body["status"]} error = body.get("error", body) if error.get("type") == "payment_method_error": return {"declined": True, "id": error.get("charge"), "reason": error.get("decline_code")} request_id = response.headers.get("x-paycom-request-id") message = error.get("message", response.text) raise RuntimeError(f"Pay.com {response.status_code} {error.get('code', '')}: {message} (request {request_id})") ``` ## Log what support needs [#log-what-support-needs] Log the status, `type`, `code`, the object's ID, and the `x-paycom-request-id` response header. That header identifies the request in Pay.com. The header is absent if the request was rejected before reaching the API (for example, due to an unknown key or malformed JSON). Never log the key, the `Authorization` header, or card details. # Idempotency and retries (/developer-resources/idempotency-and-retries) The Pay.com API supports idempotency, so you can retry a request that may already have worked. This is useful when a request fails in transit and you don't receive a response. For example, if a request to create a charge fails due to a network error, retry it with the same idempotency key. Pay.com returns the saved response rather than creating another charge. ## How it works [#how-it-works] When you make a request with an idempotency key, Pay.com reserves the key and, once the request is processed, saves the response (status code and body). After that, a request with the same key returns the saved response instead of running the operation again, whether the original request succeeded or failed. * Pay.com honors the `idempotency-key` header on `POST` and `DELETE` requests. Use a key on every `POST` that creates or changes something. * The header is ignored on `GET`, `PATCH`, and `PUT` requests. Retrying a `PATCH` or `PUT` is not protected by a key. * Keys are scoped to your merchant account, so they can't collide with another merchant's keys. * Keys expire 24 hours after they are stored. For charges, holds, refunds, and payouts, set your own `reference` as well. It helps you [find out what was created](#find-out-what-was-created) if a request times out or receives no response. ## Sending an idempotency key [#sending-an-idempotency-key] Pass a unique value in the `idempotency-key` HTTP header. Amounts are integers in minor units (for example, `8000` is $80.00 USD). ```bash curl -X POST https://api.sandbox.pay.com/v1/charges \ -u ':sk-pay-com-sandbox-…' \ --header 'idempotency-key: a0e4c2f1-8b3d-4f7a-9c1e-2d5b6a7f8e9c' \ --header 'Content-Type: application/json' \ --data '{ "amount": 8000, "currency": "usd", "source": "pm_card_685125127054035968" }' ``` The response echoes the key in an `Idempotency-Key` header. Generate a unique value on your client side for each new request. We recommend V4 UUIDs. ## Retry behavior [#retry-behavior] Pay.com stores the response of most requests that reach processing, including payment declines and most errors. A retry with the same key, sent to the same endpoint with the same body, gets that stored response: | Original request | Retry with the same key | | :------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------- | | Succeeded (`2xx`) | Returns the same successful response. | | Failed during processing, for example a decline (`400 payment_method_error`) or most server errors (`5xx`) | Returns the same error. | | Still processing | Returns `409` with `type: idempotency_error` and `code: request_in_progress`. Wait, then retry with the same key. | | Rejected before the key was reserved (invalid JSON, a body over 1 MB, or an invalid or unauthorized API key returning `401` or `403`) | Nothing is saved. Fix the cause, and the same idempotency key works. | If you reuse a key on a different endpoint, or with a different request body, Pay.com returns HTTP `400` with `type: idempotency_error` and `code: invalid_parameters`, because the key is already bound to another request. A retry must send the same body to the same endpoint. ## When to retry [#when-to-retry] Retry requests when the outcome is unknown or when the API instructs you to wait. Use exponential backoff between attempts and cap the total number of retries. | What you got | What to do | | :-------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | No response (timeout, `408`, or dropped connection) | Wait. For a charge, hold, refund, or payout, [check whether the object was created](#find-out-what-was-created). If nothing was created, retry with the same key and body. | | `409 request_in_progress` | Wait, then retry with the same key. | | `429` or `503` | Wait for the seconds in `Retry-After`, or a few seconds when there's none, then retry with the same key and body. | | `502` or `504` | Wait, then retry with the same key and body. | | `500` | Retrying with the same key typically returns the cached error. [Check whether the object was created](#find-out-what-was-created), and send a new request with a new key only if it wasn't. | | Any other `4xx`, declines included | Don't retry as it is. Fix the request, or ask for another payment method, and send it with a new key. | A key doesn't protect `PUT` and `PATCH`. Retrieve the object before you repeat one, as the change may already be made. `GET` requests are safe to repeat, except [Retrieve a network token cryptogram](/api-reference/endpoints/networktokens/retrieve-payment-method-network-token-cryptogram), which makes a new cryptogram on each call. ### Find out what was created [#find-out-what-was-created] If a request receives no response, you don't receive an object ID. Look up the `reference` value you passed in the request instead: * List the [charges](/api-reference/endpoints/charges/get-charges), [holds](/api-reference/endpoints/holds/get-holds), [refunds](/api-reference/endpoints/refunds/get-refunds-bulk), or [payouts](/api-reference/endpoints/payouts/get-payouts-bulk) created since you first sent it. * Check your [webhook events](/api-reference/webhooks/webhook-events). The object in `data` has its reference. * Look it up by the reference you set: [charges](/api-reference/endpoints/charges/get-charge-by-reference), [holds](/api-reference/endpoints/holds/get-hold-by-reference), [refunds](/api-reference/endpoints/refunds/get-refund-by-reference), and [payouts](/api-reference/endpoints/payouts/get-payout-by-reference). ## Key expiration [#key-expiration] Idempotency keys are stored for 24 hours. After that, using the same key starts a new request rather than returning the saved response. Make sure your retry logic sends retries within 24 hours of the original request. # Developer resources (/developer-resources) Every product uses the same API, keys, and webhooks. Start with [authentication](/developer-resources/authentication), then learn how to retry requests and handle what comes back. ## Start integrating [#start-integrating] Find guides for the behavior every endpoint shares, and tools for exploring the API. ## References [#references] Look up the details of each endpoint and each Pay.com.js method. # Pagination and filtering (/developer-resources/pagination-and-filtering) Pay.com supports bulk requests of certain resources. You query these resources by sending a `GET` request to each resource's endpoint. Each request accepts query parameters to filter and paginate the search results. The endpoints below use cursor-based pagination. Four additional endpoints use [page-number pagination](#lists-that-use-page-numbers). | Resource | Endpoint | | ---------------------- | --------------------------------------------------------------------------------------------------- | | Charges | [GET /v1/charges](/api-reference/endpoints/charges/get-charges) | | Holds | [GET /v1/holds](/api-reference/endpoints/holds/get-holds) | | Refunds | [GET /v1/refunds](/api-reference/endpoints/refunds/get-refunds-bulk) | | Disputes | [GET /v1/disputes](/api-reference/endpoints/disputes/list-disputes) | | Payouts | [GET /v1/payouts](/api-reference/endpoints/payouts/get-payouts-bulk) | | Payment sessions | [GET /v1/sessions/payment](/api-reference/endpoints/paymentsessions/list-payment-sessions) | | Cash flow transactions | [GET /v1/cashflow/transactions](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk) | | Settlements | [GET /v1/settlements](/api-reference/endpoints/settlements/list-settlements) | | Fraud warnings | [GET /v1/fraud\_warnings](/api-reference/endpoints/fraudwarnings/list-fraud-warnings) | | Collaborations | [GET /v1/collaborations](/api-reference/endpoints/collaborations/get-collaborations-bulk) | | Value list items | [GET /v1/value\_lists/\{list\_id}/items](/api-reference/endpoints/valuelists/list-value-list-items) | ## Results filtering [#results-filtering] All bulk endpoints accept the `created.*` date filters and cursor pagination. `customer_reference_id` filters charges, holds, refunds, payouts, payment sessions, fraud warnings, and cash flow transactions. Disputes reject it with `400`. Some endpoints add their own filters, for example `status` on holds and `settlement_id` on cash flow transactions. See each endpoint's reference page for its full list. See [Pagination](#pagination) for result limits. Filter the results based on the creation date, using the `created` query parameter with comparison operators. | Parameter | Description | | :------------------------------- | :------------------------------------------------------ | | `created.greater_than` | Returns results created after the specified date | | `created.greater_than_or_equals` | Returns results created on or after the specified date | | `created.less_than` | Returns results created before the specified date | | `created.less_than_or_equals` | Returns results created on or before the specified date | `greater_than` and `greater_than_or_equals` are mutually exclusive, as are `less_than` and `less_than_or_equals`. **Example** This request returns refunds created in January 2025. ```bash curl -X GET \ 'https://api.sandbox.pay.com/v1/refunds?created.greater_than_or_equals=2025-01-01&created.less_than=2025-02-01' \ -u ':sk-pay-com-sandbox-…' ``` ```json { "resource": "refunds", "has_more": false, "data": [ { "id": "rfnd_685125114794084352", "created": "2025-01-15T10:30:00Z" }, { "id": "rfnd_685125114794084399", "created": "2025-01-16T14:22:00Z" } ] } ``` Add `customer_reference_id` (your own identifier for the customer) as a query parameter to return results for only that customer. **Example** ```bash curl -X GET 'https://api.sandbox.pay.com/v1/refunds?customer_reference_id=customer-12345' \ -u ':sk-pay-com-sandbox-…' ``` ```json { "resource": "refunds", "has_more": false, "data": [ { "id": "rfnd_685125114794084352" } ] } ``` ## Pagination [#pagination] Bulk endpoints use cursor-based pagination and return results oldest first. Each response includes a `has_more` field that tells you whether more results exist beyond the current page. | Parameter | Type | Description | | :--------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `limit` | integer | Maximum number of results to return. Default: `10`, maximum: `100`. | | `starting_after` | string | Returns results created after the given resource ID. Use the ID of the last object from the previous page to fetch the next page. The ID must be of the resource you are listing (for example, `rfnd_…` for refunds), or the request returns `400`. | | `ending_before` | string | Returns results created before the given resource ID. Use this to paginate backwards. | `starting_after` and `ending_before` are mutually exclusive. You can't use both in the same request. Cursor-based pagination is stable under concurrent writes. Unlike offset-based pagination, adding or removing records between requests won't cause you to skip or duplicate results. Run one bulk query at a time. A query while another one for the same merchant is running returns `429` with `code: request_in_progress` and a `Retry-After` header. The same query within 10 minutes returns the same page. On accounts where Pay.com turns off bulk queries, the charges, holds, refunds, payouts, and cash flow transactions lists return `403`. See [Bulk queries](/data/bulk-queries#limits). ### Paginate through results [#paginate-through-results] To retrieve all results, repeat requests using `starting_after` until `has_more` is `false`. ```bash curl -X GET 'https://api.sandbox.pay.com/v1/refunds?limit=25' \ -u ':sk-pay-com-sandbox-…' ``` ```json { "resource": "refunds", "has_more": true, "data": [ { "id": "rfnd_685125114794084352" }, { "id": "rfnd_685125114794084399" } ] } ``` To fetch the next page, pass the last object's ID as `starting_after`: ```bash curl -X GET 'https://api.sandbox.pay.com/v1/refunds?limit=25&starting_after=rfnd_685125114794084399' \ -u ':sk-pay-com-sandbox-…' ``` Continue until `has_more` is `false`. ## Lists that use page numbers [#lists-that-use-page-numbers] These lists take `page` and `limit` in place of cursors, and their own filters. They don't accept `starting_after` or `ending_before`. | Resource | Endpoint | Filters | | :-------------------------- | :-------------------------------------------------------------------------------------------------------------- | :---------------------------------------------- | | Adjustments | [GET /v1/adjustments](/api-reference/endpoints/adjustments/list-adjustments) | `settlement_id` | | Value lists | [GET /v1/value\_lists](/api-reference/endpoints/valuelists/list-value-lists) | `from_date`, `to_date` | | Card blacklist | [GET /v1/value\_lists/card\_blacklist](/api-reference/endpoints/valuelists/get-card-blacklist) | None | | Reconciliation transactions | [GET /v1/reconciliation/transactions](/api-reference/endpoints/reconciliation/list-reconciliation-transactions) | `settlement_id`, `date`, `from_date`, `to_date` | `page` starts at `1`. `limit` defaults to `10`, and you can set it up to `100`. Each response has `page`, `total_pages`, `total_records`, and `last_page`, which is `true` on the last page. ## Response structure [#response-structure] All bulk endpoints return a consistent response shape. Amounts are integers in the minor currency unit (the smallest unit), for example `10000` for $100.00. | Field | Type | Description | | :--------- | :------ | :--------------------------------------------------------------------- | | `resource` | string | The type of resource returned, for example `"refunds"` or `"payouts"`. | | `has_more` | boolean | `true` if more results exist beyond this page. | | `data` | array | The list of resource objects. | ```json { "resource": "refunds", "has_more": true, "data": [ { "id": "rfnd_296645958265997314", "resource": "refund", "amount": 10000, "amount_human_readable": "100.00", "charge": "chrg_296645958265997312", "created": "2025-01-15T10:30:00Z", "currency": "usd", "status": "succeeded" }, { "id": "rfnd_296645958265997422", "resource": "refund", "amount": 5000, "amount_human_readable": "50.00", "charge": "chrg_296645958265997418", "created": "2025-01-16T14:22:00Z", "currency": "usd", "status": "succeeded" } ] } ``` # Postman collections (/developer-resources/postman-collections) Import Pay.com's official [Postman](https://www.postman.com/) collections to explore and test API endpoints without writing code. ## Choose a collection [#choose-a-collection] Select the collection that matches how you want to test: Every Pay.com REST endpoint in Postman format. Right-click the API reference collection and select **Save Link As** to download it. Pre-built request sequences for common workflows, such as charges, refunds, holds, subscriptions, and more, with realistic test payloads and saved example responses. Right-click the Curated flows collection and select **Save Link As** to download it. ## Import into Postman [#import-into-postman] You can use either the Postman desktop app or the web app: 1. Open Postman and select **Import**. 2. Drag the downloaded JSON file into the dialog, or select **Upload Files**. 3. Select **Import** to add the collection to your **Collections** sidebar. ## Configure collection variables [#configure-collection-variables] Set the base URL and API key variables before sending requests (both collections use the same variable names): 1. Select the collection in the sidebar to open its overview. 2. Open the **Variables** tab and set: | Variable | Value | | -------------- | ----------------------------------------- | | `pay_base_url` | `https://api.sandbox.pay.com/v1` | | `pay_api_key` | Your sandbox key (`sk-pay-com-sandbox-…`) | 3. Select **Save**. Both collections send `pay_api_key` with HTTP Basic auth, as the password with an empty username. Create your key under **Developers** → **API keys** in the Pay.com dashboard. Use a sandbox key while testing. Never paste a live key into shared Postman workspaces or version-controlled environments. ## Make requests [#make-requests] Open any request in the collection and select **Send**. In Curated flows, most requests have saved example responses, so you can preview what to expect before you send them. # Upload and download files (/developer-resources/upload-and-download-files) Documents are the files you submit as dispute evidence. You create a document with the file's name and exact size, upload the file to it, and use it once it has been scanned. Your key needs Write on **Documents**. ## Upload and download a document [#upload-and-download-a-document] Create a document record, upload the binary file, wait for virus scanning to complete, and download the active file. ### Create the document [#create-the-document] `content_length` is the file's size in bytes. The upload must be exactly that size. ```bash SIZE=$(wc -c < receipt.pdf | tr -d ' ') curl https://api.sandbox.pay.com/v1/documents \ -u ":$PAY_COM_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "filename": "receipt.pdf", "reference": "order_12345", "content_type": "application/pdf", "content_length": '"$SIZE"' }' ``` The response has the document's `id`, with the status `created`. See [Create a document](/api-reference/endpoints/documents/create-document). ### Upload the file [#upload-the-file] Send the file as the request body, without multipart or JSON around it, with the file's own `Content-Type`. That type replaces the `content_type` you gave when you created the document. ```bash curl https://api.sandbox.pay.com/v1/documents/$DOCUMENT_ID/upload \ -u ":$PAY_COM_API_KEY" \ -H 'Content-Type: application/pdf' \ --data-binary @receipt.pdf ``` A successful upload returns `204` with no body. Use `--data-binary`, because curl's `-d` strips line breaks from a file, which corrupts it. See [Upload document contents](/api-reference/endpoints/documents/upload-document) for samples in each language. ### Wait for the scan [#wait-for-the-scan] The document is `pending` while it's scanned, then `active` or `rejected`. Listen for `document.active` and `document.rejected` [webhooks](/developer-resources/webhooks), or retrieve the document until its status changes. ```bash curl https://api.sandbox.pay.com/v1/documents/$DOCUMENT_ID \ -u ":$PAY_COM_API_KEY" ``` ### Download the file [#download-the-file] Only an `active` document has contents to download. Before that, the request returns `404`. The response is the file itself, with its `Content-Type`. ```bash curl https://api.sandbox.pay.com/v1/documents/$DOCUMENT_ID/contents \ -u ":$PAY_COM_API_KEY" \ --fail --output document.pdf ``` ## Limits [#limits] Uploads have a size limit, and documents used as dispute evidence have lower limits. | Limit | Value | | :--------------------------------------- | :------------------------------------------------------------------- | | Upload size | 50 MB. Files over 50 MB return HTTP `413`. | | Size that doesn't match `content_length` | Rejected by the API. Create a new document with the exact byte size. | | A document used as dispute evidence | 10 MB and 50 pages by default. Some processors allow less. | When the document is `active`, send its ID to [Submit dispute evidence](/api-reference/endpoints/disputes/submit-dispute-evidence). ## Next steps [#next-steps] * [Create a document](/api-reference/endpoints/documents/create-document): full request and response schema for document creation. * [Submit dispute evidence](/api-reference/endpoints/disputes/submit-dispute-evidence): attach an `active` document to a dispute. * [Webhooks](/developer-resources/webhooks): listen for `document.active` and `document.rejected` events. # Webhooks (/developer-resources/webhooks) Webhooks let Pay.com notify your backend systems about events as they happen, without your server having to poll the API. When something changes in your account (a charge succeeds, a refund is processed, or a payout completes), Pay.com sends an HTTP `POST` request with a JSON payload to a URL you configure. ## When webhooks are required [#when-webhooks-are-required] Webhooks are useful for logging all activity, but they are required for certain asynchronous payment flows: * **3D Secure with `confirm: true`:** When you configure a server-to-server 3DS flow with automatic authorization, the charge is authorized before the customer is redirected back to your site. A dropped network connection can prevent the redirect from completing, so you must listen for the `charge.succeeded` webhook to finalize the order. * **ACH direct debits:** These payment methods don't clear immediately. The API creates a charge with `pending` status, and the final outcome is delivered only via webhook once the banking network updates Pay.com. * **Bank transfer payouts:** Payouts start as `pending`, and the final `payout.succeeded` or `payout.failed` event arrives asynchronously. Always verify the signature of every webhook event before processing it. This confirms the event genuinely came from Pay.com and not a third party. ## Set up an endpoint in the dashboard [#set-up-a-webhook-endpoint] Create the endpoint in the Pay.com dashboard, then copy its signing secret. You can also [set up an endpoint with the API](#set-up-an-endpoint-with-the-api). ### Access the dashboard [#access-the-dashboard] Log in to your Pay.com dashboard. In the left sidebar, click **Developers**, then select **Webhooks**. This page lists all existing webhook endpoints configured for your account. ### Create a new webhook [#create-a-new-webhook] Click **+ Add Webhook**. You are redirected to the **Webhook Management** page. Webhook Management page in the Pay.com dashboard Fill in the following fields: * **Webhook Name**: a label to identify this endpoint in the dashboard. * **Endpoint URL**: the public URL on your server that receives the `POST` requests. * **Events to send**: choose **All events** to receive every notification, or select individual event types to limit the webhook to a specific use case. To get an endpoint running locally, paste this minimal endpoint into a new file. It implements every step in [Verify webhook signatures](#verify-webhook-signatures): ```js // server.js // 1) Install dependencies: npm install express // 2) Run: node server.js const express = require('express') const crypto = require('crypto') const app = express() // Your endpoint's signing secret, from your server's environment. const webhookSecret = process.env.PAY_COM_WEBHOOK_SECRET if (!webhookSecret?.trim()) throw new Error('Set PAY_COM_WEBHOOK_SECRET') // express.raw keeps the body as the exact bytes Pay.com sent, up to 5 MB. app.post('/webhook', express.raw({ type: 'application/json', limit: '5mb' }), (req, res) => { const header = req.headers['pay-signature'] if (!header) return res.status(400).send('Missing Pay-Signature header') if (!Buffer.isBuffer(req.body)) return res.status(400).send('Expected a JSON body') let timestamp const signatures = [] for (const element of header.split(',')) { const [prefix, value] = element.split('=', 2) if (prefix === 't') timestamp = value else if (prefix === 'v1' && value) signatures.push(value) } if (!timestamp || signatures.length === 0) return res.status(400).send('Malformed Pay-Signature header') const expected = Buffer.from( crypto.createHmac('sha256', webhookSecret).update(`${timestamp}.`).update(req.body).digest('hex'), 'utf8', ) const signatureMatches = signatures.some((signature) => { const received = Buffer.from(signature, 'utf8') return received.length === expected.length && crypto.timingSafeEqual(expected, received) }) if (!signatureMatches) return res.status(400).send('Invalid webhook signature') const event = JSON.parse(req.body.toString('utf8')) // Pay.com can send an event more than once: skip one whose event.id you've already handled. // Then handle it, for example by event.type. // Return a 200 response to acknowledge receipt of the event. res.status(200).send() }) app.listen(4242, () => console.log('Running on port 4242')) ``` When you're done, click **Save changes** to create the webhook. ### Copy your signing secret [#copy-your-signing-secret] After saving, you are redirected back to the **Webhooks** list. Click the webhook you created to open its detail page. Here you can reveal and copy the **signing secret** for this endpoint. You use this secret to verify the signature of every incoming event. You can also edit, disable, or delete the webhook from this page. A signing secret starts with `whsec-pay-com-live-`, or with `whsec-pay-com-sandbox-` in the sandbox. An endpoint made before secrets had a prefix keeps its UUID secret until you roll it. Store the signing secret securely and never expose it in client-side code or public repositories. ## Set up an endpoint with the API [#set-up-an-endpoint-with-the-api] [`POST /v1/webhook_endpoints`](/api-reference/endpoints/webhookendpoints/create-webhook-endpoint) creates an endpoint: * `url` is the public URL on your server that receives the events. It must use `https`. * `event_types` lists the events to send, at least one. * `name` is optional, and defaults to `API`. An API key can subscribe an endpoint only to events about resources it can read. Asking for any other event returns `403` with `event_type_not_allowed`. The response is the only one that carries the endpoint's signing secret, in `secret`, so store it then. Listing or retrieving endpoints never returns it. You can reveal it on the endpoint's page in the dashboard. ## Monitor webhook deliveries [#monitor-webhook-deliveries] Select any webhook from the **Developers** → **Webhooks** page to view its delivery log. For each event you can inspect: * The event status and HTTP status code. * The event ID and when it was created. * The full request payload Pay.com sent. * The response your server returned. * Details about the next retry attempt if the previous delivery failed. If your server misses an event, you can manually resend it from this view. Pay.com retries failed deliveries every 15 minutes for up to 24 hours. Retries stop as soon as your server returns a `2xx` response. ## Verify webhook signatures [#verify-webhook-signatures] Pay.com signs every webhook event with an HMAC-SHA256 signature and includes it in the `Pay-Signature` HTTP header. Verifying this signature confirms that the event came from Pay.com and has not been tampered with. The `Pay-Signature` header contains a timestamp (prefixed by `t=`), which is when Pay.com signed the request, in milliseconds since the Unix epoch. Then it has a signature (prefixed by `v1=`). For example: ``` Pay-Signature: t=1790928292249,v1=1aeb7cc4bf7a95b9dc91e7b72c5f675f5364cba3fc33f6444015f8195fdc7624 ``` The header can carry more than one `v1` signature. Accept the event if any of them matches. ### Extract the timestamp and signatures [#extract-the-timestamp-and-signatures] Split the `Pay-Signature` header value on the `,` character to get a list of elements. Then split each element on the first `=` to separate the prefix from the value. Reject the request if the header, `t`, or `v1` is missing. * The value for prefix `t` is the timestamp. * Each value for prefix `v1` is a signature. Keep all of them. Ignore any other prefixes to prevent downgrade attacks. ```js const header = req.headers['pay-signature'] ?? ''; let timestamp; const signatures = []; for (const element of header.split(',')) { const [prefix, value] = element.split('=', 2); if (prefix === 't') timestamp = value; else if (prefix === 'v1' && value) signatures.push(value); } ``` ```python header = request.headers.get("Pay-Signature", "") timestamp = None signatures = [] for element in header.split(","): prefix, _, value = element.partition("=") if prefix == "t": timestamp = value elif prefix == "v1": signatures.append(value) ``` ```go header := r.Header.Get("Pay-Signature") var timestamp string var signatures []string for _, element := range strings.Split(header, ",") { prefix, value, found := strings.Cut(element, "=") if !found { continue } switch prefix { case "t": timestamp = value case "v1": signatures = append(signatures, value) } } ``` ### Build the signed payload string [#build-the-signed-payload-string] Construct the payload that Pay.com signed (`t.payload`) by concatenating: 1. The timestamp (as a string). 2. A literal `.` character. 3. The raw JSON request body, exactly as received and before any parsing. Read it as bytes (for example with `express.raw()` in Express or `request.get_data()` in Flask) and don't decode it. Anyone can send to your URL, so cap the body's size, at 5 MB for example. ```js // rawBody is the Buffer from express.raw() const signedPayload = Buffer.concat([Buffer.from(`${timestamp}.`), rawBody]); ``` ```python # Flask: request.get_data() returns the raw body as bytes raw_body = request.get_data() signed_payload = f"{timestamp}.".encode("utf-8") + raw_body ``` ```go signedPayload := timestamp + "." + string(rawBody) ``` Use the raw request body, not a re-serialized version. Parsing and re-serializing JSON can change whitespace or key ordering, which causes signature verification to fail. ### Compute the expected signature [#compute-the-expected-signature] Using your endpoint's whole signing secret as the key, prefix included, compute an HMAC with the SHA-256 hash function over the signed payload. Refuse to verify if the secret is missing or blank, because anyone can sign with a blank key. ```js const crypto = require('crypto'); if (!YOUR_SIGNING_SECRET?.trim()) throw new Error('Missing signing secret'); const expectedSignature = crypto .createHmac('sha256', YOUR_SIGNING_SECRET) .update(signedPayload) .digest('hex'); ``` ```python import hmac import hashlib if not (YOUR_SIGNING_SECRET or "").strip(): raise RuntimeError("Missing signing secret") expected_signature = hmac.new( key=YOUR_SIGNING_SECRET.encode("utf-8"), msg=signed_payload, digestmod=hashlib.sha256 ).hexdigest() ``` ```go import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "net/http" "strings" ) if strings.TrimSpace(yourSigningSecret) == "" { http.Error(w, "Missing signing secret", http.StatusInternalServerError) return } mac := hmac.New(sha256.New, []byte(yourSigningSecret)) mac.Write([]byte(signedPayload)) expectedSignature := hex.EncodeToString(mac.Sum(nil)) ``` ### Compare the signatures [#compare-the-signatures] Use a constant-time comparison to compare the expected signature to each received `v1` signature, and accept the event if any of them matches. This protects against timing attacks. In Node.js, `crypto.timingSafeEqual` throws if the two values have different lengths, so check the lengths first and treat a mismatch as an invalid signature. In Python, `hmac.compare_digest` raises an error for text that isn't ASCII, so compare bytes. If none matches, don't return `2xx`, or Pay.com won't send that event again. ```js const crypto = require('crypto'); const expected = Buffer.from(expectedSignature, 'utf8'); const isValid = signatures.some((signature) => { const received = Buffer.from(signature, 'utf8'); return received.length === expected.length && crypto.timingSafeEqual(expected, received); }); if (!isValid) throw new Error('Invalid signature'); // Signature is valid: safe to process the event. ``` ```python import hmac expected = expected_signature.encode("utf-8") if not any(hmac.compare_digest(expected, s.encode("utf-8")) for s in signatures): raise ValueError("Invalid signature") # Signature is valid: safe to process the event. ``` ```go import ( "crypto/hmac" "net/http" ) valid := false for _, signature := range signatures { if hmac.Equal([]byte(expectedSignature), []byte(signature)) { valid = true break } } if !valid { http.Error(w, "Invalid signature", http.StatusBadRequest) return } // Signature is valid: safe to process the event. ``` ### Skip events you've already handled [#skip-events-youve-already-handled] Keep the `id` of each event you handle, and skip an event whose `id` you've already seen. This also stops a replayed request from being handled twice. ## Next steps [#next-steps] * [Webhook events](/api-reference/webhooks/webhook-events): a complete list of all event types Pay.com can send, organized by resource. * [Webhook endpoints](/api-reference/endpoints/webhookendpoints/create-webhook-endpoint): create, list, retrieve, and delete endpoints with the API. # API keys (/get-started/api-keys) API keys authenticate server-side requests to the Pay.com API. Create sandbox keys for testing and live keys for real payments in the Pay.com dashboard. To send a key with a request, see [Authentication](/developer-resources/authentication). ## API keys and environments [#api-keys-and-environments] Each API key works in only one environment, indicated by its prefix. | Key | Prefix | Base URL | | :---------- | :--------------------- | :------------------------------- | | Sandbox key | `sk-pay-com-sandbox-…` | `https://api.sandbox.pay.com/v1` | | Live key | `sk-pay-com-live-…` | `https://api.pay.com/v1` | Sending a sandbox key to the live URL (or a live key to the sandbox URL) returns `401 Unauthorized`. See [Environments](/get-started/environments) and [Go live](/get-started/go-live). ## Get your API keys [#get-your-api-keys] Follow these steps to create and store a key. ### Open API keys [#open-api-keys] Sign in to the [Pay.com dashboard](https://dashboard.pay.com) and go to **Developers** → **API keys**. ### Create a key [#create-a-key] Select **Create an API key**, then choose the key's workspaces and permissions. A live key also needs network access, the networks it can be used from. See [Manage API keys](/developer-resources/authentication/scoped-api-keys). ### Copy the secret [#copy-the-secret] Copy the secret immediately when you create or roll the key, because it's shown only once. Afterward, the dashboard displays only the prefix and last six characters (for example, `sk-pay-com-live-…7Qk2Xa`). ### Store it securely [#store-it-securely] Store the key in a secrets manager or server environment variable and read it at runtime. Never hardcode it. ## Keep your keys safe [#keep-your-keys-safe] Treat every API key as a secret. * **Use keys only on your servers.** Never place an API key in browser code, mobile apps, or anything else your customers can download. See [Browsers and mobile apps](/developer-resources/authentication#browsers-and-mobile-apps). * **Keep keys out of source control and logs.** Load keys from a secrets manager or environment variables, and exclude authorization headers from logs. * **Isolate environments.** Never use live keys in development or test systems. * **Grant least privilege.** Scope each key to only the workspaces, permissions, and (for live keys) networks it needs. * **Roll a key that may have leaked.** Select **Roll key** on the key's page, update your servers to the new secret, and end the old key. See [Roll a key](/developer-resources/authentication/scoped-api-keys#roll-a-key). ## Next steps [#next-steps] With a sandbox key, you can authenticate requests and take a test payment. * [Authentication](/developer-resources/authentication): Send keys with HTTP Basic auth and handle authentication errors. * [Manage API keys](/developer-resources/authentication/scoped-api-keys): Permissions, network access, PCI compliant keys, and rolling a key. * [Create your first payment](/get-started/create-your-first-payment): Process a test payment in the sandbox. # Create your first payment (/get-started/create-your-first-payment) This quickstart walks through one successful card payment in the sandbox. Your server creates a payment session, your page renders Universal checkout with Pay.com.js, you pay with a test card, and your server confirms the result. No real money moves. This quickstart covers the happy path. For server-to-server charges, error handling, and 3D Secure, see [Create a charge](/payments/create-a-charge). ## Prerequisites [#prerequisites] Before you start, make sure you have: * A Pay.com sandbox account ([set up your account](/get-started/set-up-your-account) if you don't have one yet). * Your sandbox key (`sk-pay-com-sandbox-`), which works only against `https://api.sandbox.pay.com/v1`. See [API keys](/get-started/api-keys) and [Environments](/get-started/environments). * Your merchant ID from the **Developers** tab of the [Pay.com dashboard](https://dashboard.pay.com). ## Process a test payment [#process-a-test-payment] Follow these five steps to take a card payment in the sandbox. ### Create a payment session (server-side) [#create-a-payment-session-server-side] From your backend, [create a payment session](/api-reference/endpoints/paymentsessions/create-ps) with `POST /v1/sessions/payment`. The session holds the amount and currency, and returns a `client_secret` that your page passes to Pay.com.js. * `amount` is in minor units, the smallest unit of the currency. For example, `1000` is $10.00. * `currency` is a lowercase ISO 4217 code, such as `usd`. * `customer_reference_id` is required. Pass your own identifier for the customer, and Pay.com creates or reuses a customer with that reference. * `payment_method_types: ["card"]` limits this walkthrough to cards. Omit it to offer every payment method enabled on your account. ```bash curl -X POST https://api.sandbox.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "amount": 1000, "currency": "usd", "customer_reference_id": "cust-quickstart-001", "billing_details": { "email": "test@example.com" }, "payment_method_types": ["card"], "payment_method_options": { "card": { "duplicate_card_check": false } } }' ``` A successful request returns HTTP `201` with the session (abridged): ```json { "id": "ps_702137752992353280", "resource": "payment_session", "amount": 1000, "amount_human_readable": "10.00", "capture": true, "charge": null, "client_secret": "eyJhbGciOiJIUzUxMiJ9.eyJtaWQiOiI2Nzg2NTI0NDY5MTgwNDk3OTIi...", "created": "2026-04-22T12:44:45.482Z", "currency": "usd", "customer": "cust_702137752992353281", "customer_reference_id": "cust-quickstart-001", "payment_method_types": ["card"], "status": "open", "test_mode": true } ``` Return `client_secret` to your page. Keep your API key on the server and never send it to the browser. The `client_secret` is returned only when you create the session and expires after the session's `duration` (60 minutes by default). If you lose it, [refresh the session](/api-reference/endpoints/paymentsessions/refresh-ps-client-secret) to get a new one. `duplicate_card_check: false` stops the sandbox from declining a test card number that was already used (`decline_code: duplicate_card`). Use it only in the sandbox. In live, keep duplicate card detection enabled so the same card can't be used across multiple customers. ### Load and initialize Pay.com.js (client-side) [#load-and-initialize-paycomjs-client-side] Load Pay.com.js and initialize it with your **merchant ID**. Both options below work in the sandbox. The npm package loads the script asynchronously (`await Pay.com(...)`), while the script tag exposes `window.Pay.com(...)` synchronously once loaded. ```bash npm install @pay-com/js ``` ```ts import Pay from '@pay-com/js' // In live, add `live: true`. const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID' }) ``` ```html ``` ```js const pay = window.Pay.com({ identifier: 'YOUR_MERCHANT_ID' }) ``` `identifier` is your Pay.com merchant ID, not the payment session ID. The session is identified by the `client_secret` you pass in the next step. See [Install and initialize](/sdks/pay-com-js) for more installation options. ### Render the checkout [#render-the-checkout] Add a container to your page: ```html
``` Create a checkout with the `client_secret` from step 1, then render the Universal checkout form into the container: ```ts const checkout = pay.checkout({ clientSecret: 'CLIENT_SECRET_FROM_STEP_1', // fetched from your server onSuccess: (payment) => { // payment.transaction is the charge ID, for example chrg_686511195653406720 console.log('Payment succeeded', payment.transaction, payment.status) }, onPending: (payment) => { // The result isn't final yet. Wait for the webhook in step 5. console.log('Payment pending', payment.transaction) }, onFailure: (error) => { console.log('Payment failed', error.message) }, }) checkout.universal({ container: '#payment-element' }) ``` The Universal checkout form collects card details and handles 3D Secure when the issuer requires it. When an attempt is declined, `onFailure` fires so you can display `error.message` to the customer. To have the form show the message instead, pass `toggles: { displayFailureMessages: true }` to `pay.checkout()`. Browser callbacks are for updating your page only. Confirm every payment on your server (step 5) before fulfilling the order.
### Pay with a test card [#pay-with-a-test-card] Enter the test card `4242 4242 4242 4242` with any future expiration date (for example, `12/28`) and a 3-digit CVV such as `123`, then submit the form. `onSuccess` fires with the new charge. To try a decline, use `4000 0053 5708 6322` (insufficient funds). `onFailure` fires, and the customer can try again in the same form, up to the session's `max_attempts` (5 by default). See [test cards](/get-started/test-your-integration/test-cards) for more decline and 3DS scenarios. ### Confirm the payment on your server [#confirm-the-payment-on-your-server] Use either of these to confirm the result server-side: * **Webhook (recommended):** Subscribe to `charge.succeeded` and `charge.failed`, or to `payment_session.completed` and `payment_session.failed`. See [webhooks](/developer-resources/webhooks), and [verify the signature](/developer-resources/webhooks#verify-webhook-signatures) of every event before you act on it. * **API:** [Retrieve the charge](/api-reference/endpoints/charges/get-charge) with the charge ID from `onSuccess` (`payment.transaction`). You can also [retrieve the session](/api-reference/endpoints/paymentsessions/get-ps-by-id). Its `charge` field holds the charge ID once a payment succeeds. ```bash curl https://api.sandbox.pay.com/v1/charges/chrg_686511195653406720 \ -u ':sk-pay-com-sandbox-…' ``` HTTP `200` with the charge (abridged): ```json { "id": "chrg_686511195653406720", "resource": "charge", "amount": 1000, "amount_human_readable": "10.00", "amount_refunded": 0, "currency": "usd", "customer": "cust_702137752992353281", "customer_reference_id": "cust-quickstart-001", "paid": false, "payment_method": "pm_card_685217824846643200", "payment_method_details": { "type": "card", "card": { "brand": "visa", "last4": "4242", "exp_month": "12", "exp_year": "2028", "funding": "debit", "network": "visa" } }, "payment_session": "ps_702137752992353280", "status": "succeeded", "test_mode": true } ``` `status: "succeeded"` means the charge was approved and the funds captured. `paid` stays `false` until the funds are settled to your bank account later. The charge also appears in your [Pay.com dashboard](https://dashboard.pay.com) under the sandbox.
## Try the API directly (server-to-server) [#try-the-api-directly-server-to-server] If you only want to see a charge in the sandbox from the command line, you can [create a charge](/api-reference/endpoints/charges/create-charge) with `POST /v1/charges` and a test card, with no session or Pay.com.js. Sending raw card numbers to the API is the server-to-server integration path. In live it requires full PCI DSS compliance (SAQ-D). Use the Pay.com.js flow above unless you're PCI certified. See [Find your use case](/payments/find-your-use-case). ```bash curl -X POST https://api.sandbox.pay.com/v1/charges \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "amount": 1000, "currency": "usd", "customer_reference_id": "cust-quickstart-001", "source_data": { "type": "card", "card": { "number": "4242424242424242", "expiry_month": "12", "expiry_year": "2028", "cvv": "123", "name": "Test User" } }, "payment_method_options": { "card": { "duplicate_card_check": false } } }' ``` HTTP `201` with the charge (abridged): ```json { "id": "chrg_686511195653406720", "resource": "charge", "amount": 1000, "amount_human_readable": "10.00", "currency": "usd", "customer": "cust_702137752992353281", "customer_reference_id": "cust-quickstart-001", "paid": false, "payment_method": "pm_card_685217824846643200", "payment_method_details": { "type": "card", "card": { "brand": "visa", "last4": "4242" } }, "payment_session": null, "status": "succeeded", "test_mode": true } ``` A `201` response means the charge was created, not that it succeeded. Always check `status`, which can also be `pending` or `requires_authentication`. A declined charge returns HTTP `400` with `error.type: "payment_method_error"`, `error.code: "card_declined"`, and a `decline_code`. See [decline codes](/payments/concepts/declines). ## Go live [#go-live] When Pay.com has turned on live for your account, change three things: * Call `https://api.pay.com/v1` with your `sk-pay-com-live-` API key. * Create your sessions with the live API. Pay.com.js works in the environment of the session you give it. With `@pay-com/js`, also pass `live: true` to `Pay.com()`. * Remove `duplicate_card_check: false`. See [Go live](/get-started/go-live) for everything that changes in live and a checklist. ## Next steps [#next-steps] Extend this payment flow with the full charge guide, webhooks, holds, and more testing. * [Create a charge](/payments/create-a-charge): Server-to-server charges, error handling, and 3D Secure. * [Set up webhooks](/developer-resources/webhooks): Receive real-time notifications for payment events. * [Hold and capture](/payments/hold-and-capture): Authorize now and capture later. * [Test your integration](/get-started/test-your-integration): Test cards, simulate endpoints, and webhooks in the sandbox. # Environments (/get-started/environments) Pay.com provides two environments: the **sandbox** for building and testing your integration, and **live** for real transactions. ## Base URLs [#base-urls] Send requests to the base URL for the environment you're working in. | Environment | API base URL | Pay.com.js script | API key prefix | | :---------- | :------------------------------- | :---------------------- | :--------------------- | | **Sandbox** | `https://api.sandbox.pay.com/v1` | `https://js.pay.com/v1` | `sk-pay-com-sandbox-…` | | **Live** | `https://api.pay.com/v1` | `https://js.pay.com/v1` | `sk-pay-com-live-…` | Your API key must match the environment. Sending a sandbox key to the live URL (or a live key to the sandbox URL) returns `401 Unauthorized`. See [API keys](/get-started/api-keys). Pay.com.js is one script for both environments. It works in the environment of the session you give it. With `@pay-com/js`, pass `live: true` in live. ## Sandbox [#sandbox] Use the sandbox to develop and validate your integration without reaching real banking networks or moving real funds. * Objects created in the sandbox include `"test_mode": true`. * [Test cards](/get-started/test-your-integration/test-cards) simulate approvals, declines, and 3D Secure challenges. * Simulate endpoints let you [clear charges](/data/reconciliation/simulate-clearing) and trigger [disputes, collaborations, and fraud warnings](/risk/test-risk-events). See [Test your integration](/get-started/test-your-integration) for sandbox testing workflows. ## Live [#live] Live processes real transactions on banking networks. Pay.com turns on live for your account after onboarding and underwriting are complete. Create a live key, switch your base URL from `https://api.sandbox.pay.com/v1` to `https://api.pay.com/v1`, and follow the [Go live](/get-started/go-live) checklist. Requests made with a live API key move real money. Keep live keys in a secrets manager, roll them immediately if they're compromised, and never use them in development or test systems. # Go live (/get-started/go-live) After validating your integration in the [sandbox](/get-started/environments), switch to the live environment to process real payments. Moving to live means changing your API base URL, API key, and webhook signing secret, and passing `live: true` if you load Pay.com.js from `@pay-com/js`. ## Get live access [#get-live-access] Pay.com turns on live for your account after underwriting and your commercial agreement are complete (see [Set up your account](/get-started/set-up-your-account)). ### Contact Pay.com [#contact-paycom] Contact your account manager or [support@pay.com](mailto:support@pay.com). Your account team verifies your integration and confirms compliance requirements. ### Create a live key [#create-a-live-key] In the [Pay.com dashboard](https://dashboard.pay.com), go to **Developers** → **API keys** and select **Create an API key**. Choose the key's workspaces, permissions, and network access (**A policy**, **IP addresses**, or **Any network** if Pay.com has allowed it for your organization). Every live key needs a network access setting, and there's no default. Copy the secret immediately (it's shown only once) and store it in your secrets manager or server environment. See [API keys](/get-started/api-keys). ### Switch your integration to live [#switch-your-integration-to-live] Update the settings in [What changes in live](#what-changes-in-live), then verify every item in the [checklist](#checklist) before processing your first live payment. ## What changes in live [#what-changes-in-live] Your integration uses a different base URL, API key, and webhook signing secret in each environment. | Setting | Sandbox | Live | | :---------------------------- | :------------------------------- | :------------------------------------------------ | | API base URL | `https://api.sandbox.pay.com/v1` | `https://api.pay.com/v1` | | API key | `sk-pay-com-sandbox-…` | `sk-pay-com-live-…` | | Network access on the key | No setting | Required (a policy, IP addresses, or any network) | | Pay.com.js script | `https://js.pay.com/v1` | `https://js.pay.com/v1` | | Pay.com.js from `@pay-com/js` | `Pay.com({ identifier })` | `Pay.com({ identifier, live: true })` | | Webhook signing secret | `whsec-pay-com-sandbox-…` | `whsec-pay-com-live-…` | | `test_mode` on objects | `true` | `false` | | Test cards | Simulate outcomes | Declined | | Simulate endpoints | Available | Return `403` | | Funds | Never move | Real transactions on banking networks | Sessions belong to one environment too. Pay.com.js works in the environment of the session you give it, so your live checkout needs sessions created with the live API. ## Checklist [#checklist] Before your first live payment, verify each of these items. ### Your server [#your-server] Confirm your backend configuration and request headers: * Your server calls `https://api.pay.com/v1` with your `sk-pay-com-live-` key, loaded at runtime from a secrets manager or environment variable. See [Get your API keys](/get-started/api-keys#get-your-api-keys). * Your live key's workspaces, permissions, and network access cover the requests your servers make and the networks they make them from. Requests outside them return `403`. See [Manage API keys](/developer-resources/authentication/scoped-api-keys). * If your live key serves several workspaces (or all of them), each request passes the workspace's merchant ID as the HTTP Basic auth username. See [Live keys for several workspaces](/developer-resources/authentication#live-keys-for-several-workspaces). * If you send raw card details, your key is marked **PCI compliant** and your infrastructure is fully PCI DSS compliant (SAQ-D). See [PCI compliant keys](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys) and [Find your use case](/payments/find-your-use-case). * Your requests no longer set `duplicate_card_check: false`, so duplicate card detection stays on in live. It blocks the same card from being used by more than one customer. See [Create your first payment](/get-started/create-your-first-payment). * Every `POST` request that creates or changes something sends a unique `idempotency-key` header, and your code sends the same key when it retries. See [Idempotency and retries](/developer-resources/idempotency-and-retries). ### Your checkout [#your-checkout] Confirm your browser integration points to live: * Your pages load Pay.com.js from `https://js.pay.com/v1`, or with `@pay-com/js` and `live: true`. See [Install and initialize](/sdks/pay-com-js). * Your server creates the sessions your pages use with the live API (`https://api.pay.com/v1`). ### Your webhooks [#your-webhooks] Confirm your live webhook endpoint and verification logic: * A live webhook endpoint is registered under **Developers** → **Webhooks** for the events your integration consumes. * Your server verifies `Pay-Signature` with the live endpoint's signing secret (`whsec-pay-com-live-`), not the sandbox secret. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). * Your handler skips events whose `id` it has already handled and returns a `2xx` response for each event. Pay.com retries failed deliveries every 15 minutes for up to 24 hours. See [Webhooks](/developer-resources/webhooks). ### Your keys [#your-keys] Confirm your key management practices: * Live keys stay out of development and test systems. * Your team knows how to roll a key that may have leaked with **Roll key** on the key's page. See [Keep your keys safe](/get-started/api-keys#keep-your-keys-safe). ### Your payouts [#your-payouts] If you send payouts, confirm that your payout methods are turned on in live and that your settlement account's balance covers them. See the payouts [go-live checklist](/payouts/test-and-go-live#go-live-checklist). ## After you go live [#after-you-go-live] Live transactions appear in real time in the Pay.com dashboard. Continue using the sandbox to test integration changes, because test cards and simulate endpoints work only in the sandbox. See [Test your integration](/get-started/test-your-integration). # Get started (/get-started) Integrate once with Pay.com to accept global payment methods, route across acquiring banks, and manage fraud. Start by setting up your sandbox account, then process a test payment and verify your integration before going live. # Set up your account (/get-started/set-up-your-account) Pay.com onboards merchants through a guided process to configure your integration path, payment methods, and acquiring setup before you go live. Reaching a working sandbox typically takes a few days, and live access opens once underwriting is complete. ## Onboarding process [#onboarding-process] Follow these steps to get sandbox access and complete underwriting. ### Contact the Pay.com team [#contact-the-paycom-team] Reach out through [Contact Sales](https://pay.com/contact-sales). Pay.com's team reviews your payment setup, required payment methods, and target markets to recommend an integration path and acquiring configuration. ### Underwriting and commercial agreement [#underwriting-and-commercial-agreement] Before Pay.com turns on live for your account, its underwriting team reviews your company information, Ultimate Beneficial Owner (UBO) details, and director information while your commercial agreement is finalized. Live access opens once both are complete. See [Go live](/get-started/go-live). ### Access your sandbox [#access-your-sandbox] While underwriting is in progress, Pay.com creates a sandbox account with API keys, webhook configuration, transaction logs, and a pre-configured Pay.com dashboard so your team can start integrating immediately. The Pay.com implementation team supports your integration throughout this phase. ## Technical setup [#technical-setup] Once you have sandbox access, configure your workspace and make your first API call. ### Choose your integration path [#choose-your-integration-path] Select the integration path that fits your UI requirements and PCI DSS scope: Universal checkout, Headless checkout, Tokenization, or the server-to-server API. [Find your use case](/payments/find-your-use-case) compares them, with the PCI DSS scope of each. ### Review your workspace [#review-your-workspace] Review the structure Pay.com configured with you during onboarding in the [Pay.com dashboard](https://dashboard.pay.com): * **Workspaces:** Separate transactions, routing rules, and reporting by brand, region, or operational unit. * **Settlement accounts:** Connections to each acquirer or payment provider. * **Orchestration:** Multiple settlement accounts in one workspace for routing and failover. See [Workspaces and settlement accounts](/get-started/how-pay-com-works/workspaces). ### Get your API key [#get-your-api-key] Your backend authenticates every request with a secret API key. 1. In the [Pay.com dashboard](https://dashboard.pay.com), go to **Developers** → **API keys** and create a sandbox key. Copy the secret immediately, because it's shown only once. See [API keys](/get-started/api-keys). 2. Send the key with HTTP Basic auth, as the password with an empty username. See [Authentication](/developer-resources/authentication). 3. Match the base URL to your key's [environment](/get-started/environments): * **Sandbox:** `https://api.sandbox.pay.com/v1` with an `sk-pay-com-sandbox-` key * **Live:** `https://api.pay.com/v1` with an `sk-pay-com-live-` key 4. If you use Pay.com.js, note your **merchant ID** from the **Developers** tab to pass as `identifier` in `Pay.com({ identifier })`. Keep your API key on your server. Never expose it in browser code or commit it to source control. See [Keep your keys safe](/get-started/api-keys#keep-your-keys-safe). ### Make your first request [#make-your-first-request] Choose your first endpoint based on your integration path. | Integration path | First endpoint | Guide | | :------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------ | | **Universal or Headless checkout (`Pay.com.js`)** | [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) | [Create your first payment](/get-started/create-your-first-payment) | | **Tokenization (`Pay.com.js`)** | [`POST /v1/sessions/tokenization`](/api-reference/endpoints/tokenizationsessions/create-tokenization-session) | [Tokenize a card](/payments/set-up-a-card/tokenize-a-card) | | **Server-to-server API (SAQ-D)** | [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) or [`POST /v1/holds`](/api-reference/endpoints/holds/create-hold) | [Create a charge](/payments/create-a-charge) | Include a unique V4 UUID in the [`idempotency-key`](/developer-resources/idempotency-and-retries) header of each `POST` request that creates or changes something, and send the same key when you retry. When you create a payment session, we recommend passing the customer's email as `billing_details.email`. It isn't required to open a session, but 3D Secure needs it, and when it's set, Pay.com.js doesn't ask the customer for it at checkout. ## Test and go live [#test-and-go-live] Validate your integration in the sandbox with test cards, simulate endpoints, and webhooks (see [Test your integration](/get-started/test-your-integration)). Once underwriting is complete and Pay.com turns on live for your account, follow the [Go live](/get-started/go-live) checklist to switch your endpoints and keys. ## Next steps [#next-steps] Take a test payment, then set up the pieces your integration needs. * [Create your first payment](/get-started/create-your-first-payment): End-to-end sandbox walkthrough using a payment session and Pay.com.js. * [Pay.com.js reference](/sdks/pay-com-js): Install and initialize Pay.com.js. * [Webhooks](/developer-resources/webhooks): Set up webhook endpoints and verify signatures. * [API reference](/api-reference/get-started): Explore all REST endpoints. # Create a payout (/payouts/create-a-payout) When you already have the recipient's details, send a payout with [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout). You can pay out to a saved payment method, to raw details provided in the request, or to the customer's default payment method. To let the recipient choose a payout method on your site, see [Let recipients choose a payout method](/payouts/payout-method-selection). ## Send a payout [#send-a-payout] Your server checks the destination, sends the payout, and acts on the response. ### Check the destination [#check-the-destination] When the destination is a saved payment method, pay out only to one of the customer's saved payment methods whose `flow_directions.payout` is `true`. It can be a payment method saved when the customer paid, such as the PayPal or Venmo account they paid with, or one saved in a setup session. [`GET /v1/customers/{reference_id}/payment_methods`](/api-reference/endpoints/customers/get-customer-payment-methods-by-reference) lists them. Pay.com sends the payout to any saved method you name, so one that can't receive payouts is declined. ### Create the payout [#create-the-payout] Send the `amount` in the smallest currency unit (`10000` is $100.00), the `currency`, and one [destination](#destinations). Send a unique [`idempotency-key`](/developer-resources/idempotency-and-retries) with each payout, and send the same key when you retry. ```bash curl https://api.sandbox.pay.com/v1/payouts \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "amount": 10000, "currency": "usd", "destination": "pm_card_685217824846643200", "customer_reference_id": "cust-john-smith-001", "reference": "withdrawal-001", "description": "Withdrawal for order 12345" }' ``` ```json { "id": "po_687092287729042432", "resource": "payout", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "status": "succeeded", "customer": "cust_685217819876392961", "customer_reference_id": "cust-john-smith-001", "payment_method": "pm_card_685217824846643200", "payment_method_details": { "type": "card", "card": { "brand": "visa", "last4": "4242", "exp_month": "12", "exp_year": "2028" } }, "reference": "withdrawal-001", "description": "Withdrawal for order 12345", "failure_code": null, "failure_message": null, "created": "2026-11-20T09:52:14.261Z", "test_mode": true } ``` ### Handle the response [#handle-the-response] The status code and the payout's `status` tell you what happened and what to do next. | Response | What happened | What to do | | :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- | | `201`, `status: succeeded` | The payout was sent. | Record it. A bank payout can still be [returned](/payouts/track-payouts#returns). | | `201`, `status: pending` | Pay.com accepted the payout, and it's waiting to be sent or confirmed, or for funds. | Wait for its webhook event. | | `400`, `payment_method_error` | The payout was declined, or blocked by a risk rule. The payout still exists, with its ID in `error.payout` and the reason in `error.decline_code`. | Retrieve the payout to see whether it's `failed` or `blocked`. | | `400`, any other error | The request isn't valid. For example, `destination` is an unknown payment method ID or a payment method saved for a customer other than `customer_reference_id`, `settlement_account` conflicts with the payment method's settlement account, or `reference` already exists while duplicate reference checking is enabled. | Fix the request and send it with a new idempotency key. | | `409` | A request with the same idempotency key is still being processed. | Wait, then retry with the same key. | | `422` | Payouts aren't allowed for this payout method or account (`Payouts are not allowed`), or no payment method you imported has the `reference` sent in `destination`. | Ask your account manager to turn the payout method on, or fix `destination`. | Then follow the payout to its final status. See [Track and manage payouts](/payouts/track-payouts). ## Destinations [#destinations] Send exactly one destination. `payout_method` and `payout_method_data` are aliases of `destination` and `destination_data`. | Send | Pays out to | | :------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `destination` | A saved payment method: its ID (for example `pm_card_…` or `pm_us_bank_account_…`), a card token ID (`tok_card_…`), or the `reference` of a payment method you imported. | | `destination_data` | Details you send with the payout. `type` names the payout method, and an object of the same name holds its details, with the recipient's `billing_details` alongside. Pay.com pays out to them once and doesn't save them. | | Neither, with `customer_reference_id` | The customer's default payment method. | ### Payout method details [#payout-method-details] The object named after the `type` needs these fields: | `type` | Required in the object of the same name | | :-------------------------------------------------------- | :------------------------------------------------------------------------- | | `card` | `number`, `expiry_month`, `expiry_year` | | `applepay`, `googlepay` | The wallet's encrypted token (see [Wallets](#wallets)) | | `network_token` | `token`, `token_type`, `expiry_month`, `expiry_year` | | `us_bank_account` | `account_number`, `routing_number` | | `eu_bank_account` | `iban` | | `uk_bank_account` | `sort_code`, `account_number` | | `au_bank_account` | `bsb_code`, `account_number` | | `nz_bank_account` | `bank_code`, `branch_code`, `account_number` (plus `suffix` if applicable) | | `in_bank_account` | `account_number`, and the branch's IFSC as `routing_number` | | `skrill`, `interac` | `email` | | `paypal` | At least one of `email`, `payer_id`, and `phone` | | `venmo` | At least one of `email`, `user_handle`, and `phone` | | `neteller` | None. Pay.com pays out to the Neteller account in `billing_details.email` | | `paysafecard` | None. Send the recipient's `billing_details.dob` | | `bizum` | `phone` | | `ecopayz` | `account_number` | | `t365_p2p`, `t365_qr`, `t365_momo`, `t365_bt`, `t365_p2c` | `account_number`, `bank`, `branch`, and `billing_details.phone` | Card, wallet, network token, and bank account details need a [PCI compliant key](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). Pay.com tokenizes them before it processes the payout, and never stores or returns the full card or account number. ### Wallets [#wallets] To pay out to a card in Apple Pay or Google Pay, send the wallet's encrypted token as the wallet returns it, and Pay.com decrypts it. For Apple Pay, that's the `paymentData` of the `PKPaymentToken`. For Google Pay, it's `paymentMethodData.tokenizationData.token`, parsed from its JSON string. Field names keep the wallet's camelCase, and `authentication_context` isn't supported on payouts. See [Wallets](/payments/wallets/api) for how you get the token. ```json { "destination_data": { "type": "applepay", "applepay": { "version": "EC_v1", "data": "4OZho15e9Yp5K0EtKergKzeRpPAjnKHw…", "signature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID…", "header": { "publicKeyHash": "LbsUwAT6w1JV9tFXocU813TCHks+LSuFF0R/eBkrWnQ=", "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…", "transactionId": "2686f5297f123ec7fd9d31074d43d201953ca75f098890375f13aed2737d92f2" } } } } ``` ```json { "destination_data": { "type": "googlepay", "googlepay": { "protocolVersion": "ECv2", "signature": "MEUCIQD…", "intermediateSigningKey": { "signedKey": "{\"keyValue\":\"…\",\"keyExpiration\":\"1924992000000\"}", "signatures": ["MEYCIQC…"] }, "signedMessage": "{\"encryptedMessage\":\"…\",\"ephemeralPublicKey\":\"…\",\"tag\":\"…\"}" } } } ``` If you decrypt the token yourself, send `type: network_token` instead, with the DPAN as `network_token.token`, `token_type` set to `applepay` or `googlepay`, the token's expiration date, and its `cryptogram` at the top level of `network_token`. A payout takes no `eci` and no 3D Secure result. ## Options [#options] A payout request also takes these optional fields: | Field | What it does | | :---------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `reference` | Your own reference for the payout, up to 255 characters. You can [retrieve the payout by it](/payouts/track-payouts#retrieve-a-payout). When duplicate reference checking is on for your account, a repeat returns `400` `Reference already exists`. | | `description` | A note about the payout, up to 255 characters. | | `metadata` | Key-value pairs, with string values. | | `statement_descriptor_suffix` | Added to your account's statement descriptor on the recipient's statement. The whole descriptor is limited to 22 characters. | | `payout_method_options` | Options by payout method. For `us_bank_account`: `rail` (`ach`, `rtp`, or `fednow`), `ach_payment_type` (`next_day` or `same_day`), and `fallback_to_ach`, which sends an RTP payout by same-day ACH when RTP isn't available (a FedNow payout always falls back to ACH). Cards and Interac accept `name_verification`, and Skrill accepts `verification`, `email_subject`, and `email_message`. To refresh an expired saved card before a payout, see [Account billing updater](/payments/account-billing-updater#refresh-a-card-before-a-payout). | | `balance_failure_on_create` | For a bank payout, `true` checks your balance when you create the payout. If your balance can't fund it, Pay.com declines it immediately with `insufficient_funds` instead of leaving it `pending` until funds arrive. Defaults to `false`. | | `settlement_account` | The settlement account to pay out from (`sa_…`), if you have several. A payment method that's bound to another settlement account returns `400`. See [Settlement accounts](/payments/routing/settlement-accounts). | ## Next steps [#next-steps] * [Track and manage payouts](/payouts/track-payouts): Follow payout statuses, webhook events, cancellations, and returns. * [Test and go live](/payouts/test-and-go-live): Test sandbox outcomes and complete the go-live checklist. # Payouts (/payouts) A payout sends money from your settlement account's balance to a recipient's card, bank account, or wallet. For example, you can pay out a customer's winnings or withdrawal, or a seller's earnings. A payout isn't a refund (which returns a charge to the original payment method) or a [settlement](/data/reconciliation/settlements) (in which Pay.com transfers your cleared funds to your bank account). Your account manager enables the payout methods you use in the sandbox and live environments. Create payouts directly from your server, or let recipients choose a payout method using Universal checkout or Headless checkout. ## Find your use case [#find-your-use-case] Choose a payout integration path based on how you collect recipient details. ## Common tasks [#common-tasks] Follow a payout to its final status, test your integration, and see where you can send money. # Let recipients choose a payout method (/payouts/payout-method-selection) When the recipient chooses how to get paid, they select a saved payout method or add a new one on your website. Your server creates a payout setup session, your frontend presents the choice with [Pay.com.js](/sdks/pay-com-js), and your server sends the payout to the method they selected. If you already have the recipient's payout details, [create a payout](/payouts/create-a-payout) directly instead. ## Set up payout method selection [#set-up-payout-method-selection] Your server creates the setup session and submits the payout, while your frontend displays the payout method options. ### Check enabled payout methods [#check-enabled-payout-methods] Your account manager enables payout methods in the sandbox and live environments. Call [`GET /v1/merchants/current/payment_method_options`](/api-reference/endpoints/merchants/get-payment-method-options) to list enabled payout methods in `payout_method_options.types`, which is separate from the `types` enabled for incoming payments. ### Create a payout setup session [#create-a-payout-setup-session] From your server, create a setup session with [`POST /v1/sessions/setup`](/api-reference/endpoints/setupsessions/create-ss), passing the recipient's `customer_reference_id` and `"payout": true`. The session offers only enabled payout methods, either all enabled types or the subset you specify in `payment_method_types`. Requesting a method that isn't enabled for payouts returns an error. ```bash curl https://api.sandbox.pay.com/v1/sessions/setup \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "customer_reference_id": "user_10", "payout": true }' ``` ```json { "id": "ss_747110684277344256", "resource": "setup_session", "client_secret": "eyJhbGciOiJIUzUxMiJ9...", "customer": "cust_747110680854791169", "customer_reference_id": "user_10", "payment_method": null, "payment_method_types": ["card", "skrill"], "status": "open", "created": "2026-11-20T15:11:07.804Z", "test_mode": true } ``` Associate the session's `id` with the recipient on your server and pass `client_secret` to your frontend. Only this response returns `client_secret`, and it stays valid for the lifetime of the session (60 minutes by default unless you set `duration`). For US bank account payouts, also include the recipient's `billing_details`. See [US bank account](/payouts/methods/us-bank-account/integrate-payout). ### Display payout method options [#display-payout-method-options] On your frontend, initialize a checkout with [`pay.checkout()`](/sdks/pay-com-js/pay-checkout), passing `clientSecret` and your `onSuccess` and `onFailure` callbacks. Then render the choice using Universal checkout or Headless checkout. Call [`checkout.universal()`](/sdks/pay-com-js/checkout-universal) with a container element to render Pay.com's hosted form. The form displays the recipient's saved payout methods and lets them add any payout method enabled for the session. ```js import Pay from '@pay-com/js'; const pay = await Pay.com({ identifier: '' }); const checkout = pay.checkout({ clientSecret, onSuccess: async (result) => { // Notify your server with result.transaction (setup session ID) await fetch('/api/payout-setup-complete', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ setupSessionId: result.transaction }), }); }, onFailure: (error) => { console.error('Payout setup failed:', error.message); }, }); checkout.universal({ container: '#payout-container' }); ``` When the recipient saves a method, `onSuccess` receives the setup session ID in `transaction` and the saved method in `paymentMethod`. Notify your server to confirm the session. Build your own payout picker with the Headless checkout methods. In a payout setup session, these methods return only payout-eligible methods: * [`checkout.getExistingSources()`](/sdks/pay-com-js/checkout-get-existing-sources) lists the recipient's saved payout methods. When they select one, call [`checkout.pay({ source })`](/sdks/pay-com-js/checkout-pay) with its `id`. It resolves with the result without invoking `onSuccess`, and rejects on failure. * [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods) lists the payout methods the recipient can add. Pass collected card details to [`checkout.headless('card', ...)`](/sdks/pay-com-js/checkout-headless) (no CVV is required for a payout setup session). For redirect-based methods such as `us_bank_account` (Plaid Link), call `checkout.headless()` with the method type. It invokes `onSuccess` and rejects on failure. ```js // Tell your server the recipient is done. It retrieves the setup session it created. const notifyServer = () => fetch('/api/payout-setup-complete', { method: 'POST' }); // Draw your picker from these: the recipient's saved payout methods, and the ones they can add const savedMethods = await checkout.getExistingSources(); const addableMethods = await checkout.getPaymentMethods(); // The recipient selects a saved payout method async function selectSavedMethod(sourceId) { try { await checkout.pay({ source: sourceId }); await notifyServer(); } catch (error) { console.error('Selection failed:', error.message); } } // The recipient adds a US bank account with Plaid Link. onSuccess fires when they finish. async function addUsBankAccount() { try { await checkout.headless('us_bank_account'); } catch (error) { console.error('Linking failed:', error.message); } } ``` **PCI scope.** Collecting card details in your own inputs puts your page in scope for SAQ-A-EP, even though Pay.com.js sends card details directly from the browser to Pay.com. Universal checkout keeps your integration at SAQ-A. See [Compare the integrations](/payments/find-your-use-case#compare-the-integrations). ### Confirm the choice and pay out [#confirm-the-choice-and-pay-out] Verify the recipient's choice on your server rather than trusting an ID sent from the browser. Only pay out to a saved payment method whose `flow_directions.payout` is `true`. 1. Retrieve the setup session with [`GET /v1/sessions/setup/{id}`](/api-reference/endpoints/setupsessions/get-ss-by-id) when your frontend notifies your server, or when the [`setup_session.completed`](/api-reference/endpoints/setupsessions/events) webhook arrives. 2. Confirm that `status` is `completed` and `customer_reference_id` matches your recipient. Read `payment_method` for the selected method ID. 3. Call [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout) with that ID as `destination` and a unique `idempotency-key`. Amounts are in minor units (for example, `10000` is $100.00 USD). ```json { "id": "ss_747110684277344256", "resource": "setup_session", "customer": "cust_747110680854791169", "customer_reference_id": "user_10", "payment_method": "pm_card_747113042071782400", "status": "completed", "test_mode": true } ``` ```bash curl https://api.sandbox.pay.com/v1/payouts \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "amount": 10000, "currency": "usd", "customer_reference_id": "user_10", "destination": "pm_card_747113042071782400" }' ``` Handle the response as documented in [Create a payout](/payouts/create-a-payout#handle-the-response), then [track the payout](/payouts/track-payouts) to its final status. ## Next steps [#next-steps] * [Create a payout](/payouts/create-a-payout): Handle payout responses, errors, and method options. * [Track and manage payouts](/payouts/track-payouts): Subscribe to webhooks, cancel pending payouts, and handle returns. * [Test and go live](/payouts/test-and-go-live): Test payout outcomes in the sandbox before switching to live keys. # Test and go live (/payouts/test-and-go-live) Build and test your payouts in the sandbox, at `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` key. Sandbox payouts never move real money. Then go through the [checklist](#go-live-checklist) before your first live payout. ## Get a sandbox destination [#get-a-sandbox-destination] A sandbox payout can go to a saved test card, test card details, or a Plaid sandbox bank account. * **A saved card.** Complete a payout setup session with [Universal checkout](/payouts/payout-method-selection) using a [test card](/get-started/test-your-integration/test-cards) such as `4242424242424242`, then pay out to the saved `pm_card_…` ID. * **Card details.** Send a test card in `destination_data`, if your key is [PCI compliant](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). * **A US bank account.** Link one of Plaid's sandbox accounts. See [US bank account](/payouts/methods/us-bank-account/integrate-payout#testing). ## Test outcomes [#test-outcomes] For a card or bank account destination, the payout's `amount` sets its outcome in the sandbox: | `amount` | Outcome | | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `505` | The payout fails immediately. The response is `400` with `error.type: payment_method_error` and the payout's ID in `error.payout`, and the payout is `failed`. | | `202` | The response has `status: pending`. Then the payout succeeds, and Pay.com sends `payout.succeeded`. | | `303` | The response has `status: pending`. Then the payout fails, and Pay.com sends `payout.failed`. | ## Simulate a return [#simulate-a-return] To test how you handle a return, simulate one on a `succeeded` payout with [`POST /v1/payouts/{id}/simulate/return`](/api-reference/endpoints/payouts/simulate-payout-return). ```bash curl -X POST https://api.sandbox.pay.com/v1/payouts/po_687092287729042432/simulate/return \ -u ':sk-pay-com-sandbox-…' ``` The response is `204 No Content`. The payout's status becomes `returned`, with return code `R01`, and Pay.com sends `payout.returned`. A payout can be returned only once (a second call returns `400`), and only after it succeeded (`422` otherwise). In the live environment, the endpoint returns `403`. ## Go-live checklist [#go-live-checklist] Before your first live payout, verify each item below along with the server [Go live](/get-started/go-live) checklist (switching to `https://api.pay.com/v1`, a live API key, and your live webhook signing secret). * **Payout methods.** Confirm your account manager enabled each payout method in the live environment. [`GET /v1/merchants/current/payment_method_options`](/api-reference/endpoints/merchants/get-payment-method-options) lists enabled types in `payout_method_options.types`. * **Your key.** If you send card, wallet, or bank account details in `destination_data`, use a live [PCI compliant key](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). * **Webhooks.** Configure your live endpoint to receive `payout.pending`, `payout.succeeded`, `payout.failed`, and `payout.returned`, [verify each event's signature](/developer-resources/webhooks#verify-webhook-signatures), and [skip duplicate events](/developer-resources/webhooks#skip-events-youve-already-handled). * **Idempotency keys.** Send a unique `idempotency-key` on every [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout) request, and reuse the same key when retrying. * **Funding.** Payouts draw from the balance of the settlement account they're routed to. If your balance can't cover a payout, it remains `pending` until funds arrive. For bank payouts, set `balance_failure_on_create: true` to fail immediately with `insufficient_funds` instead. See [Balances and cash flow](/data/reconciliation/balances-and-cashflow). ## Next steps [#next-steps] * [Create a payout](/payouts/create-a-payout): Send payouts from your server with `POST /v1/payouts`. * [Track and manage payouts](/payouts/track-payouts): Monitor payout statuses, webhooks, cancellations, and bank returns. # Track and manage payouts (/payouts/track-payouts) A payout's final result can come after the response that created it. A bank payout is often `pending` first, and one that succeeded can still be returned. Follow each payout with webhook events, and retrieve it when you need its details. ## Statuses [#statuses] A payout starts as `succeeded`, `pending`, `failed`, or `blocked`. A `pending` payout then succeeds or fails, and one that succeeded can still be returned: | Status | Meaning | | :---------- | :---------------------------------------------------------------------------------------------------- | | `pending` | Pay.com accepted the payout, and it's waiting to be sent or confirmed, or for funds in your balance. | | `succeeded` | The payout was sent. A bank payout can still come back as `returned`, usually within 2 business days. | | `failed` | The payout was declined or canceled. See its `failure_code`. No money reached the recipient. | | `blocked` | A risk rule declined the payout. | | `returned` | The payout succeeded, but the recipient's bank sent it back, and the funds went back to your balance. | ## Events [#events] Pay.com sends a [webhook event](/api-reference/endpoints/payouts/events) when a payout changes status. Blocked and canceled payouts send `payout.failed` too, so read the payout's `status` and `failure_code`. [Verify each event's signature](/developer-resources/webhooks#verify-webhook-signatures), and [skip an event you've already handled](/developer-resources/webhooks#skip-events-youve-already-handled). | Event | What to do | | :----------------- | :---------------------------------------------------------------------------------------------------------------- | | `payout.pending` | Show the payout as in progress. Not every payout sends this event, so don't wait for it. | | `payout.succeeded` | Mark the payout as paid. For a bank payout, `payout.returned` can still follow. | | `payout.failed` | Read `status` and `failure_code` to see why. Ask the recipient for another payout method, or create a new payout. | | `payout.returned` | Mark the payout as unpaid, and ask the recipient for other details before you pay them again. | ## Retrieve a payout [#retrieve-a-payout] Retrieve a payout by its ID with [`GET /v1/payouts/{id}`](/api-reference/endpoints/payouts/get-payout-by-id): ```bash curl https://api.sandbox.pay.com/v1/payouts/po_687092287729042432 \ -u ':sk-pay-com-sandbox-…' ``` Besides its `status`, the payout has these fields: | Field | What it holds | | :-------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `failure_code`, `failure_message` | Why the payout failed. See [Failure codes](#failure-codes). | | `underlying_network_details` | For a US bank payout, the rail it used in `network` (`ach`, `rtp`, or `fednow`). An ACH payout also includes `ach.trace_number`, which the recipient's bank uses to trace the transfer. | | `cashflow_transaction` | `null` until the payout clears. Then the cash flow transaction that records it in your balance (see [Balances and cash flow](/data/reconciliation/balances-and-cashflow#cash-flow-transactions)). | | `underlying_processing_details` | The processor's own failure code and message, and a returned payout's `return_code`. Present only when processor details are enabled on your account. | To find a payout by the `reference` you set when you created it, call [`GET /v1/payouts/reference/{reference_id}`](/api-reference/endpoints/payouts/get-payout-by-reference). ## List payouts [#list-payouts] [`GET /v1/payouts`](/api-reference/endpoints/payouts/get-payouts-bulk) lists your payouts, oldest first and 10 at a time (`limit` accepts up to 100). Filter by `customer_reference_id` or creation timestamp (`created.greater_than_or_equals`, `created.greater_than`, `created.less_than_or_equals`, `created.less_than`), and paginate with `starting_after` or `ending_before`. See [Pagination and filtering](/developer-resources/pagination-and-filtering). ```bash curl -G https://api.sandbox.pay.com/v1/payouts \ -u ':sk-pay-com-sandbox-…' \ -d customer_reference_id=cust-john-smith-001 \ -d limit=25 ``` Only one list query runs at a time for your account. Another one returns `429`. Retry after the number of seconds in its `Retry-After` header. ## Cancel a payout [#cancel-a-payout] You can cancel a `pending` bank payout until it's sent to the recipient's bank, with [`POST /v1/payouts/{id}/cancel`](/api-reference/endpoints/payouts/cancel-payout). A payout on an instant rail can't be canceled. ```bash curl -X POST https://api.sandbox.pay.com/v1/payouts/po_687093012345678912/cancel \ -u ':sk-pay-com-sandbox-…' \ -H "idempotency-key: $(uuidgen)" ``` The response is the payout, now `failed` with `failure_code: cancelled_by_merchant`, and its amount returns to your balance. A payout that can't be canceled returns `422` with `Payout is not pending` (if it already succeeded or failed) or `Payout cannot be cancelled` (if it has already been sent, or its payout method or rail doesn't support cancellation). ## Returns [#returns] A bank can send back a payout that succeeded, usually within 2 business days. The payout's status becomes `returned`, the funds return to your balance, and Pay.com sends `payout.returned`. Ask the recipient for updated details before paying out again. The bank's return code (such as `R01` for ACH) appears only in `underlying_processing_details.return_code`, which is included when processor details are enabled on your account. To test a return, see [Simulate a return](/payouts/test-and-go-live#simulate-a-return). ## Failure codes [#failure-codes] Two failure codes indicate an issue on your account rather than the recipient's: | `failure_code` | Cause | | :---------------------- | :--------------------------------------------------------------------------------------- | | `insufficient_funds` | Your balance couldn't fund a bank payout created with `balance_failure_on_create: true`. | | `cancelled_by_merchant` | You canceled the payout. | For any other failure, read `failure_message`. A payout declined on creation also includes the reason in `error.decline_code`. ## Next steps [#next-steps] * [Create a payout](/payouts/create-a-payout): Send payouts from your server with `POST /v1/payouts`. * [Test and go live](/payouts/test-and-go-live): Test payout outcomes and simulate bank returns in the sandbox. # Account Name Inquiry (/risk/account-name-inquiry) Account Name Inquiry (ANI) asks the card's issuer whether a name matches the name on the card account. Pay.com runs the check before it authorizes the payment, so you can decline a payment whose name doesn't match, or let it through and flag it for review. ANI is sold separately. To turn it on for your account, contact your account manager or Pay.com support. ## Requirements [#requirements] ANI runs on a payment when all of these are true: * ANI is turned on for your account. * The card is a Visa or Mastercard card. ANI works on cards, saved cards, Apple Pay, Google Pay, and network tokens. * ANI is requested by the API request, your account defaults, or a **Configuration** rule. ## How the check works [#how-the-check-works] Pay.com sends the name to the issuer through the card network. The issuer compares it with the name on the account and returns a result for the full name and for each part of it. Pay.com then compares the result with the results you accept: * **Accepted:** Pay.com authorizes the payment as usual and records the result. * **Not accepted:** Pay.com declines the payment with `decline_code: name_mismatch`, without authorizing it. By default Pay.com sends the cardholder name on the card. Set `use_customer_name` to `true` to send the customer's first and last name from the [customer](/api-reference/endpoints/customers/create-customer) instead. If the customer has no first or last name, Pay.com sends the cardholder name. If the check can't run, for example because the network didn't respond, the result is `not_performed`, and Pay.com never declines the payment because of the error itself. Whether the payment proceeds depends on whether you accept `not_performed`. ## Check the name on a payment [#check-the-name-on-a-payment] Add `name_verification` under `payment_method_options.card` on a payment request. This charge declines unless the name matches fully or partially. Amounts are in the currency's smallest unit, so `5000` is $50.00 USD. ```json title="POST /v1/charges" { "amount": 5000, "currency": "usd", "source": "pm_card_692434600374304768", "payment_method_options": { "card": { "name_verification": { "enabled": true, "accepted_results": ["match", "partial_match"] } } } } ``` ```json { "id": "chrg_692434850019280896", "resource": "charge", "status": "succeeded", "amount": 5000, "currency": "usd", "payment_method_details": { "type": "card", "card": { "brand": "visa", "last4": "4242", "name_verification": "partial_match" } }, "underlying_network_details": { "network": "visa", "visa": { "ani": { "status": "00", "full_name": "50", "first_name": "01", "middle_name": "01", "last_name": "50" } } } } ``` A declined payment returns an error with `code: card_declined` and `decline_code: name_mismatch`. The error also carries `payment_method_details` and `underlying_network_details`, so you can read the result: ```json { "error": { "type": "payment_method_error", "code": "card_declined", "decline_code": "name_mismatch", "charge": "chrg_692435013307916288", "payment_method_details": { "card": { "name_verification": "no_match" } }, "underlying_network_details": { "network": "visa", "visa": { "ani": { "status": "00", "full_name": "99", "first_name": "99", "middle_name": "01", "last_name": "99" } } } } } ``` ## Verify a saved card's name [#verify-a-saved-cards-name] To check a name without charging the customer, verify the saved card with [`POST /v1/payment_methods/{payment_method_id}/verify`](/api-reference/endpoints/paymentmethods/verify-payment-method). Pay.com sends a zero-amount verification to the issuer and runs ANI with it. The card, customer, and billing details come from the saved payment method, and the customer's default payment method doesn't change. ```json title="POST /v1/payment_methods/pm_card_692434600374304768/verify" { "payment_method_options": { "card": { "name_verification": { "enabled": true, "use_customer_name": true, "accepted_results": ["match", "partial_match"] } } } } ``` ```json { "id": "pm_card_692434600374304768", "resource": "payment_method", "type": "card", "customer": "cust_692434598712557568", "card": { "brand": "visa", "last4": "4242", "exp_month": "12", "exp_year": "2028", "name_verification": "match" } } ``` If the result isn't one you accept, the call returns `400` with a `payment_method_error` and `decline_code: name_mismatch`, and the saved payment method stays as it was. The verify call takes `pm_` IDs only. If the verification requires 3D Secure, it's declined with `authentication_required`. ## Where you can request ANI [#where-you-can-request-ani] Pass `name_verification` in the payment method options of any of these requests: | Request | Field | | :------------------------------------------------------------------------------------------------------ | :---------------------------------------------- | | [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) | `payment_method_options.card.name_verification` | | [`POST /v1/holds`](/api-reference/endpoints/holds/create-hold) | `payment_method_options.card.name_verification` | | [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) | `payment_method_options.card.name_verification` | | [`POST /v1/sessions/setup`](/api-reference/endpoints/setupsessions/create-ss) | `payment_method_options.card.name_verification` | | [`POST /v1/payment_methods`](/api-reference/endpoints/paymentmethods/create-payment-method) | `payment_method_options.card.name_verification` | | [`POST /v1/payment_methods/{id}/verify`](/api-reference/endpoints/paymentmethods/verify-payment-method) | `payment_method_options.card.name_verification` | | [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout) | `payout_method_options.card.name_verification` | ## Options [#options] The `name_verification` object takes these fields. None of them is required. | Field | Type | Description | | :-------------------------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `enabled` | boolean | Whether to run ANI on this request. | | `use_customer_name` | boolean | Send the customer's first and last name instead of the cardholder name. | | `accepted_results` | array | The overall results that let the payment proceed. Each is one of `match`, `partial_match`, `no_match`, `not_performed`, or `not_supported`. By default all five are accepted. | | `accepted_results_by_field` | object | Results to accept for each part of the name, in `first_name`, `middle_name`, `last_name`, and `full_name`. Each is an array of `match`, `partial_match`, or `no_match`. | ## Choose the results you accept [#choose-the-results-you-accept] By default all results are accepted, so ANI records the result and never declines. To decline payments that don't match, list only the results you accept. This configuration accepts a full or partial match and lets the payment proceed when the network can't run the check: ```json { "payment_method_options": { "card": { "name_verification": { "enabled": true, "accepted_results": ["match", "partial_match", "not_performed", "not_supported"] } } } } ``` `accepted_results_by_field` adds a second way for a payment to be accepted. It never declines a payment on its own. If every name part you list has a result in its array, the payment proceeds even when its overall result isn't in `accepted_results`. For example, this accepts a payment whose last name matches, regardless of the first name result: ```json { "name_verification": { "enabled": true, "accepted_results": ["match"], "accepted_results_by_field": { "last_name": ["match"] } } } ``` An empty `accepted_results` array accepts nothing, so every payment is declined unless `accepted_results_by_field` accepts it. Pay.com declines payments only when your account's risk checks are live. If they run in learn mode, Pay.com records the result and lets the payment through. ## Read the result [#read-the-result] The overall result is in `payment_method_details.card.name_verification` on charges, holds, and payouts, and in `card.name_verification` on payment methods: | Result | Meaning | | :-------------- | :--------------------------------------------------------------------------------------------------------------------------- | | `match` | The name matches the issuer's records. | | `partial_match` | Part of the name matches the issuer's records. | | `no_match` | The name doesn't match the issuer's records. | | `not_performed` | The check didn't run, for example because the network or issuer didn't respond, or the card isn't on a network ANI supports. | | `not_supported` | The issuer or network reported that it doesn't support the check. | The network's own codes are in `underlying_network_details`, under the card network's key, for example `visa.ani` or `mastercard.ani`. On card payouts the key can be the payout network, such as `visa_direct`. The object is present for every result: | Field | Codes | | :---------------------------------------------------- | :-------------------------------------------------------------- | | `status` | `00` the check ran, `01` it didn't run, `02` it isn't supported | | `full_name`, `first_name`, `middle_name`, `last_name` | `01` match, `50` partial match, `99` no match | ## Account defaults [#account-defaults] Set ANI defaults for your account so you don't need to pass `name_verification` on every request. In the Pay.com dashboard, go to **Settings** → **Payment Methods Configuration**, open your default configuration set, and set **Card** → **Name Verification**. If you don't see it, ask your account manager to turn it on. | Setting | Request field | | :-------------------------------------------------------------- | :-------------------------- | | **Request Name Check** | `enabled` | | **Use Customer Name** | `use_customer_name` | | **Name Verification Result**, in the **Simple** mode | `accepted_results` | | The results for each part of the name, in the **Advanced** mode | `accepted_results_by_field` | Other configuration sets hold the same settings for **Configuration** rules to apply. To read your defaults through the API, call [`GET /v1/merchants/current/payment_method_options`](/api-reference/endpoints/merchants/get-payment-method-options) and read `request_ani`, `use_customer_name_ani`, `accepted_ani_results`, and `accepted_ani_results_breakdown` in `card`. You can't change them through the API. Pay.com builds the options for each payment in this order: 1. The configuration set of a matching **Configuration** rule, or your default configuration set if no rule matches. 2. The `name_verification` fields in the request. Each field you send replaces the default, and each field you leave out keeps it. 3. A matching **Configuration Overrides** rule, which wins over both. The payment's `payment_method_options.card.name_verification` shows the options that applied. ## Flag mismatches for review [#flag-mismatches-for-review] To keep payments with weak name results and review them later, accept those results and add a [review rule](/risk/rules/review-rules) with an ANI result condition. The rule flags the transaction or the customer after the payment succeeds, without declining it. See [Rule conditions](/risk/rules/rule-conditions) for the fields a review rule can read. ## Name checks on other payment methods [#name-checks-on-other-payment-methods] Card payouts accept the same `name_verification` object under `payout_method_options.card`. Several non-card methods provide their own name or identity checks: | Method | Options field | How it works | | :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Interac e-Transfer payouts** | `payout_method_options.interac.name_verification` | Set `enabled` and `similarity_acceptance` (decimal string from `"0"` to `"1"`, such as `"0.85"`). Both the customer's first and last names must meet the threshold against the recipient's Interac profile. If `similarity_acceptance` is `0` or missing, Pay.com doesn't compare names. Whether or not you check names, payouts fail if the recipient isn't registered for autodeposit, or if the amount is over the recipient's maximum. | | **Skrill and Neteller** | `payout_method_options.skrill.verification`, `payment_method_options.skrill.verification`, and `payment_method_options.neteller.verification` | Skrill returns a verification level for the wallet and a match result for each customer detail. Pay.com checks them only when `enabled` is `true` and `accepted_verification_level_values` has at least one value. The wallet's verification level must be in that list, and every field set to `true` in `require_match_for_customer_details` (`first_name`, `last_name`, `country`, `postal_code`, `line1`, and `dob`) must match exactly. If a check fails, the payout fails. The same `verification` object works on Skrill and Neteller payments. | | **Cash App Pay** | `payment_method_options.cashapp.name_verification` and `phone_verification` | `name_verification` compares the customer's full name against the Cash App account holder's name using `similarity_acceptance` (decimal string from `"0"` to `"1"`, defaulting to `"0.85"`), declining lower scores with `name_mismatch`. `phone_verification` checks the last four digits of the customer's phone number against the Cash App account. | | **US bank accounts (Plaid Link)** | Account-level setting | When enabled by your account manager, Pay.com reads the account holder's name from the bank when the customer links the account through Plaid Link and saves it on the payment method. | ## Next steps [#next-steps] * [Review rules](/risk/rules/review-rules): Flag transactions or customers by their ANI result. * [Rule conditions](/risk/rules/rule-conditions): Review every field a rule can read. * [Verify a payment method API](/api-reference/endpoints/paymentmethods/verify-payment-method): View the full endpoint reference. # Advanced fraud screening (/risk/advanced-fraud-screening) Advanced fraud screening gives each card payment a fraud score from 0 to 100 before Pay.com authorizes it. The score uses signals such as the customer's device and IP address, their email and phone, the billing and shipping addresses, and how often the same card, email, or device was used recently. Pay.com maps the score to an outcome, such as allow, require 3DS, or block, and applies it to the payment. Advanced fraud screening is turned on per account. To turn it on, contact your account manager. Sending `enabled: true` doesn't turn it on for an account that doesn't have it. ## Where screening runs [#where-screening-runs] Screening runs on card payments, including saved cards, Apple Pay, Google Pay, and network tokens, in these requests: * [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) and [`POST /v1/holds`](/api-reference/endpoints/holds/create-hold) * [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and [`POST /v1/sessions/setup`](/api-reference/endpoints/setupsessions/create-ss) * [`POST /v1/payment_methods`](/api-reference/endpoints/paymentmethods/create-payment-method) It doesn't run on payouts or on [`POST /v1/payment_methods/{id}/verify`](/api-reference/endpoints/paymentmethods/verify-payment-method). To score a payment without creating it, use the [risk assessments API](/risk/risk-assessments). Payment rules that don't depend on screening run first. If one blocks the payment, screening doesn't run. Otherwise, Pay.com scores the payment and then evaluates any [payment rules](/risk/rules/payment-rules) that use **Risk Score** or other screening signals. When a rule and the score both produce an outcome, the stricter one applies. For this comparison, `allow` ranks below all other outcomes, including `three_ds_exemption` and `three_ds_not_required`. ## How the score becomes an outcome [#how-the-score-becomes-an-outcome] Your account has a default mapping from score ranges to outcomes, set in **Settings** → **Risk Score Thresholds** in the Pay.com dashboard. If you haven't set one, scores from 0 to 86 allow the payment and scores from 87 to 100 block it. A request can send its own `thresholds`. For each score, Pay.com uses your range's outcome only if it's at least as strict as the default mapping's outcome for that score, so a request can make screening stricter but not looser. For example, with the default mapping, a request can require 3DS for scores from 60 to 86, but it can't allow scores from 87 to 100. In score ranges, the outcomes rank from least to most strict in this order: | Outcome | What Pay.com does | | :---------------------- | :-------------------------------------------------------------------------------------------------- | | `three_ds_exemption` | Requests an SCA exemption. | | `three_ds_not_required` | Skips 3D Secure. | | `allow` | Processes the payment as usual. | | `require_three_ds` | Authenticates the customer with 3D Secure before authorization. | | `three_ds_challenge` | Authenticates the customer with a 3D Secure challenge. | | `block` | Declines the payment with `decline_code: blocked_by_risk_score`, without sending it to the network. | ## Options [#options] Pass `advanced_fraud_screening` in `payment_method_options.card`: | Field | Type | Description | | :----------- | :------ | :-------------------------------------------------------------------------------------------------------- | | `enabled` | boolean | Required. `false` skips screening on this payment. `true` screens it if screening is on for your account. | | `learn_mode` | boolean | Score the payment without applying the outcome. Defaults to `false`. | | `thresholds` | array | Score ranges and the outcome for each. Each range has `start`, `end`, and `outcome`, all required. | The `thresholds` ranges must follow these rules, or the request fails with `400`: * Include an `allow` range. * Cover every score from 0 to 100, with no gaps and no overlaps. Both ends are inclusive, so if one range ends at `59`, the next starts at `60`. * Never get less strict as the score rises, in the order of the outcomes table. ## Screen a payment [#screen-a-payment] This charge requires 3DS for scores from 60 to 86, and blocks scores from 87 to 100 as the default mapping does. Amounts are in the currency's smallest unit, so `10000` is $100.00. ```json title="POST /v1/charges" { "amount": 10000, "currency": "usd", "source": "pm_card_692434600374304768", "risk_session_id": "a4f82c91-3e17-4b09-91dc-b2c3dc25f604", "payment_method_options": { "card": { "advanced_fraud_screening": { "enabled": true, "learn_mode": false, "thresholds": [ { "start": 0, "end": 59, "outcome": "allow" }, { "start": 60, "end": 86, "outcome": "require_three_ds" }, { "start": 87, "end": 100, "outcome": "block" } ] } } } } ``` ```json { "id": "chrg_692436102815305728", "resource": "charge", "status": "succeeded", "amount": 10000, "currency": "usd", "risk_assessment_details": { "outcome": "allow", "outcome_source": "score", "score": 31, "flags": ["free_email_provider", "velocity_multiple_addresses"], "bypassed": [], "simulated": [] } } ``` For server-to-server payments, pass the `risk_session_id` from [device fingerprinting](/risk/device-fingerprinting), so the score can use the customer's device signals. ## Try a mapping in learn mode [#try-a-mapping-in-learn-mode] In learn mode, Pay.com scores the payment and records the score and flags, but doesn't apply the outcome. Use it to see how a mapping affects your payments before it declines any. `learn_mode` defaults to `false` whenever you include `advanced_fraud_screening` in a request. Even when your account runs screening in learn mode by default, omitting `learn_mode` applies the outcome on that request. Pass `learn_mode: true` to keep learn mode active. ## Read the result [#read-the-result] The result is in `risk_assessment_details` on the charge, hold, or payment method: | Field | Description | | :-------------------- | :------------------------------------------------------------------------------------------------- | | `outcome` | The outcome that applied. A missing `outcome` means `allow`. | | `outcome_source` | `score` when the score set the outcome, `rule` when one rule set it, and `rules` when several did. | | `score` | The fraud score from 0 to 100. Left out when there's no score. | | `flags` | The signals that affected the score. See [Flags](#flags). | | `rule_id`, `rules_id` | The rule or rules that set the outcome, when a rule did. | | `bypassed` | Rules that were skipped for this payment. | | `simulated` | Rules in simulation mode whose conditions matched, without changing the outcome. | The request's `payment_method_options.card.advanced_fraud_screening` is echoed back only when you sent `thresholds`. ## Flags [#flags] Each flag in `flags` names a signal that affected the score. A payment can have any number of them. This table lists every flag: | Signal | Flags | | :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Addresses | `billing_address_corrected`, `shipping_address_corrected`, `address_unverifiable`, `billing_shipping_address_mismatch`, `billing_shipping_city_mismatch`, `billing_shipping_country_mismatch`, `billing_shipping_state_mismatch`, `billing_shipping_postal_mismatch`, `risky_shipping_billing_mismatch`, `nonsensical_billing_city`, `obscene_billing_city`, and `suspicious_billing_city` | | Card | `card_bin_country_mismatch`, `card_non_us`, and `high_risk_bin` | | Email | `free_email_provider`, `invalid_email`, `high_risk_email_domain`, `email_billing_country_mismatch`, `email_billing_country_unverifiable`, `ip_email_mismatch`, `multiple_email_addresses`, and `obscene_email` | | IP address and device | `ip_outside_us`, `ip_billing_city_mismatch`, `ip_billing_country_mismatch`, `ip_billing_state_mismatch`, `anonymous_proxy`, `ip_address_risky_source`, `risky_proxy_ip`, `risky_true_ip`, `device_risky`, `risky_device`, `timezone_country_mismatch`, and `suspicious_location` | | Phone | `invalid_phone`, `invalid_phone_prefix`, `invalid_area_code`, `high_risk_area_code`, `incomplete_risky_phone`, `toll_free_number`, and `phone_billing_state_mismatch` | | Names | `identical_names`, `suspicious_name`, `suspicious_last_name`, `nonsensical_last_name`, `obscene_name`, and `obscene_last_name` | | Velocity | `velocity_multiple_addresses`, `velocity_multiple_cards`, `velocity_multiple_names`, `velocity_card_short`, `velocity_card_medium`, `velocity_card_long`, `velocity_card_very_long`, `velocity_email_short`, `velocity_email_medium`, `velocity_email_long`, `velocity_email_very_long`, `velocity_device_short`, `velocity_device_medium`, `velocity_device_long`, `velocity_device_very_long`, `velocity_ip_short`, `velocity_ip_medium`, `velocity_ip_long`, `velocity_ip_very_long`, `velocity_shipping_short`, `velocity_shipping_medium`, `velocity_shipping_long`, `velocity_shipping_very_long`, `velocity_true_ip_short`, `velocity_true_ip_medium`, and `velocity_true_ip_long` | | Identities and history | `multiple_identities_billing`, `multiple_identities_card`, `multiple_identities_email`, `multiple_identities_ip`, `multiple_identities_phone`, `multiple_identities_shipping`, and `negative_transaction_history` | | Correlation in your account | `positive_correlation`, `negative_correlation`, `high_positive_correlation`, `high_negative_correlation`, and `no_correlation_history` | | Correlation across all merchants | `positive_global_correlation`, `negative_global_correlation`, `high_positive_global_correlation`, `high_negative_global_correlation`, and `no_global_correlation_history` | | Timing | `risky_billing_time` and `risky_shipping_time` | | Form input | `autocomplete_address`, `autocomplete_card`, `autocomplete_email`, `autocomplete_name`, `autocomplete_password`, `autocomplete_phone`, `autocomplete_username`, `autofill_address`, `autofill_card`, `autofill_email`, `autofill_name`, `autofill_password`, `autofill_phone`, `autofill_username`, `mouse_offpage_address`, `mouse_offpage_card`, `mouse_offpage_email`, `mouse_offpage_name`, `mouse_offpage_password`, `mouse_offpage_phone`, `mouse_offpage_username`, `pasted_address`, `pasted_card`, `pasted_email`, `pasted_name`, `pasted_password`, `pasted_phone`, `pasted_username`, `autocomplete_detected`, `autofill_detected`, `mouse_offpage_detected`, `paste_detected`, and `input_detection_disabled` | ## Set your account defaults [#set-your-account-defaults] In the Pay.com dashboard, go to **Settings** → **Payment Methods Configuration**, open your default configuration set, and set **Card** → **Advanced Fraud Screening**: * **Enabled** turns screening on or off. * **Learn Mode** scores payments without applying the outcome. * **Risk Score Thresholds** uses your account mapping (**Default**) or your own **Risk Score Ranges** (**Custom**). If you don't see these settings, ask your account manager to turn them on. **Configuration** rules can apply other configuration sets, and **Configuration Overrides** rules can change the settings for one payment. ## Next steps [#next-steps] * [Risk assessments](/risk/risk-assessments): Score a payment with the same engine before you create it. * [Payment rules](/risk/rules/payment-rules): Block payments or require 3DS on conditions you set. * [Device fingerprinting](/risk/device-fingerprinting): Collect the device signals the score uses. # Collaborations (/risk/collaborations) Collaborations (pre-dispute alerts) notify you when a cardholder challenges a transaction at a participating bank, before a formal chargeback is filed. Pay.com delivers a `collaboration.open` webhook and lists the alert in the **Collaborations** tab of the Pay.com dashboard. Refunding within the response window closes the case without counting against your card network dispute ratio. You can respond through the dashboard or the [Collaborations API](/api-reference/endpoints/collaborations/get-collaborations-bulk). ## How collaborations work [#how-collaborations-work] Response windows typically last 24 to 72 hours. Check the `actionable_by` timestamp (shown as **Refundable Until** in the dashboard) for the exact deadline. ### Alert received [#alert-received] Pay.com receives the alert from the card network or vendor and notifies you via the dashboard and a `collaboration.open` webhook. ### Choose a resolution [#choose-a-resolution] Call [`POST /v1/collaborations/{id}/refund`](/api-reference/endpoints/collaborations/refund-collaboration) to refund the underlying charge and set the collaboration status to `resolved`, or call [`POST /v1/collaborations/{id}/ignore`](/api-reference/endpoints/collaborations/ignore-collaboration) to decline action and set the status to `ignored`. ### Final outcome [#final-outcome] Refunding closes the case without recording a chargeback. If you ignore the alert or miss `actionable_by`, the issuer may escalate to a formal dispute, moving the collaboration to `escalated` (`collaboration.escalated`). ## Supported services [#supported-services] Pay.com supports three pre-dispute alert services: | Service | Networks covered | How it works | | ---------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | **Verifi CDRN** | Visa (and other networks via Verifi) | Cardholder Dispute Resolution Network alerts resolved by refund. | | **Mastercard Collaboration** | Mastercard | Mastercard's native pre-chargeback resolution service for manual or automated responses. | | **Ethoca** | Visa, Mastercard, American Express, Discover, and others | Mastercard-owned alert service covering multiple card networks. | ## Resolution modes [#resolution-modes] Handle collaboration alerts automatically or manually: | Mode | How it works | Best for | | ----------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | **Automated** | Automatic Resolve rules refund the alerts that match their conditions, for example alerts under $50. | High alert volumes, where reviewing each alert by hand doesn't scale. | | **Manual review** | Review individual alerts in **Collaborations** or via API and decide case by case. | Lower volumes, or alerts that need a person to judge each transaction. | Visa Rapid Dispute Resolution (RDR) resolves eligible Visa disputes automatically based on rules configured with Pay.com. RDR cases appear as disputes with status `resolved_rapid_dispute_resolution` (`dispute.resolved_rapid_dispute_resolution` webhook) instead of collaborations. To set up Automatic Resolve rules, go to **Fraud & Disputes** → **Collaborations** → **Automatic Resolve Rules** in the Pay.com dashboard and click **Create new rule**. Each rule has conditions, built like other [rule conditions](/risk/rules/rule-conditions), and one action, **Refund**. Contact Pay.com support to enroll in collaboration services. ## Webhook events [#webhook-events] Subscribe to these events and [verify every signature](/developer-resources/webhooks#verify-webhook-signatures) before processing: | Event | When it fires | | ------------------------- | -------------------------------------------------------------------- | | `collaboration.open` | A new collaboration alert arrives. | | `collaboration.resolved` | The alert was resolved with a refund. | | `collaboration.escalated` | The alert wasn't resolved in time and escalated to a formal dispute. | For how to set up an endpoint, see [Webhooks](/developer-resources/webhooks). Use the sandbox simulate endpoint to test `collaboration.open` handling (see [Test risk events](/risk/test-risk-events)). ## Next steps [#next-steps] * [Disputes](/risk/disputes): Manage formal chargebacks when an alert escalates. * [Fraud warnings](/risk/fraud-warnings): Handle TC40 and SAFE early fraud notifications. * [Risk rules](/risk/rules): Configure payment, cancel, and review rules. * [Collaborations API](/api-reference/endpoints/collaborations/get-collaborations-bulk): Full endpoint reference. # Device fingerprinting (/risk/device-fingerprinting) For server-to-server API integrations, load Pay.com.js on your page to collect device signals for Pay.com's risk engine, then pass the generated `risk_session_id` on each charge or hold. ## Requirements [#requirements] Before you start, make sure you have installed or loaded [Pay.com.js](/sdks/pay-com-js) on your checkout page. Load Pay.com.js on initial page load so it has time to collect device signals before checkout submission. Submitting a charge without a valid `risk_session_id` (or with a stale ID from a previous page load) can increase the risk score and lead to declines. ## Collect and send the risk session ID [#collect-and-send-the-risk-session-id] When Pay.com.js loads, it generates a session UUID on `window.Pay.riskIdentifier`. Because a new UUID is generated on every page load, read the current value right before submitting a transaction. ### Read the risk session ID [#read-the-risk-session-id] Read `window.Pay.riskIdentifier` after Pay.com.js loads (using either the script tag or `@pay-com/js`). This property lives on the global `window.Pay` object, not on the instance returned by `Pay.com()`. ```javascript const riskSessionId = window.Pay.riskIdentifier ``` To supply your own UUID, append `?riskIdentifier=` to the script URL (for example, `https://js.pay.com/v1?riskIdentifier=4bc38635-d941-463e-a331-376705d0b840`). ### Pass `risk_session_id` on the charge or hold [#pass-risk_session_id-on-the-charge-or-hold] Include `risk_session_id` in your [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) or [`POST /v1/holds`](/api-reference/endpoints/holds/create-hold) request body. The example charges €1.00 (`amount` is in minor units) with raw card details, which need an API key enabled for raw card data. See [PCI compliant keys](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). `POST https://api.sandbox.pay.com/v1/charges` ```json { "currency": "eur", "risk_session_id": "4bc38635-d941-463e-a331-376705d0b840", "amount": 100, "source_data": { "type": "card", "card": { "number": "4242424242424242", "expiry_month": "12", "expiry_year": "2028", "cvv": "123", "name": "Jane Smith" }, "billing_details": { "email": "jane.smith@example.com", "address": { "line1": "Georgiou Griva Digeni 43", "city": "Limassol", "postal_code": "3106", "country": "CY" }, "phone": "+35797123456" } } } ``` ## How the risk engine uses device signals [#how-the-risk-engine-uses-device-signals] Pay.com links the collected device signals to your transaction through `risk_session_id`. Depending on the signals and your risk configuration, the risk engine can take one of these actions: * **Decline:** If the engine detects high-risk signals (such as known fraudulent device fingerprints, suspicious browser configurations, or bot-like behavior), it declines the transaction automatically. * **Flag for review:** The engine can flag a potentially fraudulent transaction for review. A review doesn't hold the payment. The charge succeeds, and you resolve the [risk review](/risk/risk-reviews) afterward. Depending on your risk configuration, the transaction can be declined outright instead. * **Step-up authentication:** When the risk score is elevated but not conclusive, the engine can trigger extra verification, such as 3D Secure. ## Next steps [#next-steps] Related risk and SDK guides: * [Risk assessments](/risk/risk-assessments): Score transactions via API before creating a charge. * [Test risk events](/risk/test-risk-events): Simulate disputes, collaborations, and fraud warnings in the sandbox. * [Pay.com.js](/sdks/pay-com-js): Install and initialize Pay.com.js. # Fraud warnings (/risk/fraud-warnings) A fraud warning is a non-financial notification from a card network (Visa TC40 or Mastercard SAFE) reporting that a cardholder or issuing bank flagged a transaction as unauthorized. No funds move when a warning arrives. Pay.com delivers a `fraud_warning.created` webhook and updates the **Fraud Warnings** page in the Pay.com dashboard. You can also query warnings through the [Fraud Warnings API](/api-reference/endpoints/fraudwarnings/list-fraud-warnings). Refunding a flagged charge while `actionable` is `true` typically prevents a formal dispute and avoids chargeback fees. If the issuer still files a dispute after you refund, the refund serves as your defense so you aren't debited twice. ## How to respond [#how-to-respond] When a fraud warning appears in **Fraud Warnings** or in the [List fraud warnings](/api-reference/endpoints/fraudwarnings/list-fraud-warnings) endpoint, take these steps: 1. **Review the order.** Check order history, fulfillment status, and risk signals. Cancel unshipped orders immediately. 2. **Issue a proactive refund.** If `actionable` is `true` and the charge looks unauthorized, refund the full amount with [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) before a formal dispute is filed. See [Refunds](/payments/refunds). 3. **Update blocklists (optional).** If you identify a pattern, add the card BIN to a [risk list](/risk/rules/risk-lists) referenced by a Block [payment rule](/risk/rules/payment-rules). See [Rule conditions](/risk/rules/rule-conditions) for the fields each rule type can match. ## Webhook integration [#webhook-integration] Listen for `fraud_warning.created` to automate your response workflow: ```json { "id": "evt_457771954326208512", "resource": "event", "type": "fraud_warning.created", "created": "2024-06-17T05:02:18.906Z", "data": { "id": "frdwrn_685125114794084352", "resource": "fraud_warning", "actionable": true, "amount": 93150, "amount_human_readable": "931.50", "charge": "chrg_685125114794084352", "created": "2024-06-17T00:00:00.000Z", "currency": "usd", "customer": "cust_685125114794084352", "customer_reference_id": "12345678", "fraud_type": "unauthorized_use_of_card", "reference": "123456", "test_mode": false } } ``` The event's `data` is the fraud warning, with these fields: | Field | Description | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | Unique identifier for the fraud warning object. | | `actionable` | `true` if the charge can still be refunded. `false` if a dispute was already opened or the charge can't be refunded. | | `amount` | Transaction amount in minor units. | | `amount_human_readable` | Transaction amount formatted in the currency's major unit (for example, `"931.50"`). | | `charge` | ID of the flagged charge. Use it to look up the charge and issue a refund. | | `currency` | Lowercase ISO 4217 currency code. | | `created` | Timestamp when the warning was raised (falls back to the charge time). | | `customer` | Pay.com customer ID, or `null`. | | `customer_reference_id` | Your internal customer identifier, or `null`. | | `fraud_type` | Card network fraud category: `made_with_lost_card`, `made_with_stolen_card`, `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `unauthorized_use_of_card`, `account_takeover`, `modification_of_payment_order`, `manipulation_of_cardholder`, or `misc`. | | `payment_method` | ID of the payment method used for the charge, or `null`. | | `reference` | Reference for reconciling the warning with your records, or `null`. | | `test_mode` | `true` for sandbox events. | Check `actionable` first when handling the event. If `true`, retrieve the charge and decide whether to refund. If `false`, log the event for reporting only. Always [verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures) before acting on an event. For how to set up an endpoint, see [Webhooks](/developer-resources/webhooks). To test `fraud_warning.created` handling in the sandbox, use the simulate endpoint in [Test risk events](/risk/test-risk-events). ## Next steps [#next-steps] Related risk and dispute guides: * [Collaborations](/risk/collaborations): Resolve pre-dispute alerts from Ethoca, Verifi CDRN, and Mastercard Collaboration. * [Risk rules](/risk/rules): Block suspicious transactions with payment rules, or flag them for review on results such as ANI. * [Disputes](/risk/disputes): Manage formal chargebacks if a warning escalates. * [Fraud warnings API](/api-reference/endpoints/fraudwarnings/list-fraud-warnings): Full endpoint reference. # Risk (/risk) Pay.com's risk tools run across every payment method and acquirer in your workspace. Score transactions before charging, block or authenticate charges with dashboard rules, act on early fraud warnings and pre-dispute alerts, and manage chargebacks from one API and dashboard. Available risk tools depend on the services enabled on your account. Contact your account manager or support if a feature isn't active in your workspace. ## How Pay.com assesses risk [#how-paycom-assesses-risk] Pay.com's risk engine scores transactions and evaluates your [payment rules](/risk/rules/payment-rules) together. Its outcome is `allow`, `three_ds_exemption`, `three_ds_not_required`, `require_three_ds`, `three_ds_challenge`, or `block`. * **Pay.com Gateway:** The risk engine runs automatically on every charge and applies its outcome to the charge. * **Standalone API:** Call the [Risk assessments API](/risk/risk-assessments) before creating a charge to receive a risk score and recommended outcome, then apply the decision in your own code. For server-to-server checkouts, load Pay.com.js on your page for [device fingerprinting](/risk/device-fingerprinting) and pass `risk_session_id` with each charge, hold, or risk assessment. ## Risk layers across the transaction lifecycle [#risk-layers-across-the-transaction-lifecycle] Pay.com organizes risk controls into four layers: prevention, detection, early warning, and formal resolution. Each tool applies at a specific point in the transaction lifecycle. | Timing | Tool | What it does | | ---------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | Before charge creation | [Risk assessments](/risk/risk-assessments) | Scores a payment via API before charging and returns a recommended outcome. | | Before authorization | [Payment rules](/risk/rules/payment-rules) | Blocks, authenticates, or exempts charges automatically based on dashboard rules. | | Before authorization | [Account Name Inquiry](/risk/account-name-inquiry) | Checks the name with the card's issuer and declines mismatches. | | Before authorization | [Advanced fraud screening](/risk/advanced-fraud-screening) | Scores each card payment and blocks it or requires 3DS by score. | | After authorization | [Cancel rules](/risk/rules/cancel-rules) | Voids an authorized hold or charge before settlement. | | After authorization | [Review rules](/risk/rules/review-rules) and [Risk reviews](/risk/risk-reviews) | Flags transactions or customers for manual review and API resolution. | | Days after charge | [Fraud warnings](/risk/fraud-warnings) | Delivers TC40 (Visa) and SAFE (Mastercard) fraud reports via webhook. | | Before formal dispute | [Collaborations](/risk/collaborations) | Delivers pre-dispute alerts (Ethoca, Verifi CDRN, and Mastercard Collaboration) so you can refund before a chargeback is filed. | | Formal dispute filed | [Disputes](/risk/disputes) | Tracks chargebacks, evidence, deadlines, reason codes, and the networks' monitoring programs. | ## Prevention and detection [#prevention-and-detection] Configure [rules](/risk/rules) in the Pay.com dashboard to evaluate transactions automatically. Pay.com treats a charge created with `off_session: true` as a recurring transaction. A payment rule runs on it only if the rule's **Evaluate in recurring transactions** setting is on, which it isn't by default, while cancel and review rules always run on it. Reference [risk lists](/risk/rules/risk-lists) to match large sets of BINs, names, or countries in a single condition. Before a payment rule goes live, you can run it in simulation mode, where Pay.com logs the charges that match it without applying its action. To confirm a rule fires, follow [Test your rules](/risk/rules/test-rules). When a [review rule](/risk/rules/review-rules) matches a transaction, Pay.com creates a review object without blocking the payment. Inspect and approve or decline flagged items through the [Risk reviews API](/risk/risk-reviews). ## Early warning and disputes [#early-warning-and-disputes] Card networks and alert services can warn you before a chargeback is filed. If the cardholder's bank files one, Pay.com tracks it as a dispute. * **[Fraud warnings](/risk/fraud-warnings):** Non-financial card network notifications (Visa TC40, Mastercard SAFE) signaling likely chargebacks. Refund while `actionable` is `true` to prevent escalation. * **[Collaborations](/risk/collaborations):** Pre-dispute alerts from Ethoca, Verifi CDRN, and Mastercard Collaboration, with a refund window of typically 24 to 72 hours. Visa Rapid Dispute Resolution (RDR) resolves eligible Visa disputes automatically and sends `dispute.resolved_rapid_dispute_resolution`. * **[Disputes](/risk/disputes):** Manage formal chargebacks and upload evidence documents. Submit evidence by the dispute's `evidence_required_by` deadline, which is set only while the dispute is `open` or in `pre_arbitration`. Use the sandbox simulate endpoints to test dispute, collaboration, and fraud warning webhooks. See [Test risk events](/risk/test-risk-events). ## Compliance [#compliance] Pay.com holds PCI DSS Level 1 certification. Your own PCI scope depends on how you integrate, and [Compare the integrations](/payments/find-your-use-case#compare-the-integrations) lists the scope of each integration. For certifications and supporting documents, contact your account manager. 3D Secure (3DS) is the authentication protocol that Visa, Mastercard, and American Express use to verify a cardholder's identity before a charge completes. When a transaction is authenticated with 3DS, liability for fraud-related chargebacks shifts from you to the issuing bank. If you operate in the UK or European markets, Strong Customer Authentication (SCA) rules require 3DS2, and Pay.com's 3DS implementation complies with PSD2 and SCA requirements. Pay.com.js handles 3DS in Universal checkout and Headless checkout, with no configuration on your end. A tokenization session doesn't process payments, so when you tokenize cards with Pay.com.js, handle 3DS on your server with the [server-to-server 3DS flow](/payments/3d-secure/charge-with-3ds). To authenticate cardholders before you charge them, use [standalone 3DS authentication](/payments/3d-secure/standalone-authentication). ## Next steps [#next-steps] * [Payment rules](/risk/rules/payment-rules): Block suspicious charges or enforce 3D Secure before authorization. * [Risk assessments](/risk/risk-assessments): Score cards via API before creating a charge. * [Device fingerprinting](/risk/device-fingerprinting): Collect browser signals with Pay.com.js for server-to-server charges. * [3D Secure](/payments/3d-secure): Authenticate cardholders with Pay.com.js, the mobile SDKs, or server-to-server integrations. # Risk assessments (/risk/risk-assessments) Pay.com's risk engine evaluates every transaction automatically when you process charges through the gateway. The risk assessment API gives you direct access to that same engine before you create a charge. You send the card data, Pay.com runs the engine and returns a risk score and a recommended outcome, and you act on it in your code. Use the standalone API when you need to make a decision before a charge is created, for example to route a high-risk customer to a different checkout path or to step up to 3DS before you create the charge. Risk assessments need the risk API turned on for your account. Without it, every `/v1/risk/` endpoint returns `403` with `code: permission_denied`. The score comes from [advanced fraud screening](/risk/advanced-fraud-screening), which must also be on for your account. Contact Pay.com support to turn them on. ## Request an assessment [#request-an-assessment] Send a `POST` request to [`/v1/risk/assessments`](/api-reference/endpoints/riskassessment/assess-payment) with the card data and the amount you intend to charge. Amounts are integers in the currency's minor unit (the smallest unit), for example `10000` for $100.00 USD. These request fields are required: * `risk_session_id`: the device-fingerprinting session ID (up to 255 characters) from [device fingerprinting](/risk/device-fingerprinting). * `amount` and `currency`. * Exactly one of `source_data` or `payment_method_data`. You can also send `shipping`, the shipping address, which the score compares with the billing address and the IP address. An assessment runs [advanced fraud screening](/risk/advanced-fraud-screening) on the details you send. If your account uses Pay.com rules, your payment rules run on it too. Account Name Inquiry doesn't run on assessments. The example sends raw card details in `source_data.card`, which needs an API key enabled for raw card data. See [PCI compliant keys](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). `authentication_context` is required inside the `card`, `token`, `source`, and `network_token` objects. An empty object (`{}`) is enough. The assessment's `card` object doesn't accept `three_ds` or `three_ri`. Sending either returns `400`. ```json { "risk_session_id": "a4f82c91-3e17-4b09-91dc-b2c3dc25f604", "amount": 10000, "currency": "usd", "source_data": { "type": "card", "card": { "number": "4242424242424242", "expiry_month": "12", "expiry_year": "2028", "cvv": "123", "name": "John Smith", "authentication_context": {} }, "billing_details": { "name": "John Smith", "email": "john.smith@example.com" } }, "options": { "risk_score_thresholds": [ { "start": 0, "end": 29, "outcome": "allow" }, { "start": 30, "end": 59, "outcome": "require_three_ds" }, { "start": 60, "end": 79, "outcome": "three_ds_challenge" }, { "start": 80, "end": 100, "outcome": "block" } ] } } ``` ```json { "id": "rsk_700306303280480256", "resource": "risk_assessment", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "created": "2026-04-17T11:27:14.843Z", "test_mode": false, "score": 42, "outcome": "require_three_ds", "outcome_source": "score", "flags": [ "ip_outside_us" ], "billing_details": null, "payment_method_details": { "type": "card_token" }, "options": { "risk_score_thresholds": [ { "start": 0, "end": 29, "outcome": "allow" }, { "start": 30, "end": 59, "outcome": "require_three_ds" }, { "start": 60, "end": 79, "outcome": "three_ds_challenge" }, { "start": 80, "end": 100, "outcome": "block" } ] } } ``` The endpoint returns `201 Created` on success. You can't retrieve an assessment later, so store the response. ## Custom score thresholds [#custom-score-thresholds] The `options.risk_score_thresholds` field lets you map score ranges to outcomes. Each entry defines a `start`, an `end`, and an `outcome`. Pay.com evaluates the score against your ranges and sets `outcome` to the matching entry's value. Your ranges can make your account's default mapping stricter, not looser. For each score, Pay.com uses your range's outcome only if it's at least as strict as the default mapping's outcome. See [How the score becomes an outcome](/risk/advanced-fraud-screening#how-the-score-becomes-an-outcome). Your payment rules also run on each assessment. When a rule and the score both produce an outcome, the stricter one applies. For this comparison, `allow` ranks below all other outcomes, including `three_ds_exemption` and `three_ds_not_required`. `start` and `end` are integers from 0 to 100, and all three fields are required. Boundaries are inclusive on both ends. The request fails with `400` unless your ranges follow these rules: * Include an `allow` range. * Cover every score from 0 to 100 with no gaps and no overlaps. If one range ends at `29`, the next must start at `30`. * Escalate in severity as the score rises. A lower range can't have a stricter outcome than a higher one. From least to most severe, the order is `three_ds_exemption`, `three_ds_not_required`, `allow`, `require_three_ds`, `three_ds_challenge`, and `block`. ```json title="Adjacent, non-overlapping ranges" [ { "start": 0, "end": 29, "outcome": "allow" }, { "start": 30, "end": 59, "outcome": "require_three_ds" }, { "start": 60, "end": 79, "outcome": "three_ds_challenge" }, { "start": 80, "end": 100, "outcome": "block" } ] ``` The valid `outcome` values are: | Outcome | Meaning | | ----------------------- | --------------------------------------------------------- | | `three_ds_exemption` | Very low risk. Request an SCA exemption. | | `three_ds_not_required` | Low risk. Proceed without 3DS. | | `allow` | The transaction looks low risk. Proceed with the charge. | | `require_three_ds` | Elevated risk. Start 3DS authentication before charging. | | `three_ds_challenge` | High risk. Start 3DS and expect an interactive challenge. | | `block` | Do not proceed with this transaction. | If you omit `options.risk_score_thresholds`, the API accepts the request but doesn't map the score to an outcome, so only a matching rule can set one. ## Reading the response [#reading-the-response] The response holds the score, the recommended outcome, and what set that outcome. | Field | Type | Description | | ------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | string | Unique identifier for the assessment (`rsk_...`). | | `score` | integer | Risk score from 0 (lowest risk) to 100 (highest risk). Left out when there's no score. | | `outcome` | string | Recommended action based on the score and your thresholds. A missing `outcome` means `allow`. | | `outcome_source` | string | What determined the outcome. `"score"` means no rule matched and the score-to-threshold mapping produced the outcome. `"rule"` means a rule matched and produced the outcome. `"rules"` means several rules matched. | | `rule_id` | string | The ID of the rule that set the outcome when `outcome_source` is `"rule"`. Omitted otherwise. | | `rules_id` | array | The IDs of the rules that set the outcome when `outcome_source` is `"rules"`. Omitted otherwise. | | `flags` | array | Signals that contributed to the score, for example `"ip_outside_us"`. Empty when no signals were detected. See [Flags](/risk/advanced-fraud-screening#flags) for every value. | | `bypassed` | array | The IDs of rules that were skipped for this assessment. | | `simulated` | array | The IDs of rules in simulation mode whose conditions matched. They didn't change the outcome. | | `shipping` | object | The shipping details you sent, if any. | | `amount` | integer | The amount you submitted, in the currency's smallest unit. | | `currency` | string | Lowercase ISO 4217 currency code. | | `billing_details` | object | The billing address you sent, if you sent `billing_details.address.country`. Name, email, and phone are not echoed. `null` when no address was sent. | | `payment_method_details` | object | The payment method type used in the assessment, for example `card_token`. Card details are not returned. | | `options` | object | The thresholds you submitted. `risk_score_thresholds` is an empty array when omitted. | | `test_mode` | boolean | `true` if the assessment was created with a sandbox API key. | ## Acting on the outcome [#acting-on-the-outcome] In standalone mode, you must implement these actions in your code. The Pay.com gateway does not apply them automatically when you use the assessment API. Use the `outcome` to decide what to do next before creating the charge. | Outcome | What to do | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `allow` | Proceed with [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge). | | `three_ds_exemption` | Proceed with the charge and request an SCA exemption. | | `three_ds_not_required` | Proceed with [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) without 3DS. | | `require_three_ds` | Authenticate the cardholder with [standalone 3DS authentication](/payments/3d-secure/standalone-authentication), then pass the session's `three_ds` results on the charge, in `source_data.card.three_ds`. | | `three_ds_challenge` | Start a 3DS flow and handle the interactive challenge before charging. | | `block` | Do not create the charge. Inform the customer that the transaction was declined. | ## Next steps [#next-steps] * [Risk reviews](/risk/risk-reviews): Handle transactions flagged for manual review after a charge succeeds. * [Rules](/risk/rules): Configure payment rules in the dashboard to control which outcomes the engine returns on each assessment. * [Advanced fraud screening](/risk/advanced-fraud-screening): Review how the fraud score, default threshold mapping, and screening flags work. * [Risk assessments API reference](/api-reference/endpoints/riskassessment/assess-payment): View the full endpoint and parameter reference. # Risk reviews (/risk/risk-reviews) A risk review is created when a transaction or a customer matches a [review rule](/risk/rules/review-rules) configured in the dashboard. The review doesn't block the payment. The charge succeeds immediately. Instead, the review flags the transaction or customer so you can investigate and then approve or decline it through the API. Risk reviews require the Standalone Risk feature to be enabled on your account. Contact Pay.com support to enable it. ## Requirements [#requirements] Risk reviews need three things in place: * Standalone Risk enabled on your account (contact Pay.com support) * A [review rule](/risk/rules/review-rules) configured in the dashboard * A [webhook endpoint](/developer-resources/webhooks) subscribed to the `review.transaction.created` event (and `review.customer.created` if you use customer review rules) ## How it works [#how-it-works] You configure the rule once. Then each flagged charge reaches you as a webhook event, and you resolve its review through the API. ### Configure a review rule [#configure-a-review-rule] Create a review rule in the Pay.com dashboard that targets the transactions you want to flag. When a charge matches the rule, Pay.com creates a review automatically after the charge succeeds. See [Review rules](/risk/rules/review-rules) for the conditions you can target and how to set them up. ### Receive the webhook [#receive-the-webhook] Pay.com sends a `review.transaction.created` event to your endpoint approximately 3-15 seconds after the charge is created. The `data.id` field contains the review ID you'll use in the next steps. ```json { "id": "evt_701808188143438848", "resource": "event", "type": "review.transaction.created", "created": "2026-04-21T14:55:11.021Z", "data": { "id": "rvw_701808188000832512", "resource": "review", "created": "2026-04-21T14:55:10.987Z", "expires": "2026-04-24T14:55:10.987Z", "reference": "chrg_701808118295692288", "reviewer_identifier": null, "reviewer_origin": null, "status": "pending_review", "status_reason": null, "test_mode": true, "type": "transaction" } } ``` The `data.reference` field contains the ID of the object that triggered the review, here a charge. Always verify the `Pay-Signature` header before processing the event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ### Retrieve the review [#retrieve-the-review] Use the review ID from the webhook to fetch the full review object. If you don't have the review ID, you can look it up by the ID of the flagged object instead: a charge, hold, refund, payout, or customer (`chrg_`, `hld_`, `rfnd_`, `po_`, or `cust_`). **If you have the review ID:** ```http GET /v1/risk/review/rvw_701808188000832512 ``` ```json { "id": "rvw_701808188000832512", "resource": "review", "created": "2026-04-21T14:55:10.987Z", "expires": "2026-04-24T14:55:10.987Z", "reference": "chrg_701808118295692288", "reviewer_identifier": null, "reviewer_origin": null, "status": "pending_review", "status_reason": null, "test_mode": true, "type": "transaction" } ``` **If you only have the charge ID** (returns a list, with an empty `data` array when no review exists): ```http GET /v1/risk/review/reference/chrg_701808118295692288 ``` ```json { "resource": "reviews", "data": [ { "id": "rvw_701808188000832512", "resource": "review", "created": "2026-04-21T14:55:10.987Z", "expires": "2026-04-24T14:55:10.987Z", "reference": "chrg_701808118295692288", "reviewer_identifier": null, "reviewer_origin": null, "status": "pending_review", "status_reason": null, "test_mode": true, "type": "transaction" } ] } ``` ### Resolve the review [#resolve-the-review] After investigating the transaction, call [`PUT /v1/risk/review/{review_id}`](/api-reference/endpoints/riskreview/resolve-risk-review) to approve or decline it. Both `status` and `status_reason` are required. The optional `reviewer_identifier` and `reviewer_origin` fields let you record who performed the review and from where. **To approve:** ```json { "status": "approved", "status_reason": "Customer verified via phone call", "reviewer_identifier": "agent@example.com", "reviewer_origin": "manual" } ``` ```json { "id": "rvw_701808188000832512", "resource": "review", "created": "2026-04-21T14:55:10.987Z", "expires": "2026-04-24T14:55:10.987Z", "reference": "chrg_701808118295692288", "reviewer_identifier": "agent@example.com", "reviewer_origin": "manual", "status": "approved", "status_reason": "Customer verified via phone call", "test_mode": true, "type": "transaction" } ``` **To decline:** ```json { "status": "declined", "status_reason": "Suspicious transaction pattern", "reviewer_identifier": "agent@example.com", "reviewer_origin": "manual" } ``` ```json { "id": "rvw_701808188000832512", "resource": "review", "created": "2026-04-21T14:55:10.987Z", "expires": "2026-04-24T14:55:10.987Z", "reference": "chrg_701808118295692288", "reviewer_identifier": "agent@example.com", "reviewer_origin": "manual", "status": "declined", "status_reason": "Suspicious transaction pattern", "test_mode": true, "type": "transaction" } ``` Resolving a review records your decision and sends a `review.transaction.reviewed` event (`review.customer.reviewed` for a customer review). It doesn't change the linked transaction. A charge stays `succeeded` whether you approve or decline. Declining is an internal record-keeping action. To reverse the funds, issue a refund separately. Reviews expire 3 days after creation (`review.transaction.expired`) and can no longer be resolved after that. You can resolve only a review whose status is `pending_review`. Updating an expired or already-resolved review returns a `400` error, and an unknown review ID returns a `404`. ## The review object [#the-review-object] The review object represents a flagged transaction or customer and tracks its status from creation to resolution. It is returned by [`GET /v1/risk/review/{review_id}`](/api-reference/endpoints/riskreview/get-risk-review) and included in the `review.*` webhook payloads. | Field | Type | Description | | --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | string | Unique identifier for the review (`rvw_...`). | | `resource` | string | Always `"review"`. | | `created` | string | ISO 8601 timestamp when the review was created. | | `expires` | string | ISO 8601 timestamp when the review expires, 3 days after `created`. | | `reference` | string | The ID of the flagged object: a charge, hold, refund, or payout (`chrg_`, `hld_`, `rfnd_`, `po_`) for transaction reviews, or a customer (`cust_`) for customer reviews. | | `status` | string | Current status: `pending_review`, `approved`, `declined`, or `expired` after 3 days without a decision. | | `status_reason` | string | The reason provided when the review was resolved. `null` until resolved. | | `reviewer_identifier` | string | Identity of the person who resolved the review. `null` until resolved. | | `reviewer_origin` | string | Source of the resolution, for example `"manual"`. `null` until resolved. | | `type` | string | `"transaction"` or `"customer"`. | | `test_mode` | boolean | `true` if the review was created in the sandbox. | ## Next steps [#next-steps] * [Review rules](/risk/rules/review-rules): configure the rules that trigger reviews. * [Risk assessments](/risk/risk-assessments): score a payment before charging it to decide how to proceed. * [Risk reviews API reference](/api-reference/endpoints/riskreview/get-risk-review): see the full technical reference for all review endpoints. # Test risk events (/risk/test-risk-events) In the live environment, disputes, collaborations, and fraud warnings are created by card networks and payment processors, not by you. Pay.com receives each event and notifies you via webhook, updating the dashboard at the same time. In the sandbox, Pay.com provides simulate endpoints so you can trigger these events against a test charge and verify that your integration handles them correctly. ## How simulation works [#how-simulation-works] Simulate endpoints work only in the sandbox. In the live environment, they return `403`. When you call one, the API responds with `204 No Content` and returns no object. Pay.com creates the risk event, delivers the corresponding webhook to your registered endpoint, and updates the dashboard. Take the new object's ID from the webhook payload. Always verify the `Pay-Signature` header before processing any event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Before you start [#before-you-start] To run the simulate calls, you need: * A charge created in the sandbox. Follow the steps in [Create a charge](/payments/create-a-charge) to get a `chrg_...` ID. * A webhook endpoint registered in Pay.com. See [Webhooks](/developer-resources/webhooks) to configure an endpoint, then subscribe to the events you want to test. ## Simulate a dispute [#simulate-a-dispute] Use the [Simulate dispute](/api-reference/endpoints/disputes/simulate-dispute) endpoint to create a test dispute on a sandbox charge or move an existing dispute to another status. Pass the status in the path, not the request body. `POST /v1/charges/{charge_id}/simulate/dispute` creates an `open` dispute, and `POST /v1/charges/{charge_id}/simulate/dispute/{status}` sets the status you name. For all 15 supported statuses, eligible payment methods, and a full lifecycle test, see [Simulate a dispute in the sandbox](/risk/disputes/events-and-testing#simulate-a-dispute-in-the-sandbox). ```http POST /v1/charges/chrg_692434850019280896/simulate/dispute ``` Returns `204 No Content`. Pay.com creates a dispute with `status: "open"` and delivers a `dispute.open` webhook to your endpoint. ```http POST /v1/charges/chrg_692434850019280896/simulate/dispute/won ``` Returns `204 No Content`. Use this to test the path where the issuing bank accepts your defense and the funds are returned. ```http POST /v1/charges/chrg_692434850019280896/simulate/dispute/lost ``` Returns `204 No Content`. Use this to test the path where the issuing bank rejects your defense. ### Webhook payload [#webhook-payload] When the dispute is created, Pay.com delivers a `dispute.open` event to your endpoint. The `evidence_required_by` field shows the deadline to submit evidence. Amounts are in the currency's smallest unit, so `5000` is $50.00 USD. ```json { "id": "evt_692434889852583936", "resource": "event", "type": "dispute.open", "created": "2026-03-26T18:09:02.560Z", "data": { "id": "dspt_692434889303132160", "resource": "dispute", "amount": 5000, "amount_human_readable": "50.00", "arn": "80597117747", "charge": "chrg_692434850019280896", "chargeback_type": "chargeback", "created": "2026-03-26T18:09:02.414Z", "currency": "usd", "evidence_required_by": "2026-04-02T00:00:00.000Z", "evidences": { "data": [], "url": "/v1/disputes/dspt_692434889303132160/evidences" }, "metadata": {}, "reason": "consumer_disputes", "reason_code": "4841", "status": "open", "test_mode": true } } ``` Use `data.id` (the `dspt_...` ID) to take action on the dispute: * [Get the dispute](/api-reference/endpoints/disputes/get-dispute-by-id) to inspect its full details, including the response deadline and linked charge. * [Accept the dispute](/api-reference/endpoints/disputes/accept-dispute) to concede the chargeback. This action is irreversible. * [Submit evidence](/api-reference/endpoints/disputes/submit-dispute-evidence) to defend the dispute, or [bulk defend](/api-reference/endpoints/disputes/bulk-defend-disputes) to apply shared documents across several disputes. ## Simulate a collaboration [#simulate-a-collaboration] Use the [Simulate collaboration](/api-reference/endpoints/collaborations/simulate-collaboration) endpoint to create a test collaboration alert on an existing charge. The `source` field controls which collaboration service is simulated: `mc_collaboration` (the default), `ethoca`, or `cdrn`. The `actionable_by` field sets the response deadline and defaults to 15 days from now. ```json title="POST /v1/charges/chrg_692357623269296128/simulate/collaboration" { "source": "mc_collaboration", "actionable_by": "2026-04-05T10:30:00Z" } ``` Returns `204 No Content`. ```json title="POST /v1/charges/chrg_692357623269296128/simulate/collaboration" { "source": "ethoca", "actionable_by": "2026-04-05T10:30:00Z" } ``` Returns `204 No Content`. ```json title="POST /v1/charges/chrg_692357623269296128/simulate/collaboration" { "source": "cdrn", "actionable_by": "2026-04-05T10:30:00Z" } ``` Returns `204 No Content`. ### Webhook payloads [#webhook-payloads] When the alert arrives, Pay.com delivers a `collaboration.open` event to your endpoint. The `actionable_by` field shows the deadline to respond. ```json { "id": "evt_692431062717956096", "resource": "event", "type": "collaboration.open", "created": "2026-03-26T17:53:50.101Z", "data": { "id": "clbr_692431062306915328", "resource": "collaboration", "actionable_by": "2026-04-05T10:30:00.000Z", "amount": 9500, "amount_human_readable": "95.00", "charge": "chrg_692357623269296128", "created": "2026-03-26T17:53:50.001Z", "currency": "usd", "source": "mc_collaboration", "status": "open", "test_mode": true } } ``` Use `data.id` (the `clbr_...` ID) to take action on the collaboration: * [Get the collaboration](/api-reference/endpoints/collaborations/get-collaboration) to inspect its status, amount, and remaining response window. * [Ignore the collaboration](/api-reference/endpoints/collaborations/ignore-collaboration) to decline to act. Its status becomes `ignored`. * [Refund the collaboration](/api-reference/endpoints/collaborations/refund-collaboration) to resolve the alert before it escalates to a chargeback. After the refund, Pay.com delivers a `collaboration.resolved` event: ```json { "id": "evt_692433893155931136", "resource": "event", "type": "collaboration.resolved", "created": "2026-03-26T18:05:04.929Z", "data": { "id": "clbr_692431062306915328", "resource": "collaboration", "actionable_by": "2026-04-05T10:30:00.000Z", "amount": 9500, "amount_human_readable": "95.00", "charge": "chrg_692357623269296128", "created": "2026-03-26T17:53:50.001Z", "currency": "usd", "source": "mc_collaboration", "status": "resolved", "test_mode": true } } ``` ## Simulate a fraud warning [#simulate-a-fraud-warning] Use the [Simulate fraud warning](/api-reference/endpoints/fraudwarnings/simulate-fraud-warning) endpoint to create a test fraud warning on an existing charge. Set `actionable` to `true` to simulate a warning where you can still refund the charge. Set it to `false` to simulate a warning where the actionable window has already passed. All body fields are optional. `type` defaults to `made_with_lost_card`, and `actionable` defaults to `false`. The fraud warning's ID is `frdwrn_` followed by the charge ID's digits. ```json title="POST /v1/charges/chrg_692434592824557568/simulate/fraud_warning" { "type": "made_with_lost_card", "input_method": "swiped", "actionable": false, "raw_code": "7523" } ``` The resulting warning has `actionable: false`, meaning no further action is possible. ```json title="POST /v1/charges/chrg_692434592824557568/simulate/fraud_warning" { "type": "made_with_stolen_card", "actionable": true } ``` The resulting warning has `actionable: true`, meaning you can still refund the charge to prevent a formal chargeback. For the full list of supported `type` values, see the [Simulate fraud warning](/api-reference/endpoints/fraudwarnings/simulate-fraud-warning) API reference. ### Webhook payload [#webhook-payload-1] When the fraud warning is created, Pay.com delivers a `fraud_warning.created` event to your endpoint. Check `actionable` first to decide whether to issue a refund. When it is `true`, use `data.charge` to retrieve the transaction and issue a refund before a formal chargeback is filed. ```json { "id": "evt_692434631277939712", "resource": "event", "type": "fraud_warning.created", "created": "2026-03-26T18:08:01.011Z", "data": { "id": "frdwrn_692434592824557568", "resource": "fraud_warning", "actionable": true, "amount": 6000, "amount_human_readable": "60.00", "charge": "chrg_692434592824557568", "created": "2026-03-26T18:08:00.504Z", "currency": "usd", "fraud_type": "made_with_stolen_card", "payment_method": "pm_card_692434600374304768", "payment_method_details": { "card": { "bin": "555555", "brand": "mastercard", "last4": "4444", "exp_month": "12", "exp_year": "2028", "network": "mastercard", "country": "CY" }, "type": "card" }, "reference": null, "test_mode": true } } ``` ## Next steps [#next-steps] * [Disputes](/risk/disputes): Manage the full chargeback lifecycle when a dispute is filed. * [Collaborations](/risk/collaborations): Handle pre-dispute alerts and refund within the response window. * [Fraud warnings](/risk/fraud-warnings): Act on fraud signals before they escalate. * [Webhooks](/developer-resources/webhooks): Configure endpoints and verify payload signatures. * [Webhook events](/api-reference/webhooks/webhook-events): Browse the full list of event types. # Account billing updater (/payments/account-billing-updater) The account billing updater queries the card network's account updater service to check whether a saved Visa or Mastercard card has updated details, such as a new expiration date or replacement card number. When new details are available, Pay.com updates the saved `pm_card_` payment method in place and sends the `payment_method.updated` webhook event. An update preserves the payment method ID, so you continue charging or paying out to the same `pm_card_` identifier. Pay.com updates the card's expiration date and, when the card number changes, its last four digits, BIN, and fingerprint. If you use [network tokens](/payments/network-tokens), tokens stay current automatically when an issuer replaces a card without requiring an account updater lookup. | Trigger | How it runs | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Automatic on decline | Configure `payment_method_options.card.account_billing_updater` to check the card after an eligible decline and optionally retry the payment. | | On request | Call [`POST /v1/payment_methods/account_billing_updater`](/api-reference/endpoints/paymentmethods/account-billing-updater) to check one card synchronously before charging or paying out. | ## Automatic updates on decline [#automatic-updates-on-decline] Set `payment_method_options.card.account_billing_updater` on a charge or hold, or as an [account default](/payments/payment-method-options/merchant-defaults), to query the card network automatically when an issuer declines a Visa or Mastercard payment for a reason updated card details can resolve. | Field | Type | Description | | ------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------- | | `enabled` | boolean | Queries the card network's account updater after an eligible decline. | | `retry_after_update` | boolean | Retries the payment once when the update returns new details that can resolve the decline. | | `billing_updater_decline_codes` | array of strings | Additional [decline codes](/payments/concepts/declines) that start an update, added to the default codes. | ```json title="payment_method_options" { "card": { "account_billing_updater": { "enabled": true, "retry_after_update": true, "billing_updater_decline_codes": ["do_not_honour"] } } } ``` ### Eligible declines and retry behavior [#eligible-declines-and-retry-behavior] Pay.com checks the card with the account updater when either condition is met: * The decline code is `expired_card`, `invalid_expiry_month`, `invalid_expiry_year`, or one of your `billing_updater_decline_codes`. * The card network returns advice code `01` (new account details available from Visa or Mastercard), regardless of the decline code. When a decline triggers an account updater lookup, Pay.com doesn't route the payment to a fallback processor. With `retry_after_update: true`, Pay.com waits for the network response and retries the payment once when the new details can fix the decline: * **New card number:** Pay.com retries after any eligible decline. * **New expiration date only:** Pay.com retries only after `expired_card`, `invalid_expiry_month`, or `invalid_expiry_year`. Other declines apply to the same card number and would decline again. The retry runs on the same charge or hold. Its final status reflects the retry outcome, and the original declined attempt appears in `retry_attempts`. When `retry_after_update` is `false` or omitted, Pay.com runs the update in the background while the payment remains declined. If new details are returned, Pay.com updates the payment method and sends `payment_method.updated` so you can charge the card again. ## On-request updates [#on-request-updates] Call [`POST /v1/payment_methods/account_billing_updater`](/api-reference/endpoints/paymentmethods/account-billing-updater) to check a card with the card network's account updater before charging or paying out. Pay.com waits for the answer, updates the payment method if the card has new details, and returns it. ### Requirements [#requirements] Before you start, make sure you have: * Your [API credentials](/get-started/api-keys) and [environment base URL](/get-started/environments) (sandbox: `https://api.sandbox.pay.com/v1`, with an `sk-pay-com-sandbox-` key). * A unique [`idempotency-key`](/developer-resources/idempotency-and-retries) header for each `POST` request. * An API key enabled for raw card data, if you send card details (`type: "card"`) instead of a saved payment method or a card token. ### Choose the card [#choose-the-card] Set `type` to specify how you identify the card: | `type` | Request fields | Result | | -------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------- | | `source` | `source`: a saved payment method ID (`pm_card_…`) or card token (`tok_card_…`) | Updates that payment method in place. | | `token` | `token.id`: a card token or imported card `reference` | Saves the card as a payment method for the customer, then updates it. | | `card` | `card`: raw card details | Saves the card as a payment method for the customer, then updates it. | With `token` or `card`, send `customer_reference_id` to save the payment method for that customer. A payment method saved this way works for both payments and payouts. Optionally pass `settlement_account` to run the lookup through a specific settlement account instead of your default for the currency. ### Update the card [#update-the-card] This request checks a saved payment method. ```json title="POST /v1/payment_methods/account_billing_updater" { "type": "source", "source": "pm_card_296645958265997316" } ``` ```json { "id": "pm_card_296645958265997316", "resource": "payment_method", "type": "card", "customer_reference_id": "cust_ext_abc123", "card": { "brand": "visa", "last4": "4242", "exp_month": "09", "exp_year": "2031" } } ``` The endpoint returns HTTP `200` with the payment method object. When the card network has new details, the returned card includes them and Pay.com sends `payment_method.updated`. When no new details are available, or when the card isn't Visa or Mastercard, the payment method remains unchanged. ### Errors [#errors] In addition to field validation errors, the endpoint returns `400` in these cases: | Message | Cause | | ------------------------- | --------------------------------------------- | | `Invalid source provided` | `source` belongs to another account. | | `Invalid card provided` | Pay.com can't find the referenced card token. | ## Refresh a card before a payout [#refresh-a-card-before-a-payout] Card payouts accept `payout_method_options.card.account_billing_updater` with the same schema as payments, but a declined payout doesn't start an automatic update. To send a payout to a card's current details, call the on-request endpoint first and then create the payout using the same `pm_card_` ID. ### Refresh the saved card [#refresh-the-saved-card] Call [`POST /v1/payment_methods/account_billing_updater`](/api-reference/endpoints/paymentmethods/account-billing-updater) with the card's `pm_card_` ID in `source`. ```json title="POST /v1/payment_methods/account_billing_updater" { "type": "source", "source": "pm_card_296645958265997316" } ``` ### Create the payout [#create-the-payout] Send the payout to the same payment method with [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout). Amounts are in minor units, so `5000` is $50.00 USD. ```json title="POST /v1/payouts" { "amount": 5000, "currency": "usd", "destination": "pm_card_296645958265997316" } ``` ## Webhooks [#webhooks] Pay.com sends the `payment_method.updated` event whenever an automatic or on-request update modifies a saved card. Read the updated card details from the event payload, or retrieve the payment method with [`GET /v1/payment_methods/{id}`](/api-reference/endpoints/paymentmethods/retrieve-payment-method). See [Webhooks](/developer-resources/webhooks) to set up an endpoint and verify signatures. ## Next steps [#next-steps] * [Network tokens](/payments/network-tokens): Keep saved cards working automatically across replacements with VTS, MDES, and AETS. * [Merchant defaults](/payments/payment-method-options/merchant-defaults): Turn on automatic updates on decline for every payment. * [Declines](/payments/concepts/declines): Review decline codes you can add to `billing_updater_decline_codes`. * [Create a payout](/payouts/create-a-payout): Send payouts to saved cards and bank accounts. # Accept payments in your Android app (/payments/android) To take a payment in the sandbox, your server creates a payment session, the app takes the payment, and your server confirms the result. Show the drop-in, which takes the least code, or build your own screen. The [Android SDK](/sdks/android) reference describes the modules used here. | | [Drop-in](/sdks/android/paydropin-present) (recommended) | Your own UI | | ---------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | **What you build** | A button that presents Pay.com's sheet | A screen, from the [payment methods](/sdks/android/checkout-payment-methods) and the [card fields](/sdks/android/card-fields) | | **Payment methods** | Cards, redirect methods, and Google Pay | The ones you show | | **Errors and retries** | The sheet shows them | You show them | | **Look** | Material 3, or [your colors and shapes](/sdks/android/paydropin-appearance) | Yours | Both show the customer's saved methods at checkout. The drop-in shows them [in a carousel](/sdks/android/paydropin-present#a-returning-customer), and your own screen shows them as in [Pay with a saved payment method](/sdks/android/checkout-pay-with-saved-payment-method). ### Create a payment session on your server [#create-a-payment-session-on-your-server] Call [Create a payment session](/api-reference/endpoints/paymentsessions/create-ps) with your sandbox key. `amount`, `currency`, and `customer_reference_id` (your own identifier for the customer) are required. Amounts are in minor units. For example, `1000` is $10.00. ```bash curl -X POST https://api.sandbox.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "amount": 1000, "currency": "usd", "customer_reference_id": "cust-001" }' ``` Send only the `client_secret` from the response to the app. Never put your API key in the app. ### Add the SDK [#add-the-sdk] Add the modules for the UI you choose. See [Install](/sdks/android#install). * **The drop-in:** `pay-dropin`, which brings in the others it needs. * **Your own UI:** `pay-elements` and `pay-threeds`. ### Register the return URL [#register-the-return-url] Redirect payment methods return the customer to your app through a deep link or an App Link. Declare it on the activity that takes the payment, and keep one instance of that activity so the deep link reaches it: ```xml ``` ### Start a checkout [#start-a-checkout] `PayCheckout.create` checks the `client_secret` and loads the session. It's a `suspend` function, so call it from a coroutine, and it throws a `PayError` when it fails. ```kotlin import com.pay.sdk.core.PayCheckout import com.pay.sdk.core.PayError import com.pay.sdk.core.PayResult val checkout = PayCheckout.create( clientSecretFromYourServer, PayCheckout.Configuration(returnUrl = "myshop://pay"), ) // The session's payment methods, in the order the API returns them. val methods = checkout.paymentMethods() ``` Live and sandbox sessions use the same configuration. ### Take the payment [#take-the-payment] Present the drop-in, or build your own card form and call `pay`. Present the sheet over your activity when the customer taps your checkout button. It shows the session's methods, the card form, and any failure. It also runs 3DS and closes when the payment is done. ```kotlin import com.pay.sdk.dropin.PayDropIn val dropIn = PayDropIn(checkout, PayDropIn.Configuration(merchantDisplayName = "My Shop")) lifecycleScope.launch { when (val result = dropIn.present(this@CheckoutActivity)) { is PayResult.Succeeded -> showReceipt(result.ids) // A hint: your server verifies before fulfilling is PayResult.Processing -> showPending(result.ids) // Your server decides PayResult.Canceled -> Unit // The customer closed the sheet is PayResult.Failed -> show(result.error) // The session can't be paid any more } } ``` To show Google Pay in the sheet, set the configuration's `googlePay`. [Present the drop-in](/sdks/android/paydropin-present) has the options and what the customer sees, and you can change its [look](/sdks/android/paydropin-appearance) and [text](/sdks/android/paydropin-strings). Give the same `PayCardController` to each field and enable your pay button when the card is complete. The app never reads what the customer types into these fields. See [Card fields](/sdks/android/card-fields). ```kotlin import com.pay.sdk.core.PayPaymentRequest import com.pay.sdk.elements.PayCardController import com.pay.sdk.elements.PayCardNumberField import com.pay.sdk.elements.PayCvcField import com.pay.sdk.elements.PayExpiryField import com.pay.sdk.threeds.pay // checkout.pay(request, activity) val card = remember { PayCardController() } val state by card.state.collectAsState() Column { PayCardNumberField(card) Row { PayExpiryField(card, Modifier.weight(1f)) PayCvcField(card, Modifier.weight(1f)) } Button(onClick = { pay(card) }, enabled = state.isComplete) { Text("Pay") } } ``` Then call `pay` from `pay-threeds` with the card and the activity that shows 3DS challenges and redirects. It needs `import com.pay.sdk.threeds.pay`, shown above. Without it, the call won't compile. ```kotlin lifecycleScope.launch { val result = try { checkout.pay(PayPaymentRequest.Card(card), this@CheckoutActivity) } catch (e: PayError) { // Nothing was sent: the card is incomplete or a payment is already running. return@launch show(e) } when (result) { is PayResult.Succeeded -> showReceipt(result.ids) // A hint: your server verifies before fulfilling is PayResult.Processing -> showPending(result.ids) // Your server decides PayResult.Canceled -> Unit // The customer closed the 3DS or redirect screen is PayResult.Failed -> show(result.error) } } ``` `pay` throws a `PayError` only when nothing was sent (`PayError.InvalidCardInput` or `PayError.PaymentInProgress`). Anything that happens after a request leaves the device comes back as a `PayResult`. When your server changes the amount, [refresh the session](/sdks/android/checkout-refresh-session) and show the new total before the customer pays. ### Pass return URLs to the SDK [#pass-return-urls-to-the-sdk] In `onCreate` and `onNewIntent`, pass the deep link back: ```kotlin override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) intent.data?.let { PayCheckout.handleReturn(it.toString()) } } ``` It's safe to call with any URL. It returns `true` only when the URL belongs to a Pay.com flow in progress. ### Confirm the payment on your server [#confirm-the-payment-on-your-server] `PayResult` reflects only client-side state. Before you fulfill the order, retrieve the session with [Retrieve a payment session](/api-reference/endpoints/paymentsessions/get-ps-by-id) or wait for the signed `payment_session.completed` [webhook](/api-reference/webhooks/webhook-events). Use the session ID your server got when it created the session. If you offer payment methods that redirect, your server must create the session with `return_url` set to the same URL as `returnUrl`. # Create a charge (/payments/create-a-charge) Send a `POST /v1/charges` request from your server to authorize and capture a payment immediately. Use this server-to-server flow when you charge a saved payment method (`pm_…`), a card token (`tok_card_…`), or raw card details under full PCI DSS compliance (SAQ-D). Building a browser checkout? Use [Universal checkout](/payments/universal-checkout) or [Headless checkout](/payments/headless-checkout) with Pay.com.js instead, so raw card details never touch your server. ## Requirements [#requirements] Before you start, make sure you have: * Your [API credentials](/get-started/api-keys). The examples use the sandbox (`https://api.sandbox.pay.com/v1`) with an `sk-pay-com-sandbox-` key. * A unique [`idempotency-key`](/developer-resources/idempotency-and-retries) header for each `POST` request. * PCI DSS SAQ-D compliance if you send raw card numbers in `source_data.card`. ## Process a charge [#process-a-charge] Follow these steps to create a charge, inspect its status, and handle 3D Secure authentication when required. ### Send the charge request [#send-the-charge-request] Call [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `amount` (in minor units, so `8000` equals $80.00 USD), `currency`, and a payment source: * `source`: A saved payment method ID (`pm_…`) or a card token (`tok_card_…`). * `source_data`: Raw card details, an alternative payment method, or an encrypted Apple Pay or Google Pay payload. The duplicate card check declines a card that another customer already uses. `duplicate_card_check: false` turns it off for the request, so the sandbox doesn't decline a test card number you've used before (`decline_code: duplicate_card`). Leave the option out of live requests, so the check stays on. `POST https://api.sandbox.pay.com/v1/charges` ```json { "amount": 8000, "currency": "usd", "source_data": { "type": "card", "card": { "number": "4242424242424242", "expiry_month": "12", "expiry_year": "2028", "cvv": "123", "name": "John Smith" } }, "payment_method_options": { "card": { "duplicate_card_check": false } } } ``` ```json { "id": "chrg_685125114794084352", "resource": "charge", "amount": 8000, "amount_human_readable": "80.00", "currency": "usd", "status": "succeeded", "paid": false, "payment_method": "pm_card_685125127054035968", "payment_method_details": { "type": "card", "card": { "brand": "visa", "last4": "4242", "exp_month": "12", "exp_year": "2028", "funding": "debit", "network": "visa" } }, "created": "2026-03-06T14:02:39.261Z", "test_mode": true } ``` The `paid` boolean indicates whether funds have settled to your bank account, not whether the charge was approved. A newly approved charge returns `status: "succeeded"` with `paid: false`. Always check `status` to confirm approval. ### Check the payment status [#check-the-payment-status] Inspect the `status` field in the `201` response: * `succeeded`: The charge was approved and the funds are captured. Settlement to your bank account happens later (see `paid`). * `pending`: The charge is waiting for confirmation, as with asynchronous methods such as SEPA or ACH. * `requires_authentication`: The customer must complete a 3D Secure challenge or a bank login before the funds can be captured. This happens when regulations such as PSD2 require it, when you enforce 3D Secure for fraud prevention, or when an alternative payment method needs a bank login. Complete the next step. * `requires_confirmation`: Authentication is complete. [Confirm the charge](/api-reference/endpoints/charges/confirm-charge) to finish it. * `succeeded_partially`: The charge was approved for less than the requested amount. See [Handle partial approvals](/payments/partial-approvals). * `requires_partial_approval_action`: The charge was partially approved and server-to-server partial approval is on. Confirm or cancel the partial amount, as [Handle partial approvals](/payments/partial-approvals) describes. * `awaiting_final_confirmation`: The payment method approved the charge, but its final confirmation is still pending. Wait for the final status before you fulfill the order. A declined charge (`failed`) and a charge a risk rule blocked (`blocked`) both return HTTP `400` with `error.type: "payment_method_error"`, `error.code: "card_declined"`, and a `decline_code`. The charge is still created, so you can retrieve it to see its status. See [Decline codes](/payments/concepts/declines). ### Handle customer authentication (when required) [#handle-customer-authentication-when-required] If `status` is `requires_authentication`, call [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge ID in `resource`. Set `confirm` based on whether Pay.com completes the charge automatically after the challenge: Pay.com authorizes the charge automatically after the customer completes the challenge and sends a `charge.succeeded` or `charge.failed` webhook. No additional API call is needed. `POST https://api.sandbox.pay.com/v1/sessions/authentication/linked` ```json { "resource": "chrg_686511994907394048", "confirm": true, "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_686512987359412224", "resource": "authentication_session", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://sca.pay.com/authenticate?client_secret=eyJhbGciOiJIUzUxMiJ9...", "test_mode": true } ``` Redirect the customer to `url`. Pay.com finishes authorization after the challenge and sends the result in a webhook. Pay.com redirects the customer to your `return_url` after the challenge without capturing funds. Use this option when you need to run inventory or fraud checks before calling [`POST /v1/charges/{charge_id}/confirm`](/api-reference/endpoints/charges/confirm-charge). `POST https://api.sandbox.pay.com/v1/sessions/authentication/linked` ```json { "resource": "chrg_686511724072799232", "confirm": false, "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_686512328534917120", "resource": "authentication_session", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://sca.pay.com/authenticate?client_secret=eyJhbGciOiJIUzUxMiJ9...", "test_mode": true } ``` Redirect the customer to `url`. When they return to `return_url`, confirm the charge from your server: `POST https://api.sandbox.pay.com/v1/charges/chrg_686511724072799232/confirm` ```json {} ``` ```json { "id": "chrg_686511724072799232", "resource": "charge", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "status": "succeeded", "payment_method_details": { "type": "card", "card": { "brand": "mastercard", "last4": "1096", "three_d_secure": { "authentication_flow": "challenge", "eci": "02", "liability_shift": true, "result": "success", "result_reason": "authenticated", "version": "2.2.0" } } }, "test_mode": true } ``` ## Listen for webhooks [#listen-for-webhooks] Confirm payment outcomes on your backend through webhooks rather than relying only on synchronous responses. Subscribe to: * `charge.succeeded`: Funds are captured. Fulfill the order. * `charge.failed`: The charge was declined or couldn't complete. Verify the `Pay-Signature` header on every incoming event before acting on it. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures) and [Webhook events](/api-reference/webhooks/webhook-events). ## Next steps [#next-steps] Related payment guides: * [Universal checkout](/payments/universal-checkout): Embed a hosted Pay.com.js checkout form (SAQ-A). * [Create a charge with 3DS](/payments/3d-secure/charge-with-3ds): Pass browser metadata and enforce 3D Secure for PSD2 or fraud prevention. * [Hold and capture](/payments/hold-and-capture): Authorize funds first and capture later. * [Refund a charge](/payments/refunds): Return full or partial funds on a settled charge. * [Wallets](/payments/wallets/api): Process Apple Pay and Google Pay tokens server-to-server. # Express checkout (/payments/express-checkout) `checkout.express()` places Apple Pay and Google Pay buttons anywhere on your site, such as a product page or the cart, outside Universal checkout. The customer picks a shipping address and option in the wallet sheet, you return the shipping options and totals, and you create the order in `beforePay`. The SDK pays only when the session charges exactly the total the customer approved. `beforePay` is a checkout option that runs right before money moves, for almost every payment method, not only express checkout. Your page shows the product name and price. Google Pay renders the button. ## Add express checkout [#add-express-checkout] Pass `beforePay` to `pay.checkout()`, then call `checkout.express()` with the container, the line items, the total, and the shipping callbacks: ```ts const checkout = pay.checkout({ clientSecret, onSuccess: (payment) => showConfirmation(payment), onFailure: (error) => showError(error.message), beforePay: async ({ express, payer }) => { // Create the order and set the session amount to the approved total, on your server. const order = await createOrder({ payer }) return order.ok ? true : { proceed: false, message: 'This item just sold out.' } }, }) const buttons = checkout.express({ container: '#express-checkout', request: { shipping: true, email: true }, lineItems: [{ label: 'Coffee beans', amount: '18.00' }], total: { amount: '18.00' }, onShippingAddressChange: async (address) => { const rates = await getShippingRates(address) if (!rates.length) { return { error: { reason: 'address_unserviceable', message: "We don't ship there yet." } } } return { shippingOptions: rates, // The first option is preselected total: { amount: addAmounts('18.00', rates[0].amount) }, } }, onShippingOptionChange: async (option) => ({ total: { amount: addAmounts('18.00', option.amount) }, }), }) const wallets = await buttons.ready // ['applepay', 'googlepay'], or [] when neither can show ``` Express checkout amounts are decimal strings in major units, such as `'18.00'`, because that's what the wallet sheets show. Pay.com API amounts are in minor units, so the same $18.00 is `1800`. For every option, the button style, and what `checkout.express()` returns, see [`checkout.express()`](/sdks/pay-com-js/checkout-express). ### When buttons don't show [#when-buttons-dont-show] A wallet's button renders only when the session offers that wallet and the browser can pay with it. Apple Pay also needs the page on HTTPS, and a browser where `ApplePaySession.supportsVersion(11)` is `true`. Express checkout needs a payment session. With a setup session, `ready` resolves with no wallets. `ready` rejects when `container` matches nothing or the session can't load. The SDK only logs a console warning, so catch the rejection, for example to hide the area the buttons would fill. ## How a payment runs [#how-a-payment-runs] An express payment goes through five steps, from the tap to the charge: ### The customer taps a button [#the-customer-taps-a-button] `onClick` runs synchronously, because wallets open their sheet only inside the tap. Return `false` to keep the sheet closed, or return an update for the sheet to open with. A promise returned from `onClick` is ignored. ### The sheet opens [#the-sheet-opens] It shows `total` and `lineItems`, including any changes from `update()` calls and from what `onClick` returned. By default the total is the session amount and its label is your merchant name. ### The customer picks shipping [#the-customer-picks-shipping] `onShippingAddressChange` gets the address and returns the shipping options and the new total, or an error for the sheet to show. While the sheet is open, the address is partial. Apple Pay hides the street and the name until the customer approves. `onShippingOptionChange` returns the total for the option the customer picked. ### The customer approves [#the-customer-approves] `beforePay` runs with `express: true` and the `payer` the sheet collected. Create the order here, and update the session amount on your server with [Update a payment session](/api-reference/endpoints/paymentsessions/update-ps) to the approved total, in minor units. ### The SDK checks the amount and pays [#the-sdk-checks-the-amount-and-pays] The SDK reads the session again. If its currency or amount differs from the total the customer approved, it refuses to pay and the sheet shows "The amount to pay changed. Please review your order and try again". This refusal calls `onFailure` and emits `payment_failure`, with `data.code` set to `'amount_changed'`. Otherwise it pays, and calls `onSuccess` (or `onPending`) and emits `payment_success` (or `payment_pending`), as for any other method. A failure calls `onFailure`. The payment stays with the session the sheet opened for. If your page moves the checkout to another session before the charge, for example by calling `pay.checkout()` again, nothing is paid. If you don't set `beforePay`, update the session amount in `onShippingAddressChange` and `onShippingOptionChange` instead, so it matches the total the customer sees. Apple Pay times out the sheet about 30 seconds after the customer approves. To stay inside that window, `beforePay` gets 15 seconds for Apple Pay (wherever the button is) and for Google Pay in express checkout. An Apple Pay payment must also start within 20 seconds of approval. Google Pay elsewhere has no limit, because its sheet has closed by the time `beforePay` runs. Past either limit, nothing is charged and the sheet tells the customer to try again, so make `beforePay` safe to run twice for the same order. A `beforePay` that runs out of time stops the payment as if it returned `{ proceed: false }`, so `onFailure` isn't called. A missed Apple Pay start calls `onFailure` and emits `payment_failure`, with `data.code` set to `'timed_out'`. ## Use beforePay [#use-beforepay] `beforePay` is a `pay.checkout()` option. It runs once per payment attempt, right before money moves, for every method: card forms, saved sources, Click to Pay, wallets, alternative payment method buttons, `checkout.headless()` calls, and express checkout. On PayPal's own button, from `checkout.paypal()`, it runs before PayPal creates the order. Use it to create the order, or to stop the payment. ```ts const checkout = pay.checkout({ clientSecret, beforePay: async (data) => { const ok = await reserveStock(data.paymentMethodType) return ok ? true : { proceed: false, message: 'Some items are no longer available.' } }, }) ``` Return `true` to let the payment go ahead, or `{ proceed: false, message }` to stop it before any money moves. Express checkout sheets show `message` to the customer. A payment that `beforePay` stopped isn't a declined payment, so `onFailure` isn't called. An approval counts only for the session the checkout was on when `beforePay` ran. If `pay.checkout()` moves to another session in the meantime, nothing is paid. See [`beforePay`](/sdks/pay-com-js/before-pay#errors). With `beforePay` set, `checkout.pay()` and `checkout.headless()` for cards, alternative payment methods, and Click to Pay emit `payment_processing` only after `beforePay` lets the payment go ahead. Without it, they emit `payment_processing` when the payment starts. Express checkout emits it only after `beforePay` lets the payment go ahead. For the data `beforePay` receives, every value it can return, and how a stop reaches `checkout.headless()` and `checkout.pay()`, see [`beforePay`](/sdks/pay-com-js/before-pay). # Find your use case (/payments/find-your-use-case) Pay.com offers four ways to integrate. Three of them use [Pay.com.js](/sdks/pay-com-js) in your web page. Universal checkout, Headless checkout, and Tokenization share the same package, initialized and used differently. The fourth, the server-to-server API, runs from your server alone. Which one fits depends on how much control you want over the checkout your customers see, and on the PCI compliance your business already has in place. All four share the same platform and token vault, so you can move between them as your requirements change. Universal checkout and Headless checkout use the same payment session flow. The server-to-server API creates charges and holds directly, with no session. Tokenization uses a separate session type and supports cards only, so moving to or from it takes more development work. ## Compare the integrations [#compare-the-integrations] The four integrations differ in who builds the checkout, the PCI scope you take on, and the payment methods they support. | | [Universal](/payments/universal-checkout) | [Headless](/payments/headless-checkout) | [Tokenization](/payments/set-up-a-card/tokenize-a-card) | [Server-to-server](/payments/create-a-charge) | | --------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- | | **Who builds the checkout** | Pay.com renders and manages it | You | You, for card capture only | You | | **PCI scope** | SAQ-A (22 controls) | SAQ-A-EP (139 controls) | SAQ-A-EP (139 controls) | SAQ-D / Level 1 | | **Effort** | Low (prebuilt UI, minimal frontend code) | Medium (you build the UI, and Pay.com.js sends card data to Pay.com) | Medium (client-side tokenization, plus separate API calls for payments) | High (full backend integration, PCI certification required) | | **Takes the payment** | Yes | Yes | No. Your server uses the token in a separate API call. | Yes | | **Payment methods** | All supported payment methods | All supported payment methods | Cards only | Cards, wallets, bank redirects, and other alternative payment methods | | **3D Secure** | Handled by Pay.com.js | Handled by Pay.com.js | You handle it | You handle it | | **Session** | Payment session | Payment session | Tokenization session | None | | **Best for** | Fastest time to market, with no design customization needed | Full brand control without handling card data on your servers | Storing cards for recurring charges or anonymous checkouts | Maximum backend control, for large organizations with existing compliance | SAQ-A and SAQ-A-EP are PCI DSS self-assessment questionnaires. SAQ-A applies when no card data touches your systems (22 security controls). SAQ-A-EP applies when your pages handle card input but a third party processes the data (139 security controls). ## On your website [#on-your-website] Universal checkout, Headless checkout, and Tokenization run in your web page with Pay.com.js. A hybrid checkout combines the first two. ### Universal checkout [#universal-checkout] Universal checkout is a fully hosted, customizable checkout. You add Pay.com.js to your page, and Pay.com renders the whole payment form inside it and handles the fields, the styling, validation, error handling, and submission. Payment methods that redirect open in a pop-up, so your page keeps its context. It's the fastest way to start accepting payments, and your PCI scope is the smallest (SAQ-A), because no card data touches your systems. Choose it if you want to go live quickly and don't need a fully custom checkout design. You can still [customize the form](/payments/customize-the-checkout). Start with [Universal checkout](/payments/universal-checkout). ### Headless checkout [#headless-checkout] You build and own the payment form, with your own components. Pay.com.js captures the sensitive card data and handles the payment method logic behind the scenes. Card details typed on your page go straight from the browser to Pay.com and never reach your servers. That puts Headless checkout between Universal checkout and the server-to-server API. You get your own UI, and card data is still sent directly to Pay.com. Your PCI scope is SAQ-A-EP, more than Universal checkout's SAQ-A but far less than handling card data on your servers. Choose it if your brand experience matters and you have a design team ready to build a custom checkout, if your design needs go beyond what Universal checkout supports, or if you want to change your UI independently of the payment integration. Start with [Headless checkout](/payments/headless-checkout). ### Hybrid checkout [#hybrid-checkout] A hybrid checkout uses Universal checkout and Headless checkout on the same page. Universal checkout shows wallet buttons and alternative payment methods, and Headless checkout runs your own card form. See [Hybrid checkout](/payments/hybrid-checkout). ### Tokenization [#tokenization] Tokenization combines Pay.com.js in your page with API calls from your server. Pay.com.js captures the customer's card details and turns them into a token, and your server then uses the token without ever handling raw card data. It stores a card without taking a payment at that moment. It's useful for public or anonymous checkouts where you want to store a payment method for later, without requiring the customer to log in. Choose it if you need to save payment methods for future charges, subscriptions, or deferred billing. Start with [Tokenize a card](/payments/set-up-a-card/tokenize-a-card). Before you choose Tokenization, check what it doesn't do: * **Cards only.** Tokenization sessions don't support Apple Pay, Google Pay, or any other payment method. * **No payment.** Tokenization doesn't process a payment. Your server makes a separate API call to transact with the token, for example to create a charge. * **3D Secure is yours to handle.** If the card requires authentication, you handle the challenge yourself, with the server-to-server [3D Secure](/payments/3d-secure) flow. It isn't handled automatically. If you need wallets or a simpler integration, choose Universal checkout or Headless checkout instead. ## From your server [#from-your-server] With the server-to-server API, your servers handle card data and call the Pay.com API directly, with no SDK in the page. You have the most control over every part of the payment flow and the checkout, and the API creates charges and holds directly, with no session. Card details pass through your infrastructure, so this path requires full PCI DSS compliance. Choose it if you're PCI-certified, have complex backend payment logic, or are building for an enterprise environment with specific security requirements. Start with [Create a charge](/payments/create-a-charge). ## Not sure which to choose? [#not-sure-which-to-choose] If you're starting fresh and don't have strong requirements in either direction, start with Universal checkout. You can move to Headless checkout or the server-to-server API later as your product matures, without rebuilding your Pay.com integration. Your Pay.com implementation team can advise on the right path during onboarding. See [Set up your account](/get-started/set-up-your-account) for how to reach them. ## Next steps [#next-steps] * For Universal checkout, Headless checkout, or Tokenization, [install and initialize Pay.com.js](/sdks/pay-com-js), then follow your integration's guide. Pay.com.js works in the environment of the session you give it, sandbox or live. * For the server-to-server API, start with [Create a charge](/payments/create-a-charge). # Headless checkout (/payments/headless-checkout) Headless checkout gives you full control over your checkout UI. You build your own payment form, collect card details or trigger wallet payments, and submit them through Pay.com.js. No prebuilt form is rendered. ## Requirements [#requirements] Before you begin, [install and initialize Pay.com.js](/sdks/pay-com-js). ## Build the checkout [#build-the-checkout] Create a payment session on your server, then pass its `client_secret` to Pay.com.js and submit the payment from your own form. ### Create a payment session [#create-a-payment-session] Your server must create a payment session before the client can start a checkout. Call [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) to get a `client_secret` and session `id`. `amount` is in minor units (the smallest unit of the currency), so `2000` in USD charges $20.00. ```javascript const response = await fetch("https://api.sandbox.pay.com/v1/sessions/payment", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Basic " + btoa(":sk-pay-com-sandbox-…") }, body: JSON.stringify({ currency: "usd", amount: 2000, customer_reference_id: "927071e4-464c-4f5d-a079-4aa097f922ca", payment_method_types: ["card"] }) }); const session = await response.json(); ``` `payment_method_types` controls which payment methods appear at checkout. Card, Apple Pay, and Google Pay are included when you pass `"card"`. Alternative payment methods such as Neosurf and paysafecard must be added explicitly, for example `["card", "neosurf"]`. Each payment method page lists the value to use. Only methods enabled on your account can be included (see [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods)). A successful response returns a short-lived `client_secret` and session `id`: ```json { "id": "ps_217940156986951680", "resource": "payment_session", "amount": 2000, "currency": "usd", "client_secret": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "status": "open" } ``` For all available parameters, see the [payment sessions API reference](/api-reference/endpoints/paymentsessions/create-ps). ### Create a checkout instance [#create-a-checkout-instance] Pass the `client_secret` to `pay.checkout()` along with callbacks to handle the payment result. ```ts const checkout = pay.checkout({ clientSecret: session.client_secret, onSuccess: (payment) => { console.log('Payment succeeded:', payment.transaction) }, onFailure: (error) => { console.log('Payment failed:', error.message) }, }) ``` | Parameter | Type | Required | Description | | -------------- | ------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | | `clientSecret` | `string` | Yes | The `client_secret` from the payment session. | | `onSuccess` | `(payment) => void` | No | Fired when the payment completes successfully. | | `onFailure` | `(error) => void` | No | Fired when the payment fails. | | `onPending` | `(payment) => void` | No | Fired instead of `onSuccess` when the payment is accepted but not final yet (for example, some alternative payment methods). | `onSuccess`, `onFailure`, and `onPending` are browser-only callbacks. Never rely on them for order fulfillment. Confirm payments on your server with [webhooks](#listen-for-webhooks). ### Submit a payment [#submit-a-payment] Call `checkout.headless()` with the payment method type and the data collected from your form. #### Card payment [#card-payment] Pass the card details your form collected: ```js try { const payment = await checkout.headless('card', { number: '4111111111111111', cvv: '123', expirationMonth: '12', expirationYear: '28', name: 'Jane Smith', }) } catch (error) { console.log('Payment failed:', error.message) } ``` | Field | Type | Required | Description | | ----------------- | -------- | -------- | ---------------------------------------------------- | | `number` | `string` | Yes | Card number, no spaces or dashes. | | `cvv` | `string` | Yes | Card security code. Not required in payout sessions. | | `expirationMonth` | `string` | Yes | Two-digit month, for example `'12'`. | | `expirationYear` | `string` | Yes | Two-digit year, for example `'28'`. | | `name` | `string` | No | Cardholder name as it appears on the card. | `checkout.headless()` resolves with the payment result and also calls `onSuccess` (or `onPending` for a pending result). If the payment fails, it calls `onFailure` and rejects, so always wrap the call in `try`/`catch`. #### Other payment methods [#other-payment-methods] Headless checkout also supports wallet and bank redirect payments: ```js // Apple Pay await checkout.headless('applepay') // Google Pay await checkout.headless('googlepay') // iDEAL (requires BIC code) await checkout.headless('ideal', { bic: 'SNSBNL2A' }) // GiroPay await checkout.headless('giropay') ``` These calls reject on failure in the same way, so wrap them in `try`/`catch` too. Before you show Apple Pay or Google Pay buttons, check that the customer's browser can pay with them. See [Apple Pay and Google Pay](#apple-pay-and-google-pay). ## Apple Pay and Google Pay [#apple-pay-and-google-pay] With Universal checkout, Apple Pay and Google Pay are included automatically. With Headless checkout, you check whether each wallet is available in the customer's browser, then call `checkout.headless()` with the wallet type when the customer clicks its button. Apple Pay and Google Pay must be activated on your Pay.com merchant account. To confirm that they're on, check your payment methods configuration in the Pay.com dashboard, as [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods) describes. ### Check wallet availability [#check-wallet-availability] Before rendering wallet buttons in your UI, check whether Apple Pay or Google Pay are available in the customer's browser using `checkout.canMakePayments()`. It returns a boolean for each wallet, so you can display only the payment options the customer's device supports. ```js const canMakePayments = await checkout.canMakePayments() // { applepay: true, googlepay: false } ``` Only render a wallet button if the corresponding value is `true`. ### Trigger the payment [#trigger-the-payment] When the customer clicks a wallet button, call `checkout.headless()` with the wallet type. Pay.com.js handles the payment sheet, authorization, and outcome. ```js async function handleApplePay() { try { await checkout.headless('applepay') } catch (error) { // onFailure has already been called with the same error } } async function handleGooglePay() { try { await checkout.headless('googlepay') } catch (error) { // onFailure has already been called with the same error } } ``` `onSuccess` fires when the payment completes. `onFailure` fires if the customer cancels or the payment is declined. Both are the callbacks you registered with `pay.checkout()` when you [created the checkout instance](#create-a-checkout-instance). For their arguments, see [`pay.checkout()`](/sdks/pay-com-js/pay-checkout). ## Listen for webhooks [#listen-for-webhooks] Wallet payments send the same webhook events as card payments. Subscribe to these payment session events to confirm the outcome on your backend, independently of the browser: * `payment_session.completed`: The session was paid, and a charge or hold was created. Fulfill the order. * `payment_session.failed`: The session ended without a successful charge. It can include several declined payment attempts. Verify the `Pay-Signature` header on every event before you act on it. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures) and [Payment session events](/api-reference/endpoints/paymentsessions/events). ## Complete example [#complete-example] Each tab submits a card payment from your own form: with the npm package, or in a React component. ```ts import Pay from '@pay-com/js' // 1. Initialize the SDK with your merchant ID (not the session ID) const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID' }) // 2. Create a checkout instance const checkout = pay.checkout({ clientSecret: session.client_secret, onSuccess: (payment) => { console.log('Payment succeeded:', payment.transaction) }, onFailure: (error) => { console.log('Payment failed:', error.message) }, }) // 3. Submit a card payment try { const payment = await checkout.headless('card', { number: '4111111111111111', cvv: '123', expirationMonth: '12', expirationYear: '28', name: 'Jane Smith', }) } catch (error) { // onFailure has already been called with the same error } ``` `useRef` keeps the `checkout` instance, so `handleSubmit` can reach it outside `useEffect` when the customer clicks the button. ```jsx import { useEffect, useState, useRef } from 'react' import Pay from '@pay-com/js' function CheckoutPage() { const checkoutRef = useRef(null) const [paymentDone, setPaymentDone] = useState(false) const [errorMessage, setErrorMessage] = useState(null) const [cardData, setCardData] = useState({ number: '', cvv: '', expirationMonth: '', expirationYear: '', name: '', }) useEffect(() => { async function initCheckout() { const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID', }) const checkout = pay.checkout({ clientSecret: '{client_secret}', onSuccess: (payment) => { setPaymentDone(true) }, onFailure: (error) => { setErrorMessage(error.message) }, }) checkoutRef.current = checkout } initCheckout() }, []) async function handleSubmit() { const checkout = checkoutRef.current if (!checkout) return try { await checkout.headless('card', { number: cardData.number, cvv: cardData.cvv, expirationMonth: cardData.expirationMonth, expirationYear: cardData.expirationYear, name: cardData.name, }) } catch (e) { // A declined payment rejects here; onFailure has already run. } } if (paymentDone) { return

Payment complete. Thank you for your order.

} return (
setCardData({ ...cardData, number: e.target.value })} /> setCardData({ ...cardData, cvv: e.target.value })} /> setCardData({ ...cardData, expirationMonth: e.target.value })} /> setCardData({ ...cardData, expirationYear: e.target.value })} /> setCardData({ ...cardData, name: e.target.value })} /> {errorMessage &&

{errorMessage}

}
) } export default CheckoutPage ``` The inputs are unstyled placeholders. Replace them with your own components. Pay.com.js takes the data you pass to `checkout.headless()` and doesn't render any UI itself.
## Next steps [#next-steps] Related checkout guides: * [Display available payment methods](/payments/alternative-payment-methods/headless-checkout): Build a dynamic payment method selector using `getPaymentMethods()`. * [Pay with a saved card](/payments/saved-cards/pay-with-a-saved-card): Let returning customers pay with `getExistingSources()` and `checkout.pay()`. * [Pay.com.js reference](/sdks/pay-com-js): The SDK's methods, including [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) and [`checkout.canMakePayments()`](/sdks/pay-com-js/checkout-can-make-payments). # Hold and capture (/payments/hold-and-capture) The hold and capture flow, also known as authorization and capture, lets you reserve funds on a customer's card and capture them at a later time. It's an advanced flow typically used by businesses that only take money when a service is fulfilled, such as hotels, airlines, or e-commerce platforms that ship physical goods. If you decide not to go ahead, you cancel the hold and the reserved funds go back to the customer. ## Requirements [#requirements] Before performing a hold and capture, make sure you have the following: * [Select your environment base URL](/get-started/environments). The examples use the sandbox (`https://api.sandbox.pay.com/v1`) with an `sk-pay-com-sandbox-` key. * [Have access to your API credentials](/get-started/api-keys). * A unique [`idempotency-key`](/developer-resources/idempotency-and-retries) header for each request. ## Create and capture a hold [#create-and-capture-a-hold] Reserve the funds with a hold, then capture them in one or more capture requests. ### Create a hold [#create-a-hold] To reserve funds without capturing them, send a `POST` request to the [`/v1/holds`](/api-reference/endpoints/holds/create-hold) endpoint. A successful response returns a Hold object with `status: requires_capture`, indicating the funds are reserved on the customer's card but not yet captured. Amounts are in minor units (the smallest currency unit), so `10000` equals $100.00 USD. You can create a hold using raw card data or a stored payment method. ```json { "amount": 10000, "currency": "usd", "source_data": { "type": "card", "card": { "number": "4242424242424242", "expiry_month": "12", "expiry_year": "2028", "cvv": "123", "name": "John Smith" }, "billing_details": { "name": "John Smith", "email": "john.smith@example.com" } }, "description": "Hold for Order #12350", "reference": "order-12350", "payment_method_options": { "card": { "duplicate_card_check": false } } } ``` ```json { "id": "hld_686178331611104256", "resource": "hold", "amount": 10000, "amount_human_readable": "100.00", "amount_capturable": 10000, "billing_details": { "address": null, "email": "john.smith@example.com", "name": "John Smith", "phone": null }, "created": "2026-03-09T08:00:00.000Z", "currency": "usd", "customer": null, "customer_reference_id": null, "description": "Hold for Order #12350", "failure_code": null, "failure_message": null, "metadata": {}, "payment_method": "pm_card_686178340000000000", "reference": "order-12350", "status": "requires_capture", "test_mode": true } ``` ```json { "amount": 10000, "currency": "usd", "source": "pm_card_REPLACE_WITH_PAYMENT_METHOD_ID", "off_session": true, "description": "Hold for Order #12351", "reference": "order-12351", "payment_method_options": { "card": { "duplicate_card_check": false } } } ``` ```json { "id": "hld_686178331611104257", "resource": "hold", "amount": 10000, "amount_human_readable": "100.00", "amount_capturable": 10000, "billing_details": null, "created": "2026-03-09T08:01:00.000Z", "currency": "usd", "customer": null, "customer_reference_id": null, "description": "Hold for Order #12351", "failure_code": null, "failure_message": null, "metadata": {}, "payment_method": "pm_card_REPLACE_WITH_PAYMENT_METHOD_ID", "reference": "order-12351", "status": "requires_capture", "test_mode": true } ``` If the API returns the hold with `status: requires_authentication`, the issuer requires 3D Secure. Create a [linked authentication session](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with `resource` set to the hold ID (`hld_…`) and show the challenge, as described in [create a charge with 3DS](/payments/3d-secure/charge-with-3ds). If you pass `confirm: false`, the hold moves to `requires_confirmation`. Call [`POST /v1/holds/{hold_id}/confirm`](/api-reference/endpoints/holds/hold-confirm) after the customer returns. The hold then moves to `requires_capture` and you can capture it. Holds expire after a set number of days (7 by default). The exact window depends on the card network and acquirer. If a hold expires before you capture it, the funds are released back to the customer and the hold transitions to `status: canceled` with `cancellation_reason: hold_on_funds_expired`. Pay.com sends a `hold.funds_about_to_expire` webhook event before a hold expires. Capture or cancel the hold before then to avoid unexpected releases. ### Capture funds [#capture-funds] When you are ready to capture the funds, send a `POST` request to [`/v1/holds/{hold_id}/capture`](/api-reference/endpoints/holds/create-capture). Replace `{hold_id}` with the `id` returned when you created the hold. You can capture the full amount in one call, or capture part of it. To capture the entire reserved amount, omit the `amount_to_capture` field. The API returns the new charge object. The hold transitions to `status: succeeded` and `amount_capturable` drops to `0`. `POST https://api.sandbox.pay.com/v1/holds/{hold_id}/capture` ```json {} ``` ```json { "id": "chrg_686178340000000001", "resource": "charge", "amount": 10000, "amount_human_readable": "100.00", "amount_refunded": 0, "created": "2026-03-09T08:05:00.000Z", "currency": "usd", "description": "Hold for Order #12350", "hold": "hld_686178331611104256", "metadata": {}, "paid": false, "payment_method": "pm_card_686178340000000000", "refunded": false, "reference": "order-12350", "status": "succeeded", "test_mode": true } ``` To capture only part of the reserved amount, set `amount_to_capture` to the value you want to capture this time, not the total or remaining balance. After a partial capture, the hold's `status` is `succeeded`, `captured` stays `false`, and `amount_capturable` shows the remaining amount. The rest stays capturable. Capture it in more installments where the provider supports multiple captures, or [cancel the hold](#cancel-a-hold) to release it. If the provider doesn't support multiple captures, the API returns `422` (`Provider only allows capturing a payment once`) for a second capture, so cancel the hold instead. To capture in multiple installments, repeat the following steps until `amount_capturable` reaches `0`: 1. Call `GET /v1/holds/{hold_id}` to check the current `amount_capturable`. 2. Send a `POST` to `/v1/holds/{hold_id}/capture` with `amount_to_capture` set to the value to capture in this installment. When `amount_capturable` reaches `0`, the full amount is captured and `captured` is `true`. `POST https://api.sandbox.pay.com/v1/holds/{hold_id}/capture` ```json { "amount_to_capture": 5000 } ``` ```json { "id": "chrg_686178340000000002", "resource": "charge", "amount": 5000, "amount_human_readable": "50.00", "amount_refunded": 0, "created": "2026-03-09T08:05:00.000Z", "currency": "usd", "description": "Hold for Order #12350", "hold": "hld_686178331611104256", "metadata": {}, "paid": false, "payment_method": "pm_card_686178340000000000", "refunded": false, "reference": "order-12350", "status": "succeeded", "test_mode": true } ``` The capture endpoint returns the new **charge object**. To see the updated hold with its current `amount_capturable` and `status`, retrieve it with `GET /v1/holds/{hold_id}`, or listen for the `hold.captured` and `hold.succeeded` [webhook events](/api-reference/webhooks/webhook-events), which deliver the full hold object. ## Cancel a hold [#cancel-a-hold] If you decide not to proceed with a transaction, cancel the hold to release the reserved funds back to the customer before any funds move to your account. Send a `POST` request to [`/v1/holds/{hold_id}/cancel`](/api-reference/endpoints/holds/hold-cancel) with the hold `id` returned when you created the hold. You can cancel a hold unless it's fully captured or already canceled. Cancellation is all or nothing, and it's final: * Cancellation always releases the **full** remaining `amount_capturable`. Partial releases are not supported. * If you want to release only part of the reserved funds, capture only what you need first (see [Capture funds](#capture-funds)). The rest stays capturable, and you can call this endpoint to release it. * Once canceled, the hold is permanently closed. It can't be reopened or used for future captures. If you need to charge the customer again, create a new [hold](/api-reference/endpoints/holds/create-hold) or [charge](/api-reference/endpoints/charges/create-charge). ```bash curl -X POST https://api.sandbox.pay.com/v1/holds/hld_686178331611104256/cancel \ -u ':sk-pay-com-sandbox-…' \ -H "idempotency-key: $(uuidgen)" ``` ```json { "id": "hld_686178331611104256", "resource": "hold", "amount": 10000, "amount_human_readable": "100.00", "amount_capturable": 0, "billing_details": { "address": null, "email": "john.smith@example.com", "name": "John Smith", "phone": null }, "created": "2026-03-09T08:00:00.000Z", "currency": "usd", "customer": null, "customer_reference_id": null, "description": "Hold for Order #12350", "failure_code": null, "failure_message": null, "metadata": {}, "payment_method": "pm_card_686178340000000000", "reference": "order-12350", "status": "canceled", "cancellation_reason": "requested_by_merchant", "test_mode": true } ``` When the request succeeds, the hold status changes from `requires_capture` to `canceled` and `amount_capturable` drops to `0`. Unlike a refund, which can take several days, a canceled hold usually frees the customer's funds sooner. The customer's card issuer decides when. The response includes a `cancellation_reason` field indicating why the hold was canceled: | Value | Description | | :---------------------- | :---------------------------------------------------------------------- | | `requested_by_merchant` | The merchant called the cancel endpoint. | | `hold_on_funds_expired` | The hold expired because it was not captured within the allowed window. | ## Listen for webhooks [#listen-for-webhooks] Use webhooks to track the lifecycle of the hold and keep your order management system up to date. * `hold.requires_capture`: Sent when a hold is approved and funds are successfully reserved and awaiting capture. * `hold.captured`: Sent for every capture you perform. If you partially capture funds from the same hold three times, your system receives this webhook three times. * `hold.succeeded`: Sent only for the first capture. It tells your system that the initial capture was successful and does not fire again for subsequent captures against the same hold. * `hold.canceled`: Sent when you cancel the hold or when it expires. * `hold.failed`: Sent if the initial attempt to create the hold is declined. Verify each event's signature with the `Pay-Signature` header and your endpoint's signing secret (HMAC SHA-256) to make sure the event is legitimate. See [verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Next steps [#next-steps] * [Refund a charge](/payments/refunds): return funds after a capture has already settled. * [Create a charge](/payments/create-a-charge): see how a standard charge differs from the hold and capture flow, or charge the customer after canceling a hold. * [Webhooks](/developer-resources/webhooks): verify signatures and handle hold lifecycle events reliably. # Hybrid checkout (/payments/hybrid-checkout) A hybrid checkout combines Universal checkout and Headless checkout on the same page. `checkout.universal()` renders the wallet buttons and alternative payment method buttons. Your own card form submits card details through `checkout.headless()`, so you fully control it. Use a hybrid checkout when you want wallet buttons (Apple Pay, Google Pay) and a fully custom card form, without registering your own developer accounts with Apple or Google. Pay.com handles merchant validation. ## How the zones split [#how-the-zones-split] Both zones share a single checkout instance and a single payment session. | Zone | Method | What it handles | | --------- | ---------------------- | ------------------------------- | | Universal | `checkout.universal()` | Apple Pay, Google Pay, and APMs | | Headless | `checkout.headless()` | Custom card form only | In this setup, the universal zone renders the wallet and APM buttons, so your headless zone only submits cards. `checkout.headless()` itself isn't limited to cards. It also takes wallets and APMs, as in [Headless checkout](/payments/headless-checkout#other-payment-methods). ## Requirements [#requirements] Before you begin: * [Install and initialize Pay.com.js](/sdks/pay-com-js). * Apple Pay and Google Pay must be activated on your Pay.com merchant account. Check the **Payment methods** section of the [Pay.com dashboard](https://dashboard.pay.com) to confirm availability. * For Apple Pay, you must still register every domain that shows the Apple Pay button with Pay.com. See the [Apple Pay requirements](/documentation/payment-methods/wallets/apple-pay#before-you-begin). ## Build the hybrid checkout [#build-the-hybrid-checkout] Create the session on your server, then set up Pay.com.js and both zones in the browser. ### Create a payment session [#create-a-payment-session] Create a [payment session](/api-reference/endpoints/paymentsessions/create-ps) on your server. `amount` is in minor units (`5000` is €50.00), and `customer_reference_id` (your own identifier for the customer) is required. Include `card` and any alternative payment methods you want to offer. Apple Pay and Google Pay are included automatically when `card` is present. ```bash curl -X POST https://api.sandbox.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H "content-type: application/json" \ -d '{ "currency": "eur", "amount": 5000, "customer_reference_id": "cust-jane-smith-001", "payment_method_types": ["card", "paypal", "paysafecard"], "return_url": "https://example.com/checkout/complete", "billing_details": { "name": "Jane Smith", "address": { "country": "IT" } } }' ``` ```json { "id": "ps_773506178498954240", "resource": "payment_session", "amount": 5000, "currency": "eur", "customer_reference_id": "cust-jane-smith-001", "payment_method_types": [ "card", "paypal", "paysafecard", "applepay", "googlepay" ], "client_secret": "eyJhbG...", "status": "open" } ``` Always include a `return_url`. Wallet and APM payments may redirect the customer to an external page. The `return_url` tells Pay.com where to send the customer after the payment completes. ### Initialize the SDK [#initialize-the-sdk] Pass your Pay.com merchant ID (from the **Developers** tab of the Pay.com dashboard) to `Pay.com()` to create a `pay` instance. Don't pass the session ID. The session is identified by its `client_secret` in the next step. ```js const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID', }) ``` In the live environment, create the session on `https://api.pay.com/v1` with an `sk-pay-com-live-` key. With `@pay-com/js`, also pass `live: true` to `Pay.com()`. ### Create a checkout instance [#create-a-checkout-instance] Create a single checkout instance. Both the universal and headless zones use this same instance. ```js const checkout = pay.checkout({ clientSecret: CLIENT_SECRET, onSuccess: (payment) => { console.log('Payment succeeded:', payment) }, onPending: (payment) => { console.log('Payment pending:', payment) }, onFailure: (error) => { console.log('Payment failed:', error) }, }) ``` `onSuccess`, `onPending`, and `onFailure` fire regardless of whether the customer paid with a wallet, an APM, or the card form. `onPending` fires when the result isn't final yet, for example with some APMs. Wait for the webhook before you fulfill the order. ### Render wallets and APMs in the universal zone [#render-wallets-and-apms-in-the-universal-zone] Call `checkout.universal()` with a `paymentMethods` array that includes wallets and any alternative payment methods. Exclude `card`, since your own card form handles cards in the headless zone. ```js checkout.universal({ container: '#universal-zone', paymentMethods: ['applepay', 'googlepay', 'paypal', 'paysafecard'], toggles: { submitButton: false }, }) ``` ```html
``` Set `toggles.submitButton` to `false` because each wallet and APM button handles submission on its own.
### Build your card form in the headless zone [#build-your-card-form-in-the-headless-zone] Create your own card form with standard HTML inputs. When the customer submits the form, call `checkout.headless()` with the card data. `checkout.headless()` also rejects when the payment fails, so wrap it in `try/catch`. ```js async function handleCardPayment() { try { await checkout.headless('card', { number: '4242424242424242', name: 'Jane Smith', expirationMonth: '12', expirationYear: '28', cvv: '123', }) } catch (error) { // onFailure has also been called. Let the customer try again. } } ```
## Listen for webhooks [#listen-for-webhooks] Hybrid checkout payments use the same webhook events as any other payment. Subscribe to `payment_session.completed` (paid) and `payment_session.failed` (ended without a successful charge) on your backend to confirm the outcome independently of the browser. Verify each event's signature with the `Pay-Signature` header and your endpoint's signing secret (HMAC SHA-256) before you act on it. See [Webhooks](/developer-resources/webhooks) for setup instructions and [verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures) for the steps. ## Next steps [#next-steps] * [Render the checkout form](/sdks/pay-com-js/checkout-universal): All `checkout.universal()` options. * [Submit a headless payment](/sdks/pay-com-js/checkout-headless): All `checkout.headless()` options. # Payments (/payments) Accept cards, digital wallets, and local payment methods with Pay.com.js or directly from your server. Every integration uses the same API and token vault. ## Find your use case [#find-your-use-case] Choose an integration path based on your platform and UI control requirements. Compare them side by side in [Find your use case](/payments/find-your-use-case). ## Common tasks [#common-tasks] Start from the flow you need. Each card opens a guide or a group of guides. # Accept payments in your iOS app (/payments/ios) To take a payment in the sandbox, your server creates a payment session, the app takes the payment, and your server confirms the result. Show the drop-in, which takes the least code, or build your own screen. The [iOS SDK](/sdks/ios) reference describes the classes used here. | | [Drop-in](/sdks/ios/dropin-present) (recommended) | Your own UI | | ---------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | | **What you build** | A button that presents Pay.com's sheet | A screen, from the [payment methods](/sdks/ios/checkout-payment-methods) and the [card fields](/sdks/ios/paycardfields) | | **Payment methods** | Cards, redirect methods, and Apple Pay | The ones you show | | **Errors and retries** | The sheet shows them | You show them | | **Look** | The system's, or [your colors and shapes](/sdks/ios/paydropinappearance) | Yours | Both show the customer's saved methods at checkout. The drop-in shows them [in a carousel](/sdks/ios/dropin-present#a-returning-customer), and your own screen shows them as in [Pay with a saved payment method](/sdks/ios/checkout-pay-with-saved-payment-method). ### Create a payment session on your server [#create-a-payment-session-on-your-server] Call [Create a payment session](/api-reference/endpoints/paymentsessions/create-ps) with your sandbox key. `amount`, `currency`, and `customer_reference_id` (your own identifier for the customer) are required. Amounts are in minor units. For example, `1000` is $10.00. ```bash curl -X POST https://api.sandbox.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "amount": 1000, "currency": "usd", "customer_reference_id": "cust-001" }' ``` Send only the `client_secret` from the response to the app. Never put your API key in the app. ### Add the SDK [#add-the-sdk] Add the `pay-com-ios` package with Swift Package Manager and link the products for the UI you choose. See [Install](/sdks/ios#install). * **The drop-in:** `PayCheckout`, `PayCore`, and `PayDropIn`. * **Your own UI:** `PayCheckout`, `PayCore`, and `PayElements`. ### Start a checkout [#start-a-checkout] Create a `PayCheckout` with the `client_secret`. The initializer checks the secret and loads the session, so it's `async` and throws a `PayError` when it fails. ```swift import PayCheckout import PayCore // PayResult, PayError, PaymentIDs: PayCheckout doesn't re-export them let checkout = try await PayCheckout( clientSecret: clientSecretFromYourServer, configuration: .init(returnURL: URL(string: "myshop://pay")!) ) // The session's payment methods, in the order the API returns them. let methods = checkout.paymentMethods() // [PayPaymentMethod(type: "card", kind: .card), …] ``` `returnURL` is the URL that redirect payment methods return the customer to. It's a custom URL scheme your app handles, or a universal link. Live and sandbox sessions use the same configuration. ### Take the payment [#take-the-payment] Present the drop-in, or build your own card form and call `pay`. Present the sheet from your view controller when the customer taps your checkout button. It shows the session's methods, the card form, and any failure. It also runs 3DS and closes when the payment is done. ```swift import PayDropIn let dropIn = PayDropIn(checkout: checkout, configuration: .init(merchantDisplayName: "My Shop")) switch await dropIn.present(from: self) { case .succeeded(let ids), .processing(let ids): showConfirmation(ids) // A hint: your server verifies before fulfilling case .canceled: break // The customer closed the sheet case .failed(let error): show(error) // The session can't be paid any more } ``` To show Apple Pay in the sheet, set the configuration's `applePay`. [Present the drop-in](/sdks/ios/dropin-present) has the options and what the customer sees, and you can change its [look](/sdks/ios/paydropinappearance) and [text](/sdks/ios/paydropinstrings). `PayCardFields` groups the SDK's inputs. Add its views anywhere in your layout and enable your pay button when the card is complete. The app never reads what the customer types into these fields. See [Card fields](/sdks/ios/paycardfields). ```swift import PayElements let card = PayCardFields(name: PayNameField()) stack.addArrangedSubview(card.number) stack.addArrangedSubview(card.expiry) stack.addArrangedSubview(card.cvc) if let name = card.name { stack.addArrangedSubview(name) } card.onChange = { state in payButton.isEnabled = state.isComplete } ``` Then call `pay` with the card and the view controller that presents 3DS challenges and redirects. ```swift do { switch try await checkout.pay(.card(card), presenter: self) { case .succeeded(let ids): showReceipt(ids) // A hint: your server verifies before fulfilling case .processing(let ids): showPending(ids) // Your server decides from the webhook or the session case .canceled: break // The customer closed the 3DS or redirect screen case .failed(let error): show(error) } } catch { // Nothing was sent: the card is incomplete or a payment is already running. show(error) } ``` `pay` throws only when nothing was sent (`PayError.invalidCardInput` or `PayError.paymentInProgress`). Anything that happens after a request leaves the device comes back as a `PayResult`. When your server changes the amount, [refresh the session](/sdks/ios/checkout-refresh-session) and show the new total before the customer pays. ### Pass return URLs to the SDK [#pass-return-urls-to-the-sdk] In your scene delegate or SwiftUI `onOpenURL`, pass every URL your app is opened with: ```swift .onOpenURL { url in PayCheckout.handleReturn(url) // false when the URL isn't a Pay.com return } ``` It's safe to call with any URL. It returns `true` only when the URL belongs to a Pay.com flow in progress. ### Confirm the payment on your server [#confirm-the-payment-on-your-server] `PayResult` reflects only client-side state. Before you fulfill the order, retrieve the session with [Retrieve a payment session](/api-reference/endpoints/paymentsessions/get-ps-by-id) or wait for the signed `payment_session.completed` [webhook](/api-reference/webhooks/webhook-events). Use the session ID your server got when it created the session. If you offer payment methods that redirect, your server must create the session with `return_url` set to the same URL as `returnURL`. # Accept payments in your React Native app (/payments/react-native) To take a payment in the sandbox, your server creates a payment session, the app takes the payment, and your server confirms the result. Show the drop-in, which takes the least code, or build your own screen. The [React Native SDK](/sdks/react-native) reference describes the methods used here. ## Choose a checkout UI [#choose-a-checkout-ui] Pick the drop-in for the fastest integration, or build a custom form with native card inputs. | Capability | [Drop-in](/sdks/react-native/checkout-present-drop-in) (recommended) | Your own UI | | ---------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | **What you build** | A button that presents Pay.com's sheet | A screen using [payment methods](/sdks/react-native/checkout-payment-methods) and [card fields](/sdks/react-native/use-pay-card-fields) | | **Payment methods** | Cards, redirect methods, Apple Pay on iOS, and Google Pay on Android | Cards and the redirect methods you render | | **Errors and retries** | Handled by the sheet | Handled in your UI | | **Customization** | Native platform styling, or [custom colors and shapes](/sdks/react-native/drop-in-appearance) | Full custom UI | Both approaches display the customer's saved methods at checkout. The drop-in displays them [in a carousel](/sdks/react-native/checkout-present-drop-in#a-returning-customer), and a custom screen handles them as shown in [Pay with a saved payment method](/sdks/react-native/checkout-pay-with-saved-payment-method). ## Integrate Pay.com [#integrate-paycom] Create a payment session on your server, collect the payment in your app, and verify the final status on your server. ### Create a payment session on your server [#create-a-payment-session-on-your-server] Call [Create a payment session](/api-reference/endpoints/paymentsessions/create-ps) with your sandbox key. `amount`, `currency`, and `customer_reference_id` (your own identifier for the customer) are required. Amounts are in minor units. For example, `1000` is $10.00. ```bash curl -X POST https://api.sandbox.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "amount": 1000, "currency": "usd", "customer_reference_id": "cust-001" }' ``` Send only the `client_secret` from the response to the app. Never put your API key in the app. ### Add the SDK [#add-the-sdk] Install the package, then run `pod install` for iOS: ```bash npm install @pay-com/react-native cd ios && pod install ``` Both platforms' native SDKs come with it. See [Install](/sdks/react-native#install). ### Register the return URL [#register-the-return-url] Redirect payment methods return the customer to your app at its return URL, for example `myshop://pay`. [Set up deep links](/sdks/react-native/paycheckout-handle-return#set-up-deep-links) for it on each platform. While a payment runs, the SDK picks the URL up from React Native's `Linking`. ### Start a checkout [#start-a-checkout] `PayCheckout.create()` checks the `client_secret` and loads the session. It rejects with a `PayError` when it can't. ```tsx import { PayCheckout } from '@pay-com/react-native' const checkout = await PayCheckout.create(clientSecretFromYourServer, { returnUrl: 'myshop://pay' }) ``` Live and sandbox sessions use the same configuration. ### Take the payment [#take-the-payment] Present the drop-in, or build your own card form and call `pay`. Present the sheet when the customer taps your checkout button. It shows the session's methods, the card form, and any failure. It also runs 3DS and closes when the payment is done. ```tsx try { const result = await checkout.presentDropIn({ merchantDisplayName: 'My Shop' }) switch (result.status) { case 'succeeded': case 'processing': showConfirmation(result.ids) // Client-side hint; verify on your server before fulfilling break case 'canceled': break // The customer closed the sheet case 'failed': showError(result.error) // The session can no longer be paid break } } finally { checkout.release() } ``` To show the wallets in the sheet, set [`applePay` and `googlePay`](/sdks/react-native/apple-pay-google-pay). [Present the drop-in](/sdks/react-native/checkout-present-drop-in) has the options and what the customer sees, and you can change its [look](/sdks/react-native/drop-in-appearance) and [text](/sdks/react-native/drop-in-strings). Give the same `fields` to each input and enable your pay button when the card is complete. The card details never reach JavaScript. See [Card fields](/sdks/react-native/use-pay-card-fields). ```tsx import { Button, View } from 'react-native' import { PayCardNumberField, PayCheckout, PayCvcField, PayExpiryField, usePayCardFields, } from '@pay-com/react-native' export function CardForm({ checkout }: { checkout: PayCheckout }) { const { fields, state } = usePayCardFields() async function pay() { try { showResult(await checkout.pay({ type: 'card', card: fields })) // Your server verifies before fulfilling } catch (error) { showError(error) // Nothing was sent } } return ( ``` ```ts const checkout = pay.checkout({ clientSecret, onSuccess, onFailure }) const fields = checkout.fields({ mode: 'secure', inputs: { number: { container: '#card-number' }, expiry: { container: '#card-expiry' }, cvv: { container: '#card-cvv', placeholder: 'CVC' }, }, inheritStyleFrom: '#cardholder', style: { base: { fontSize: 16, padding: '10px 12px' }, invalid: { color: '#c62828' }, }, }) document.querySelector('#pay')!.addEventListener('click', () => { checkout.submit({ cardholderName: document.querySelector('#cardholder')!.value }) }) ``` `inputs.number` and `inputs.expiry` are required. Leave out `name` to collect the cardholder name yourself and pass it to `checkout.submit({ cardholderName })`. Only the inputs are Pay.com frames. The labels, borders, focus ring, error text, and Pay button belong to your page. To check the fields without paying, call [`checkout.validate()`](/sdks/pay-com-js/checkout-validate). It resolves with `{ valid, invalidFields }`. Each input renders as an iframe that fills its container's width. It starts 40px high, then sizes itself to its content. The frame sets the input's padding to 0, so without a `padding` or `lineHeight` style a field is one line of text high (about 19px). Calling `fields()` again replaces the fields already mounted. For every option, and the handle `fields()` returns to restyle, focus, clear, or disable the fields, see [`checkout.fields()`](/sdks/pay-com-js/checkout-fields). ## Style the fields [#style-the-fields] Secure fields accept only allowlisted styles, so no CSS of your choosing runs inside the frames. Anything outside the allowlist, and any value that doesn't match its property's format, is dropped. The SDK logs one console warning naming what it dropped (for example `style.base.background`), never the value. `SecureFieldStyle` has one set of rules per state: | State | Applies when | | ---------- | --------------------------------------------------------------------------------------------------------------------- | | `base` | Always. | | `focus` | The input has focus. | | `invalid` | The input shows an error. That happens after the customer types in it and leaves it, or after a submit or validation. | | `complete` | The input's value is complete. | | `disabled` | The input is disabled. | When states overlap, `invalid` wins over `focus`, and `disabled` wins over both. Each state takes these properties: | Property | Accepted values | | ----------------- | --------------------------------------------------------------------------------------------------------------------------- | | `color` | A hex color, `rgb()`, `rgba()`, `hsl()`, `hsla()`, or a color name. | | `fontFamily` | Family names, quoted or not, separated by commas. | | `fontSize` | A length, or `small`, `medium`, `large`, or `x-large`. | | `fontStyle` | `normal`, `italic`, or `oblique`. | | `fontWeight` | `normal`, `bold`, `bolder`, `lighter`, or a multiple of 100 from `100` to `900`. Other numbers, such as `450`, are dropped. | | `letterSpacing` | A length or `normal`. | | `lineHeight` | A length, a number, or `normal`. | | `padding` | One to four lengths. | | `textAlign` | `left`, `right`, `center`, `start`, or `end`. | | `textTransform` | `none`, `uppercase`, `lowercase`, or `capitalize`. | | `'::placeholder'` | `{ color }` only. | A length is a number with `px`, `em`, `rem`, `%`, or `pt`. A JavaScript number means pixels, except for `fontWeight` and `lineHeight`, where it stays unitless. Values are limited to 100 characters (200 for `fontFamily`). Styles layer from lowest to highest: `inheritStyleFrom`, then `style`, then each input's own `style`. ## Listen for events [#listen-for-events] Listen with `checkout.on()`. Field events carry the field's name and state, never what was typed. | Event | Payload | When | | ------------------------ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `fields_ready` | | The fields are ready for input. | | `field_change` | `{ field, empty, valid, error }` | A field's state changes. `error` is the message the field shows, or an empty string. | | `field_focus` | `{ field }` | A field gains focus. | | `field_blur` | `{ field, valid }` | A field loses focus. | | `form_validation_update` | `{ validationResult }` | The form as a whole becomes valid or invalid. | | `session_expired` | | The session's `client_secret` expired, so the fields can't take a payment anymore. It's emitted once, and never after a payment succeeded or went pending. | After a decline, the inputs stay editable so the customer can try again, even with `toggles.displayFailureMessages` on. When the session ends, because it expired or has no attempts left, the inputs lock and the fields show no message. Show your own. Your page draws the message under the field from the `field_change` event's `error`. ```ts checkout.on(checkout.EVENT_TYPES.FORM_VALIDATION_UPDATED, (...params) => { const { validationResult } = params[0] as { validationResult: boolean } document.querySelector('#pay')!.disabled = !validationResult }) ``` If the frames haven't loaded after 30 seconds, the SDK logs a console warning. Check that nothing on your page blocks frames from `js.pay.com`. ## List payment methods [#list-payment-methods] `checkout.getPaymentMethods()` returns more about each method, so you can draw your own list: ```ts const methods = await checkout.getPaymentMethods({ includeWalletAvailability: true }) ``` | Option | Type | Description | | --------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `includeWalletAvailability` | `boolean` | Also check whether Apple Pay and Google Pay can pay in this browser, as [`checkout.canMakePayments()`](/sdks/pay-com-js/checkout-can-make-payments) does. Off by default, because it loads the wallets' scripts. | The methods come in the order set in your dashboard. Each has: | Field | Type | Description | | --------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `paymentMethodType` | `string` | The method's identifier. Pass it to `checkout.pay({ method })`. | | `name` | `string` | The display name. | | `redirectMode` | `'none' \| 'new_tab' \| 'top'` | Where paying takes the customer on this device. `none`: nowhere. The method completes on this page. `new_tab`: the provider opens in a new tab while this page waits. `top`: this page goes to the provider and comes back to the session's return URL. | | `redirect` | `true` | The method's configured redirect flag, the same on every device. | | `icon` | `string` | The method's icon name in Pay.com's icon set. | | `color` | `string` | The method's brand color. | | `fields` | `array` | Extra fields the customer must fill, as described in [List payment methods](/sdks/pay-com-js/checkout-get-payment-methods#field-object). | | `supportedCardBrands` | `string[]` | For `card`, the accepted brands, in lowercase. | | `available` | `boolean` | For `applepay` and `googlepay`, when you set `includeWalletAvailability`, whether this browser can pay with it now. | ## Pay with a listed method [#pay-with-a-listed-method] `checkout.pay()` also takes a method from the list: ```ts await checkout.pay({ method: 'paypal' }) ``` | Option | Type | Description | | ---------------- | -------- | -------------------------------------------------------------------------------------- | | `method` | `string` | A `paymentMethodType` from `getPaymentMethods()`. | | `data` | `object` | The values for the method's `fields`. | | `billingDetails` | `object` | The customer's billing details, as `checkout.headless()` takes them. | | `redirect` | `'top'` | Send the whole page to the provider instead of the method's configured `redirectMode`. | * `method: 'card'` with no `data` pays with the mounted card fields, as `checkout.submit()` does. * Any other method runs the same flow as [`checkout.headless(method, data, billingDetails)`](/sdks/pay-com-js/checkout-headless). What happens next depends on the method's `redirectMode`. With `top`, the page leaves for the provider and comes back to the session's return URL, where your server checks the payment's status. With `new_tab`, the provider opens in a new tab while your page stays, and the promise settles there. A method without a redirect opens in a Pay.com modal. `checkout.pay({ source, cvv })` still pays with a saved payment method, as described in [Pay with a saved payment method](/sdks/pay-com-js/checkout-pay). # Universal checkout (/payments/universal-checkout) Universal checkout renders a hosted checkout form inside a container on your page. It handles card fields, wallet buttons (Apple Pay and Google Pay), saved payment methods, and submission, with minimal code on your side. ## Requirements [#requirements] Before you begin, [install and initialize Pay.com.js](/sdks/pay-com-js). ## Build the checkout [#build-the-checkout] Create a payment session on your server, then pass its `client_secret` to Pay.com.js and render the form. ### Create a payment session [#create-a-payment-session] Your server must create a payment session before the client can start a checkout. Call [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) to get a `client_secret` and session `id`. `amount` is in minor units (the smallest unit of the currency), so `2000` in USD charges $20.00. ```javascript const response = await fetch("https://api.sandbox.pay.com/v1/sessions/payment", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Basic " + btoa(":sk-pay-com-sandbox-…") }, body: JSON.stringify({ currency: "usd", amount: 2000, customer_reference_id: "927071e4-464c-4f5d-a079-4aa097f922ca", payment_method_types: ["card"] }) }); const session = await response.json(); ``` `payment_method_types` controls which payment methods appear at checkout. Card, Apple Pay, and Google Pay are included when you pass `"card"`. Alternative payment methods such as Neosurf and paysafecard must be added explicitly, for example `["card", "neosurf"]`. Each payment method page lists the value to use. Only methods enabled on your account can be included (see [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods)). A successful response returns a short-lived `client_secret` and session `id`: ```json { "id": "ps_217940156986951680", "resource": "payment_session", "amount": 2000, "currency": "usd", "client_secret": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "status": "open" } ``` For all available parameters, see the [payment sessions API reference](/api-reference/endpoints/paymentsessions/create-ps). ### Create a checkout instance [#create-a-checkout-instance] Pass the `client_secret` to `pay.checkout()` along with callbacks to handle the payment result. ```ts const checkout = pay.checkout({ clientSecret: session.client_secret, onSuccess: (payment) => { console.log('Payment succeeded:', payment.transaction) }, onFailure: (error) => { console.log('Payment failed:', error.message) }, }) ``` | Parameter | Type | Required | Description | | -------------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------------- | | `clientSecret` | `string` | Yes | The `client_secret` from the payment session. | | `onSuccess` | `(payment) => void` | No | Fired when the payment completes successfully. | | `onFailure` | `(error) => void` | No | Fired when the payment fails. | | `onPending` | `(payment) => void` | No | Fired when the payment is accepted but not final yet (for example, some alternative payment methods). | For all options, see [`pay.checkout()`](/sdks/pay-com-js/pay-checkout). `onSuccess`, `onFailure`, and `onPending` are browser-only callbacks. Never rely on them for order fulfillment. Confirm payments on your server with [webhooks](#listen-for-webhooks). ### Render the checkout form [#render-the-checkout-form] Call `checkout.universal()` to render the hosted form inside a container element. ```js checkout.universal({ container: '#pay-com-checkout' }) ``` | Parameter | Type | Required | Description | | ---------------------- | --------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `container` | `string` | Yes | CSS selector for the DOM element where the form renders. | | `alternatives` | `'button' \| 'radio'` | No | Layout style for alternative payment methods. Some methods (for example, iDEAL) only appear with `'radio'`. Default: `'button'`. | | `toggles.submitButton` | `boolean` | No | Set to `false` to hide the built-in submit button and use your own. Default: `true`. | | `style` | `object` | No | Style overrides for the form. See [Customize the checkout](/payments/customize-the-checkout) and the [style object reference](/sdks/pay-com-js/style-reference). | For all options, see [`checkout.universal()`](/sdks/pay-com-js/checkout-universal). Make sure the container element exists on the page: ```html
```
## Listen for webhooks [#listen-for-webhooks] A customer closing the browser or a network error can stop the callbacks from firing. Confirm the outcome on your backend with these payment session events: * `payment_session.completed`: The session was paid, and a charge or hold was created. Fulfill the order. * `payment_session.failed`: The session ended without a successful charge. It can include several declined payment attempts. Verify the `Pay-Signature` header on every event before you act on it. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures) and [Payment session events](/api-reference/endpoints/paymentsessions/events). ## Complete example [#complete-example] Each tab renders the same checkout: with the npm package, in a React component, or with the script tag. ```ts import Pay from '@pay-com/js' // 1. Initialize the SDK with your merchant ID (not the session ID) const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID' }) // 2. Create a checkout instance const checkout = pay.checkout({ clientSecret: session.client_secret, onSuccess: (payment) => { console.log('Payment succeeded:', payment.transaction) }, onFailure: (error) => { console.log('Payment failed:', error.message) }, }) // 3. Render the checkout form checkout.universal({ container: '#pay-com-checkout' }) ``` ```jsx import { useEffect, useState } from 'react' import Pay from '@pay-com/js' function CheckoutPage() { const [paymentDone, setPaymentDone] = useState(false) const [errorMessage, setErrorMessage] = useState(null) useEffect(() => { async function initCheckout() { const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID', }) const checkout = pay.checkout({ clientSecret: '{client_secret}', onSuccess: (payment) => { setPaymentDone(true) }, onFailure: (error) => { setErrorMessage(error.message) }, }) checkout.universal({ container: '#pay-com-checkout' }) } initCheckout() }, []) if (paymentDone) { return

Payment complete. Thank you for your order.

} return (
{errorMessage &&

{errorMessage}

}
) } export default CheckoutPage ```
```html
``` With the script tag, run your code after the page loads, in `window.onload` as here. Then `window.Pay` and the container both exist when your code runs. `checkout.universal()` throws if it can't find the container.
## Next steps [#next-steps] Related checkout guides: * [Customize the checkout](/payments/customize-the-checkout): Apply your brand's colors, typography, and spacing to the checkout form. * [Pay.com.js reference](/sdks/pay-com-js): `checkout.validate()`, `checkout.submit()`, and the SDK's other methods. # API reference (/api-reference/get-started) The Pay.com API is a REST API organized around predictable, resource-oriented URLs. It accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. Before you integrate, read [Authentication](/developer-resources/authentication), [Idempotency and retries](/developer-resources/idempotency-and-retries), and [Pagination and filtering](/developer-resources/pagination-and-filtering). Use the sandbox to develop and validate your integration before connecting to live banking networks. Objects created in the sandbox include `test_mode: true`. Amounts are integers in the minor currency unit (the smallest unit), for example `1000` for $10.00. ## Before you start [#before-you-start] Read these pages before making your first request. Explore endpoints without writing code using the [Postman collections](/developer-resources/postman-collections). ## Core resources [#core-resources] The Pay.com API is built around these core objects. ## Guides [#guides] Follow these step-by-step integration guides for common workflows. # Commerce events (/api-reference/commerce/events) Commerce sends these events to your [webhook endpoints](/developer-resources/webhooks), the same ones the rest of the API sends to. Each event has `id`, `resource`, `type`, `created`, `test_mode`, and `data`. ## Checkout sessions [#checkout-sessions] Each of these events carries the [checkout session](/api-reference/commerce/checkout/get-checkout) in `data` at the time the event occurred. | Event | Description | | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | `checkout_session.open` | A checkout session opened. | | `checkout_session.completed` | A checkout session was paid, or its method saved. For `payment` mode, the session's `order` is set and `order.paid` follows. | | `checkout_session.failed` | A checkout session ran out of attempts. | | `checkout_session.expired` | A checkout session expired unpaid, or was expired. | ## Orders [#orders] Each of these events carries the [order](/api-reference/commerce/orders/get-order) in `data` at the time the event occurred. | Event | Description | | ---------------- | ------------------------------------------------------------------------------ | | `order.paid` | An order was paid. Fulfill the order on this event. It's the proof of payment. | | `order.refunded` | An order was refunded, in full or in part. | | `order.updated` | An order's metadata, shipped date or dispute status changed. | ## Invoices [#invoices] Each of these events carries the [invoice](/api-reference/commerce/invoices/get-invoice) in `data` at the time the event occurred. | Event | Description | | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | `invoice.issued` | An invoice was issued. | | `invoice.drafted` | A renewal invoice was drafted. Sent only for subscriptions with `tax_figures: per_invoice`. Send your figures before the draft window closes. | | `invoice.paid` | An invoice was paid. | | `invoice.payment_failed` | A payment for an invoice failed. | | `invoice.voided` | An invoice was voided. | ## Credit notes [#credit-notes] Each of these events carries the [credit note](/api-reference/commerce/creditnotes/get-credit-note) in `data` at the time the event occurred. | Event | Description | | -------------------- | ------------------------- | | `credit_note.issued` | A credit note was issued. | ## Products [#products] Each of these events carries the [product](/api-reference/commerce/products/get-product) in `data` at the time the event occurred. | Event | Description | | ----------------- | --------------------------------- | | `product.updated` | A product was created or changed. | ## Prices [#prices] Each of these events carries the [price](/api-reference/commerce/prices/get-price) in `data` at the time the event occurred. | Event | Description | | --------------- | -------------------------------------------------------- | | `price.updated` | A price was created, got a new version, or was archived. | ## Subscriptions [#subscriptions] Each of these events carries the [subscription](/api-reference/commerce/subscriptions/get-subscription) in `data` at the time the event occurred. | Event | Description | | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `subscription.created` | A subscription was created, in any status. | | `subscription.active` | A subscription became active: after a trial, after its first payment, or when an unpaid subscription recovers. | | `subscription.updated` | A subscription's items, quantities, schedule, cancel date or price change changed. | | `subscription.trial_will_end` | A trial ends in 7 days, or sooner for a shorter trial. | | `subscription.upcoming_renewal` | A renewal is 7 days away. | | `subscription.attempted` | A renewal was attempted. | | `subscription.charged` | A renewal was paid. | | `subscription.unpaid` | A renewal failed and retries are running. | | `subscription.payment_action_required` | The customer must authenticate or replace the payment method. | | `subscription.payment_method` | The payment method changed. By the customer, the account updater or a new network token. | | `subscription.paused` | A subscription was paused. | | `subscription.resumed` | A paused subscription resumed. | | `subscription.canceled` | A subscription ended. | | `subscription.failed` | A subscription's first payment was declined. | | `subscription.access.updated` | `access.status` changed. Grant or revoke access from this event, not from a payment event. | | `subscription.moved` | The subscription moved to another engine or processor. | | `subscription.engine_sync.failed` | Pay.com and the external engine disagree about the subscription. | | `subscription.engine_sync.restored` | Pay.com and the external engine agree again. | | `subscription.tax_inputs_changed` | Send new tax figures for this subscription. On a subscription charged with your tax figures, the customer's country or tax ID changed, or a price change took effect. | ## Entitlements [#entitlements] Each of these events carries the entitlement in `data` at the time the event occurred. | Event | Description | | --------------------- | -------------------------------- | | `entitlement.updated` | What a customer can use changed. | ## Customer claims [#customer-claims] Each of these events carries the customer claim in `data` at the time the event occurred. | Event | Description | | ------------------------ | ----------------------------- | | `customer_claim.created` | A guest customer was claimed. | ## Subscription connections [#subscription-connections] Each of these events carries the [subscription connection](/api-reference/commerce/subscriptionconnections/get-subscription-connection) in `data` at the time the event occurred. | Event | Description | | ----------------------------------------- | ------------------------------------------------------------------------------------------- | | `subscription_connection.action_required` | A connection needs attention. For example new credentials, or engine settings that changed. | ## Report runs [#report-runs] Each of these events carries the [report run](/api-reference/commerce/reportruns/get-report-run) in `data` at the time the event occurred. | Event | Description | | ---------------------- | ----------------------------------------------------------- | | `report_run.succeeded` | A report run's file is ready. `data.file.url` downloads it. | | `report_run.failed` | A report run failed. | # Endpoints overview (/api-reference/endpoints) Browse all Pay.com API endpoints by resource. Select a resource below to see its available operations. ## Payments [#payments] Create and manage charges, pre-authorized holds, partial approvals, transaction statuses, and tax quotes. ## Sessions [#sessions] Create and inspect payment, setup, 3D Secure authentication, and tokenization sessions. ## Payment methods [#payment-methods] Manage saved payment methods, domains, Apple Pay sessions, network tokens, and tokenized card data. ## Customers [#customers] Create, retrieve, update, and delete customer profiles. ## Payouts and refunds [#payouts-and-refunds] Send payouts to bank accounts or wallets, and refund settled charges. ## Risk and fraud [#risk-and-fraud] Assess payment risk, manage manual reviews, retrieve fraud warnings, and maintain allow or block lists. ## Disputes [#disputes] Track chargebacks, resolve pre-dispute collaborations, and upload dispute evidence documents. ## Reporting [#reporting] Retrieve settlement breakdowns, adjustments, reconciliation records, exchange rates, and cash flow transactions. ## Configuration [#configuration] Retrieve and update your payment method options, retrieve your default configuration set's payment methods, and create, list, retrieve, and delete webhook endpoints. ## Commerce [#commerce] Checkout sessions, payment links, the catalog, orders, invoices, and subscriptions have their own API, on the same hosts and keys. # Phone number formatting (/api-reference/reference/phone-number-formatting) Format phone numbers sent to the Pay.com API (such as in customer or payout details) using **ITU E.123** and **E.164** international notation. ## Format rules [#format-rules] We recommend formatting every phone number you send to the API so that it: 1. **Starts with a `+` prefix** to mark the number as international. 2. **Includes the country code** immediately after `+` (for example, `1` for the US, `44` for the UK, or `234` for Nigeria). 3. **Uses only spaces for digit grouping**, with no dashes, parentheses, dots, or other separators. ## Examples [#examples] These numbers show the recommended format and common variations. | Format | Example | Recommended | | :------------------- | :----------------------------------------------------------- | :---------- | | US number | `+1 212 555 0198` | Yes | | UK number | `+44 20 7946 0958` | Yes | | German number | `+49 30 1234 5678` | Yes | | Missing `+` prefix | `1 212 555 0198` | No | | Using dashes | `+1-212-555-0198` | No | | Using parentheses | `+1 (212) 555 0198` | No | | Using dots | `+1.212.555.0198` | No | | Missing country code | `+212 555 0198`, which reads as a number in Morocco (`+212`) | No | E.164 numbers can contain at most 15 digits, including the country code. The `+` prefix doesn't count as a digit. ## How Pay.com handles billing phone numbers [#how-paycom-handles-billing-phone-numbers] Values in `billing_details.phone` and `shipping.phone` must start with a digit or `+`, or the API rejects the request with HTTP `400`. Pay.com stores `billing_details.phone` only when it's a valid phone number for the billing country or a valid international number. Numbers that fail validation, such as numbers with the `555` area code (`+1 555 123 4567`), are dropped without an error, so features that depend on the phone number (such as [risk rule conditions](/risk/rules/payment-rules)) won't see them. ## Next steps [#next-steps] See how phone numbers fit into requests and their errors. * [Errors](/api-reference/get-started/errors): Error response shapes when a request fails validation. * [Create a charge](/payments/create-a-charge): Accept a payment using the Pay.com API. # Errors (/api-reference/vault-forwarding/errors) Errors use the API's usual shape. Errors from a forward also carry `upstream_sent`: ```json { "error": { "type": "invalid_request_error", "code": "destination_pending", "message": "The destination is waiting for review." }, "upstream_sent": false } ``` `type` is `api_error` for a `5xx` status and `invalid_request_error` otherwise. A provider's own `4xx` or `5xx` isn't an error here. It comes back with `200`, in the forward's `response.status`. ## Determine whether the provider received the request [#did-the-provider-get-it] `upstream_sent` indicates whether the provider received the request: | `upstream_sent` | Meaning | | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Absent or `false` | Nothing reached the provider. It is absent when Pay.com rejected the request before evaluating the destination. | | `true` | The provider received the full request and may have acted on it. Confirm with the provider before retrying unless the endpoint is idempotent. | | `"unknown"` | Pay.com couldn't confirm delivery. [Retrieve the forward](/api-reference/vault-forwarding/forwardrequests/get-forward-request) using the ID from the `x-pay-com-forward-id` header before retrying. | A `409` with `idempotency_in_flight`, a `429`, and a `503` include a `Retry-After` header with the number of seconds to wait. ## Codes [#codes] Check `error.code` to determine what failed and how to respond. | Code | Status | Meaning | What to do | | ----------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | `invalid_request` | `400` | The request is invalid (for example, a placeholder in the URL). The message identifies the field. Unknown paths return `404` and unsupported methods return `405`. | Fix the request. | | `card_data_not_tokenized` | `400` | A raw card number appeared outside a placeholder. | Send card data only through placeholders. | | `unauthenticated` | `401` | Missing or invalid `sk-pay-com-` API key in Basic or Bearer auth. | Send a valid API key with Basic auth. | | `field_not_allowed` | `403` | A placeholder references a card field the destination doesn't allow, or an unknown credential field. | Check the field name or request a destination that allows it. | | `credential_not_allowed` | `403` | The credential isn't associated with this destination. | Store or associate the credential for this destination. | | `destination_not_allowed` | `403` | The destination doesn't belong to your account, was rejected or disabled, or doesn't match the request host, port, path, or method. | Verify the URL and method against the active destination. | | `token_not_found` | `404` | The `tok_card_` or `pm_card_` ID doesn't belong to your account. | Verify the card token or payment method ID. | | `forward_not_found` | `404` | No forward record matches this ID, or it is older than 30 days. | Verify the forward ID. | | `destination_pending` | `409` | The destination is awaiting Pay.com review. | Wait for the activation email. | | `idempotency_in_flight` | `409` | A request with this `Idempotency-Key` is still in progress. | Retry after `Retry-After`. | | `request_too_large` | `413` | The request exceeds 5 MB before or after placeholder substitution. | Send a smaller request. | | `token_not_supported` | `422` | The card has no network token for a `network_token.*` placeholder. | Send standard card fields instead of network token fields. | | `cvc_unavailable` | `422` | The CVV is no longer available because it was already forwarded or expired after 15 minutes. | Ask the customer to re-enter the CVV. | | `idempotency_key_reused` | `422` | The `Idempotency-Key` was already used for a different request payload. | Generate a new idempotency key. | | `rate_limited` | `429` | Too many requests for your account or destination. | Retry after `Retry-After`. | | `upstream_connect_failed` | `502` | Pay.com couldn't connect to the provider or the connection dropped. | Check `upstream_sent` before retrying. | | `upstream_response_too_large` | `502` | The provider's response exceeds 5 MB. | Check with the provider, since it received the request. | | `key_check_unavailable` | `503` | Pay.com couldn't verify the API key. Nothing was sent. | Retry after `Retry-After`. | | `vault_unavailable` | `503` | Pay.com couldn't read the card, look up a `pm_card_` ID, or generate a cryptogram. Nothing was sent. | Retry after `Retry-After`. | | `forwarder_unavailable` | `500`, `503` | Temporary Pay.com error (`500` internal error or `503` service unavailable). Nothing was sent. | Retry after `Retry-After` (for `503`) or with exponential backoff. | | `upstream_timeout` | `504` | The provider didn't respond in time or Pay.com couldn't confirm the outcome. | Check `upstream_sent`. | # Vault forwarding API (/api-reference/vault-forwarding) The Vault forwarding API sends a provider's request with card data from the Pay.com vault filled in, and returns the provider's response. It has its own host and three resources: * [Destinations](/api-reference/vault-forwarding/destinations/request-destination): the provider endpoints you may forward to. * [Credentials](/api-reference/vault-forwarding/credentials/store-credential): your secrets for a provider. * [Forward requests](/api-reference/vault-forwarding/forwardrequests/forward-request): the requests themselves, written with [placeholders](/api-reference/vault-forwarding/placeholders). For a walkthrough, see [Forward cards to another provider](/payments/vault-forwarding). ## Hosts [#hosts] The API has one host for each environment. | Environment | Base URL | | ----------- | ------------------------------------ | | Sandbox | `https://forward.sandbox.pay.com/v1` | | Live | `https://forward.pay.com/v1` | ## Authentication [#authentication] Send a Pay.com API key with HTTP Basic auth (the key as the password), as for the rest of the API. `Authorization: Bearer` with the key is also accepted. Only keys starting with `sk-pay-com-` are valid. Any other key returns `401` with `code: unauthenticated`. A live key scoped to multiple workspaces specifies the target workspace in the Basic auth username. See [Choose the workspace](/developer-resources/authentication/scoped-api-keys#choose-the-workspace). ```bash curl https://forward.sandbox.pay.com/v1/forward_requests/fwd_01JDQ6W2X4Y6Z8A0B2C4D6E8F0 \ -u ':sk-pay-com-sandbox-…' ``` Requests without a key return `401` with `code: unauthenticated`. Other key errors match the core API. See [Authentication errors](/developer-resources/authentication#authentication-errors). Send request bodies as JSON with `Content-Type: application/json`. ## IDs [#ids] Each ID prefix identifies its resource type. | Prefix | Resource | | ----------------------- | -------------------------------------------------------------------------- | | `fdst_` | Destination | | `fcred_` | Credential | | `fwd_` | Forward request | | `fcert_` | Client certificate for a provider requiring mutual TLS | | `tok_card_`, `pm_card_` | Card saved with Pay.com ([token or payment method](/payments/saved-cards)) | ## Idempotency [#idempotency] Send an `Idempotency-Key` header when you [forward a request](/api-reference/vault-forwarding/forwardrequests/forward-request) to make retries safe. Keys must be 1 to 255 printable ASCII characters without spaces and are stored for 24 hours. | Idempotency key state | Behavior | | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | Completed (provider reached or uncertain) | Returns the original tokenized and redacted response with `x-pay-com-idempotent-replayed: true` without forwarding again. | | Rejected before forwarding | Releases the key so a new attempt is forwarded. | | In progress | Returns `409` with `idempotency_in_flight`. Retry after the number of seconds in `Retry-After`. | | Reused with a different payload | Returns `422` with `idempotency_key_reused`. Generate a new key. | ## The CVV [#the-cvc] A CVV stays usable for up to 15 minutes after collection. Forwarding deletes it once a request carrying it is sent to the provider (regardless of the provider's response), unless Pay.com configured the destination to reuse CVVs. Requests that don't reach the provider (`upstream_sent: false`) preserve the CVV for retries. Requesting an expired or already-consumed CVV returns `422` with `code: cvc_unavailable`. ## Limits [#limits] Forward requests and the records Pay.com keeps have these limits. | What | Limit | | -------------------------------------- | ----------------------------------------------------------------------------- | | Request body | 5 MB, also after the placeholders are filled | | Provider's reply | 5 MB | | Time for the provider to respond | 30 seconds, or up to 120 seconds for a destination Pay.com set up for it | | Connecting to the provider | 5 seconds | | URL | 4,096 characters | | Headers | 64, each value up to 8,192 characters | | JSON body depth | 32 levels | | Placeholders | 256 for each request | | `pm_card_` IDs | 10 for each request | | `response.tokenize`, `response.redact` | 32 and 64 paths | | Rate | Limited per account and per destination. Requests over the limit return `429` | | Idempotency keys | Kept 24 hours | | Forward records | Kept 30 days | ## Network [#network] Every forward request reaches the provider from Pay.com's network. * Pay.com connects only over HTTPS with TLS 1.2 or later and verifies the provider's certificate for the hostname. * Pay.com resolves the provider's host once, rejects private, internal, and other non-public addresses, and connects directly to the verified IP address. * Requests leave from fixed Pay.com IP addresses, which a provider can allowlist. Dedicated addresses for your account are available as a paid option. * For a provider that requires a client certificate, Pay.com generates the key pair and provides a certificate signing request (CSR) for the provider to sign. The private key never leaves Pay.com. # Placeholders (/api-reference/vault-forwarding/placeholders) A placeholder marks where Pay.com fills in a value when it [forwards a request](/api-reference/vault-forwarding/forwardrequests/forward-request). It names a card or a credential, then a field, and optionally a filter: ```text {{ tok_card_296645958265997326.number }} {{ tok_card_296645958265997326.exp_year | yy }} {{ fcred_01JDQ5H7K9M1N3P5Q7R9S1T3V5.api_key }} ``` Spaces inside the braces are optional. The ID is a `tok_card_` token, a `pm_card_` payment method, or an `fcred_` credential. A request can name up to 10 different `pm_card_` IDs. ## Card fields [#card-fields] A card placeholder names one of these fields. | Field | Value | | -------------------------- | ------------------------------------------------------------------------------------------------- | | `number` | The card number, digits only | | `exp_month` | The expiration month, two digits, such as `07` | | `exp_year` | The expiration year, four digits, such as `2030` | | `name` | The cardholder's name | | `cvc` | The card's security code. It's sent once. See [The CVV](/api-reference/vault-forwarding#the-cvc). | | `bin` | The first six digits | | `last4` | The last four digits | | `network_token.number` | The card's network token | | `network_token.exp_month` | The network token's expiration month | | `network_token.exp_year` | The network token's expiration year | | `network_token.cryptogram` | A cryptogram made for this request | | `network_token.eci` | The electronic commerce indicator (ECI) that comes with the cryptogram | A destination's `allowed_fields` lists card fields by these names. A field starting `network_token.` needs a card with a network token, and is otherwise refused with `token_not_supported`. ## Credential fields [#credential-fields] A credential's fields are the names you [stored it](/api-reference/vault-forwarding/credentials/store-credential) with, such as `api_key`. ## Filters [#filters] A filter after `|` changes the value before it's sent. | Filter | What it does | Example | | -------- | ------------------------------- | ------------------------------------- | | `yy` | Keeps the last two digits | `2030` becomes `30` | | `digits` | Strips non-digit characters | `4242-4242` becomes `42424242` | | `upper` | Converts the value to uppercase | `Ada Lovelace` becomes `ADA LOVELACE` | ## Where placeholders go [#where-placeholders-go] Placeholders are allowed in header values and request bodies under these rules: * Placeholders are allowed only in header values and request bodies, never in header names, JSON keys, or the URL. A placeholder in the URL returns `400` (`invalid_request`). * In a JSON body, place placeholders inside string values. The substituted value is always a string (for example, `"{{ tok_card_….exp_month }}"` sends `"07"`). * In a string body, place placeholders anywhere. Each value is escaped according to the request's `Content-Type`: JSON, XML (`*/xml` and `*+xml`), or form data (`application/x-www-form-urlencoded`). String bodies with placeholders and any other content type are rejected. * Every `{{` in a header value or request body must begin a valid placeholder. * Every referenced card field must be listed in the destination's `allowed_fields`, and every credential must be stored for the destination. A request containing a raw card number outside a placeholder in the URL, headers, or body is rejected with `card_data_not_tokenized`, and nothing is sent. # Webhook events (/api-reference/webhooks/webhook-events) Pay.com sends webhook events across the lifecycle of every resource in your account. Each event includes a `type` identifying what happened and a `data` object containing the resource snapshot at the time of the event: ```json title="Event" { "id": "evt_191439662182903690", "resource": "event", "type": "charge.succeeded", "created": "2022-09-07T13:40:41.751Z", "data": { ... } } ``` Verify the `Pay-Signature` header on every incoming event before processing it (see [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures)). Each resource's events are also listed alongside its endpoints in the API reference, for example [Charge events](/api-reference/endpoints/charges/events). Commerce sends events for its own resources, such as orders, invoices, credit notes, products, prices, entitlements, customer claims, subscription connections, and report runs. See [Commerce events](/api-reference/commerce/events). The checkout session and subscription events below are the ones Pay.com sends today. For how they change under Commerce, see [Webhook events](/commerce/commerce-api#webhook-events) in the Commerce API overview. ## Events by resource [#events-by-resource] Each resource lists the events Pay.com sends about it. ### [Charges](/api-reference/endpoints/charges/events) [#charges] | Event | Sent when | | :--- | :--- | | `charge.succeeded` | The charge is approved and funds are captured. | | `charge.failed` | The payment method declined the request and the charge has failed. | | `charge.refunded` | A refund for the charge was created (full or partial). | | `charge.requires_confirmation` | The charge was authenticated and needs confirmation via the API to execute. | | `charge.pending` | The charge was created. | | `charge.accepted` | A charge was created on an external platform and was accepted by Pay.com. | | `charge.updated` | The charge was updated. | | `charge.clearing_abandoned` | Clearing was abandoned: the charge won’t be settled, and it won’t appear in settlement reports. | | `charge.requires_partial_approval_action` | A server-to-server partial approval was started. The charge is waiting for the merchant to confirm or cancel the partial amount. | ### [Holds](/api-reference/endpoints/holds/events) [#holds] | Event | Sent when | | :--- | :--- | | `hold.requires_capture` | The hold is approved and funds are waiting to be captured. | | `hold.succeeded` | The hold is captured. Sent only for the first capture in a multi-capture scenario. | | `hold.captured` | The hold is captured. Sent for every capture in a multi-capture scenario. | | `hold.failed` | The payment method declined the request and the hold has failed. | | `hold.canceled` | The hold on the funds expired or was canceled by the merchant. | | `hold.requires_confirmation` | The hold was authenticated and needs confirmation to process. | | `hold.funds_about_to_expire` | The hold on the funds is about to expire. | ### [Refunds](/api-reference/endpoints/refunds/events) [#refunds] | Event | Sent when | | :--- | :--- | | `refund.succeeded` | A refund for a charge was successfully created. | | `refund.failed` | The refund request has failed. | | `refund.pending` | The refund request was created. | | `refund.updated` | The refund was updated. | ### [Payouts](/api-reference/endpoints/payouts/events) [#payouts] | Event | Sent when | | :--- | :--- | | `payout.succeeded` | The payout is approved and funds have been sent to the customer. | | `payout.failed` | The payout request has failed. | | `payout.pending` | The payout request was created. A follow-up webhook will be sent with the final outcome. | | `payout.returned` | The bank returned the payout, and the funds went back to your balance. | ### [Payment sessions](/api-reference/endpoints/paymentsessions/events) [#payment-sessions] | Event | Sent when | | :--- | :--- | | `payment_session.open` | The payment session was created but no action has been taken yet. | | `payment_session.completed` | The payment session was completed and approved. A payment method was attached and a charge or hold was created based on the session parameters. | | `payment_session.failed` | The payment session failed without a successful charge. A failed session may have multiple declined payment attempts. | | `payment_session.displayed` | The payment session was displayed to the customer with all provided details. | ### [Payment attempts](/api-reference/endpoints/paymentattempts/events) [#payment-attempts] | Event | Sent when | | :--- | :--- | | `payment_attempt.succeeded` | An individual attempt within a payment session succeeded. | | `payment_attempt.failed` | An individual attempt within a payment session failed. | ### Retried attempts [#retried-attempts] | Event | Sent when | | :--- | :--- | | `retried_attempt.created` | A provider retry attempt was created. | ### [Setup sessions](/api-reference/endpoints/setupsessions/events) [#setup-sessions] | Event | Sent when | | :--- | :--- | | `setup_session.open` | The setup session was created but no action has been taken yet. | | `setup_session.completed` | The setup session was completed and a payment method was successfully saved. | | `setup_session.failed` | The setup session failed without a successful payment method attachment. | ### [Setup attempts](/api-reference/endpoints/setupattempts/events) [#setup-attempts] | Event | Sent when | | :--- | :--- | | `setup_attempt.succeeded` | An individual attempt within a setup session succeeded. | | `setup_attempt.failed` | An individual attempt within a setup session failed. | ### [Authentication sessions](/api-reference/endpoints/authenticationsessions/events) [#authentication-sessions] | Event | Sent when | | :--- | :--- | | `authentication_session.open` | A new authentication session was created. | | `authentication_session.authenticated` | The authentication session succeeded. | | `authentication_session.failed` | The authentication session failed. | ### [Checkout sessions](/api-reference/commerce/events#checkout-sessions) [#checkout-sessions] | Event | Sent when | | :--- | :--- | | `checkout_session.open` | The checkout session was created but no action has been taken yet. | | `checkout_session.completed` | The checkout session was completed and approved. | | `checkout_session.failed` | The checkout session has failed. | ### [Payment methods](/api-reference/endpoints/paymentmethods/events) [#payment-methods] | Event | Sent when | | :--- | :--- | | `payment_method.created` | The payment method was verified and created in the system. | | `payment_method.failed_authentication` | The additional authentication failed and the payment method cannot be used. | | `payment_method.requires_confirmation` | The payment method was authenticated and needs confirmation to complete verification. | | `payment_method.updated` | The payment method was updated. | | `payment_method.deleted` | The payment method was deleted. | | `payment_method.network_token.provisioned` | A network token was provisioned for the payment method. | | `payment_method.network_token.deleted` | A network token for the payment method was deleted. | | `payment_method.third_party_token.created` | A third-party token was created for the payment method. | | `payment_method.recurring_mandate.created` | A recurring mandate was created for the payment method. | | `payment_method.recurring_mandate.canceled` | The payment method’s recurring mandate was canceled. | ### [Customers](/api-reference/endpoints/customers/events) [#customers] | Event | Sent when | | :--- | :--- | | `customer.created` | A new customer was created. | | `customer.updated` | A customer's details were updated. | | `customer.deleted` | The customer was deleted. | | `customer.default_source.changed` | A customer's default payment method changed. | ### [Subscriptions](/api-reference/commerce/events#subscriptions) [#subscriptions] | Event | Sent when | | :--- | :--- | | `subscription.failed` | The subscription has failed. | | `subscription.active` | The subscription is active, either after initial creation or after a failed charge that succeeded on retry. | | `subscription.charged` | The subscription charge succeeded at the end of a billing term. | | `subscription.unpaid` | The subscription charge failed and the subscription entered a retry sequence. | | `subscription.attempted` | A retry attempt to charge the subscription failed. Sent for each failed retry until the subscription is canceled. | | `subscription.canceled` | The subscription was canceled. The `cancellation_reason` field indicates why: `ended`, `cancellation_requested`, `charge_disputed` or `charge_failed`. | | `subscription.upcoming_renewal` | Sent before the end of the billing term, based on the configured advance notice period. | | `subscription.payment_method.upcoming_expiry` | The stored payment method is expiring within one month. | ### [Disputes](/api-reference/endpoints/disputes/events) [#disputes] | Event | Sent when | | :--- | :--- | | `dispute.new` | A new dispute that needs information from you was received. | | `dispute.open` | The customer initiated a chargeback. | | `dispute.evidence_under_review` | The submitted defense is under review. | | `dispute.chargeback_accepted` | The merchant agreed with the chargeback. | | `dispute.chargeback_canceled` | The customer canceled the chargeback. | | `dispute.resolved` | The dispute was resolved automatically. | | `dispute.resolved_rapid_dispute_resolution` | The dispute was pre-resolved through the Visa RDR program. | | `dispute.expired` | The merchant did not respond to the dispute on time. | | `dispute.lost` | The issuing bank rejected the defense. | | `dispute.won` | The issuing bank accepted the defense. | | `dispute.pre_arbitration` | The customer initiated a second chargeback. | | `dispute.arbitration_under_review` | The merchant proceeded to card network arbitration. | | `dispute.arbitration_lost` | The arbitration process was lost. | | `dispute.arbitration_won` | The arbitration process was won. | | `dispute.evidence_under_review_auto_defend` | The defense was submitted automatically and is under review. | | `dispute.evidence_rejected` | The submitted evidence was rejected. | ### [Documents](/api-reference/endpoints/documents/events) [#documents] | Event | Sent when | | :--- | :--- | | `document.created` | A document was created. | | `document.pending` | The document was uploaded and is pending review. | | `document.active` | The document was accepted and is now active. | | `document.rejected` | The document was rejected. | ### [Collaborations](/api-reference/endpoints/collaborations/events) [#collaborations] | Event | Sent when | | :--- | :--- | | `collaboration.open` | The collaboration was opened. | | `collaboration.resolved` | The collaboration was resolved. | | `collaboration.escalated` | The collaboration was escalated. | ### [Risk reviews](/api-reference/endpoints/riskreview/events) [#risk-reviews] | Event | Sent when | | :--- | :--- | | `review.customer.created` | A customer review was created. | | `review.customer.expired` | A customer review has expired. | | `review.customer.reviewed` | A customer review was reviewed. | | `review.transaction.created` | A transaction review was created. | | `review.transaction.expired` | A transaction review has expired. | | `review.transaction.reviewed` | A transaction review was reviewed. | ### [Customer block reviews](/api-reference/endpoints/customerblockreviews/events) [#customer-block-reviews] | Event | Sent when | | :--- | :--- | | `customer_block_review.created` | A customer block review was created. | ### [Fraud warnings](/api-reference/endpoints/fraudwarnings/events) [#fraud-warnings] | Event | Sent when | | :--- | :--- | | `fraud_warning.created` | A transaction was officially reported as fraud via TC40 or SAFE files. This event lets you proactively refund the charge before it becomes a dispute. | ### Risk rules [#risk-rules] | Event | Sent when | | :--- | :--- | | `rule.created` | A risk rule was created. | | `rule.updated` | A risk rule was updated. | | `rule.deleted` | A risk rule was deleted. | ### [Settlements](/api-reference/endpoints/settlements/events) [#settlements] | Event | Sent when | | :--- | :--- | | `settlement.paid` | The settlement was paid. | ### [Reconciliation](/api-reference/endpoints/reconciliation/events) [#reconciliation] | Event | Sent when | | :--- | :--- | | `reconciliation.update` | The reconciliation was updated. | ### [Cash flow transactions](/api-reference/endpoints/cashflow/events) [#cash-flow-transactions] | Event | Sent when | | :--- | :--- | | `cashflow_transaction.created` | A transaction cleared and cashflow data is available. | ### [Exchange rates](/api-reference/endpoints/exchangerates/events) [#exchange-rates] | Event | Sent when | | :--- | :--- | | `exchange_rates.update` | Exchange rates were updated. | ### Reports [#reports] | Event | Sent when | | :--- | :--- | | `report.uploaded` | The report was generated and uploaded. | # Customize reports (/data/reporting/customize-reports) Pay.com support customizes reports for you. You can change the columns of the daily transaction reconciliation report, or have Pay.com set up a custom report that runs on your own schedule. ## Change the transaction reconciliation report [#change-the-transaction-reconciliation-report] Pay.com support can add columns to the [transaction reconciliation report](/data/reporting/transaction-reconciliation-report), or remove the ones you don't use. * **Add columns.** Any field you can choose in the transaction export of the Pay.com dashboard can be added. Added columns come after `related_transaction`, in the order you ask for. * **Remove columns.** Any default column can be removed, except `id`, `merchant_id`, and `status`, which every report keeps. * **Metadata.** The report has one `metadata` column with all of a transaction's metadata as a JSON object. To have each metadata key in its own column, use a [custom report](#custom-reports). The other daily reports have fixed columns. ## Custom reports [#custom-reports] A custom report is a CSV of your transactions that Pay.com generates on a schedule you choose and writes to your Amazon S3 bucket. Use one when the daily reports don't fit, for example for an activity report every 30 minutes that lists every payment with its routing details. You choose: * **The columns**, including a column for each metadata key you need. * **The filters**, such as payment method types, statuses, or settlement accounts. * **The schedule and window**, such as every 30 minutes, covering the 30 minutes before each run. * **Where it goes**: a folder in your S3 bucket, and optionally an email with the file attached. Each file is named after the report and the window it covers, in Unix time milliseconds, such as `payments_activity_1785237000000_1785238800000.csv`. By default, each day's files go in a folder named for the date, such as `20260728/`. For access to your bucket, give Pay.com an IAM role it can assume, or an access key for an IAM user that can write to the folder. Pay.com support gives you the details for the role's trust policy. To set up a custom report, contact Pay.com support with the columns, filters, schedule, and bucket you need. ## Next steps [#next-steps] * [Transaction reconciliation report](/data/reporting/transaction-reconciliation-report): The default columns. * [Receive report files](/data/reporting/delivery): How the daily reports reach you. * [Daily reports](/data/reporting/daily-reports): The reports and their format. # Daily reports (/data/reporting/daily-reports) Pay.com generates CSV reports of your cleared transactions, settlements, disputes, fraud warnings, and exchange rates. By default, it generates every report that applies to your account and writes it to your folder on Pay.com's SFTP server. Pay.com support can turn each report on or off, and have it pushed to your Amazon S3 bucket or sent by email. ## Reports [#reports] Each report has its own field reference. File names start with your merchant ID, such as `mrchnt_296645958265997325`, then the report date as `YYYYMMDD`. | Report | File name | Generated | Contents | | :------------------------------------------------------------------------------ | :------------------------------------------------------------------ | :----------------------------------------- | :------------------------------------------------------------------------------- | | [Transaction reconciliation](/data/reporting/transaction-reconciliation-report) | `__transaction_reconciliation.csv` | Daily | The previous day's cleared charges, holds, refunds, and payouts, with their fees | | [Settlement](/data/reporting/settlement-report) | `__settlement_breakdown_.csv` | With each settlement | Every transaction, fee, adjustment, and reserve movement in the settlement | | [Disputes, daily updates](/data/reporting/disputes-reports) | `__disputes_daily.csv` | Daily | The disputes that changed | | [Disputes, all open](/data/reporting/disputes-reports) | `__disputes.csv` | Daily | Every open dispute, and the closed ones that changed | | [Fraud warnings](/data/reporting/fraud-report) | `__fraud.csv` | Daily | The fraud warnings that issuers reported | | [Exchange rates](/data/reporting/exchange-rates-report) | `__fx.csv` | Daily, if Pay.com converts your currencies | The rates for charges, refunds, and payouts | The exchange rates report applies only when Pay.com converts your transactions into a different settlement currency. ## When reports are ready [#when-reports-are-ready] Reports don't have a fixed time. Pay.com generates a day's reports once the clearing data for that day has arrived from every acquirer and processor your account uses. A settlement report is generated when Pay.com finalizes the settlement. All dates and times in reports are in UTC. The transaction reconciliation report dated `20260728` covers the transactions that cleared on 27 July 2026. To start your import as soon as a file is ready, listen for the [`report.uploaded`](/data/reporting/webhooks#report-files) event. If Pay.com pushes the files to your S3 bucket, start from each file's arrival in the bucket instead. ## File format [#file-format] Every report has the same format: * CSV with commas between fields, a header row, UTF-8 encoding without a byte order mark, and LF line endings. * An empty field means the value doesn't apply or isn't known. * Text values can be quoted, and some contain commas, such as card issuer names. Read the files with a CSV parser. * Amounts are decimals in the major currency unit, such as `100.5` for €100.50. Fees can have up to 6 decimal places. Refunds and payouts are negative. * Timestamps are ISO 8601 in UTC, such as `2026-07-27T14:03:11.204Z`. * IDs are the same as the API's, such as `chrg_296645958265997312`. ## Turn reports on or off [#turn-reports-on-or-off] Pay.com support turns each report on or off for your account and sets how it's delivered. To change which reports you receive or where they go, contact Pay.com support. To add or remove columns, see [Customize reports](/data/reporting/customize-reports). ## Next steps [#next-steps] * [Receive report files](/data/reporting/delivery): Get the files from SFTP, Amazon S3, or email. * [Transaction reconciliation report](/data/reporting/transaction-reconciliation-report): Every column of the daily transaction file. * [Reporting webhooks](/data/reporting/webhooks): Know when each file is ready. # Receive report files (/data/reporting/delivery) Pay.com writes every report to your folder on its SFTP server. It can also copy each file to your Amazon S3 bucket, or email it. Pay.com support sets up the push for you, for all reports or each report separately. | Method | You set it up | You provide | | :------------------------------ | :----------------------- | :------------------------------ | | [SFTP](#download-from-sftp) | In the Pay.com dashboard | An SSH key | | [Amazon S3](#push-to-amazon-s3) | Through Pay.com support | Your bucket, region, and access | | [Email](#send-by-email) | Through Pay.com support | Email addresses | For automated ingestion, Pay.com recommends the S3 push. ## Download from SFTP [#download-from-sftp] Connect to Pay.com's SFTP server with an SSH key. Every report is in your folder. | Setting | Value | | :------------- | :---------------------------------------------------- | | Host | `sftp.pay.com` | | Port | `22` | | Username | Your merchant ID, such as `mrchnt_296645958265997325` | | Authentication | SSH key. Passwords aren't accepted. | Set your key in the Pay.com dashboard: ### Open the SFTP page [#open-the-sftp-page] Go to **Developers** → **SFTP**. Changing the key needs permission to edit SFTP settings, and two-factor authentication on your Pay.com user. ### Add a key [#add-a-key] Choose one of the two options: * **Generate public and private key.** Pay.com creates an Ed25519 key pair, keeps the public key, and your browser downloads the private key once, as `id_ed25519`. Store it safely, since Pay.com can't show it again. * **Enter public key.** Paste the public key of a key pair you created. Your merchant account has one key. A new key replaces the old one. ### Connect [#connect] Connect with the private key, for example with `sftp`: ```bash sftp -i ~/.ssh/id_ed25519 -P 22 mrchnt_296645958265997325@sftp.pay.com ``` The folder is flat: every report is in it, named as described in [Daily reports](/data/reporting/daily-reports#reports). To fetch new files as they arrive, listen for the [`report.uploaded`](/data/reporting/webhooks#report-files) event, whose `filename` is the file's name in the folder. ## Push to Amazon S3 [#push-to-amazon-s3] Pay.com copies each report into your S3 bucket after it writes it to SFTP. Give Pay.com support these settings: | Setting | Required | Description | | :------ | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Bucket | Yes | The bucket's name | | Folder | No | The folder in the bucket. `YYYYMMDD` anywhere in it becomes the report date, so `reports/YYYYMMDD` puts the 28 July 2026 files in `reports/20260728`. | | Region | No | The bucket's AWS region | | Access | Yes | Either an access key for an IAM user that can write to the folder, or a bucket policy that lets Pay.com write to it. Pay.com support gives you the details for the policy. | Each file keeps its SFTP name, so its key is `/`. Pay.com sets no encryption on the files, so your bucket's default encryption applies. With an access key, the IAM user needs `s3:PutObject` on the folder. Share the key only through the channel Pay.com support gives you. Pay.com sends `report.uploaded` before it copies the file to your bucket. To start your import when the file is in your bucket, use an [S3 event notification](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html) on the folder instead. The settlement PDFs stay on SFTP and aren't copied to S3. ## Send by email [#send-by-email] Pay.com can email each report, with the CSV attached, to the addresses you give Pay.com support. Emails come from `reporting@pay.com`, with the recipients in BCC. The subject names your merchant account, the report, and its date, for example `[Pay.com] ACME Store - Daily Transaction Reconciliation - 2026-07-28`. ## Next steps [#next-steps] * [Daily reports](/data/reporting/daily-reports): The reports and when they're ready. * [Customize reports](/data/reporting/customize-reports): Change columns, or set up a report on your own schedule. * [Reporting webhooks](/data/reporting/webhooks): Know when each file is ready. # Disputes reports (/data/reporting/disputes-reports) Pay.com generates two disputes reports each day. Both have the same columns. | Report | File name | Rows | | :------------ | :-------------------------------------------- | :------------------------------------------------------------------------------------------- | | Daily updates | `__disputes_daily.csv` | The disputes that changed that day, and the disputes whose chargeback cleared the day before | | All open | `__disputes.csv` | Every dispute that's still open, and the closed disputes that changed that day | Use the daily updates report to track what changed, and the all open report to check your list of open disputes against Pay.com's. For each dispute's events, see [Dispute events](/risk/disputes/events-and-testing). ## Columns [#columns] The reports have 24 columns, in this order. | Column | Description | | :--------------------------- | :--------------------------------------------------------------------------------------------------------- | | `merchant` | Your merchant ID (`mrchnt_…`) | | `merchant_reference` | Your merchant account's reference, or its name if it has no reference | | `resource` | `dispute` | | `id` | The dispute's ID (`dspt_…`) | | `amount` | The amount of the latest chargeback stage, the one in `chargeback_type`. Negative for a chargeback. | | `currency` | The dispute's currency | | `settlement_amount` | The amount of the latest chargeback stage, in your settlement currency | | `settlement_currency` | Your settlement currency | | `reason_code` | The card network's reason code. See [Reason codes](/risk/disputes/reason-codes). | | `status` | The dispute's status, with the same values as the API | | `created` | When Pay.com received the dispute, the same as the API's `created` | | `status_date` | When the status last changed | | `chargeback_type` | The latest chargeback stage: `chargeback`, `representment`, `second_chargeback`, or `second_representment` | | `charge_reference` | Your reference on the original charge | | `charge` | The original charge's ID (`chrg_…`) | | `charge_amount` | The original charge's amount | | `charge_currency` | The original charge's currency | | `charge_settlement_amount` | The original charge's amount in your settlement currency | | `charge_settlement_currency` | The original charge's settlement currency | | `fee_interchange` | The interchange fee on the latest chargeback stage | | `fee_network` | The card network's fee on the latest chargeback stage | | `fee_processing` | Pay.com's fee on the latest chargeback stage | | `network` | The card network, such as `visa` | | `arn` | The acquirer reference number, or the retrieval reference number when the acquirer doesn't send an ARN | The amount, settlement, fee, and `chargeback_type` columns fill in once the acquirer clears the chargeback. A dispute can first appear with them empty, and show them in a later report. ## Next steps [#next-steps] * [Dispute lifecycle](/risk/disputes/lifecycle): What each status means and what to do. * [Settlements](/data/reconciliation/settlements): Where a chargeback's amount and fees are taken from your payout. * [Daily reports](/data/reporting/daily-reports): The other reports and their format. # Exchange rates report (/data/reporting/exchange-rates-report) The exchange rates report lists the rates Pay.com uses to convert transactions into your settlement currency, with your markup included. You receive it only when Pay.com converts your transactions into a different settlement currency. File name: `__fx.csv`. ## Columns [#columns] Each row is one currency pair, for the time from `valid_from` to `valid_until`. | Column | Description | | :--------------------- | :-------------------------------------------------------------------------------- | | `transaction_currency` | The currency of the transaction, as a lowercase ISO 4217 code | | `settlement_currency` | Your settlement currency | | `valid_from` | When the rates take effect | | `valid_until` | When the rates end. Empty when they have no set end. | | `charge_rate` | The rate for charges | | `refund_rate` | The rate for refunds | | `payout_rate` | The rate for payouts | | `network` | `visa` or `mastercard`, when the rates differ by card network. Present only then. | The settlement amount is the transaction amount divided by the rate. When a transaction clears, the acquirer's own rate can replace the one in the report. See [Exchange rates](/data/reconciliation/exchange-rates). ## Next steps [#next-steps] * [Exchange rates](/data/reconciliation/exchange-rates): Look up a rate, and the rate applied to a charge, with the API. * [Reporting webhooks](/data/reporting/webhooks): `exchange_rates.update` tells you when new rates take effect. * [Daily reports](/data/reporting/daily-reports): The other reports and their format. # Fraud warnings report (/data/reporting/fraud-report) The fraud warnings report lists the fraud warnings Pay.com received that day. A fraud warning is an issuer's report, a Visa TC40 or a Mastercard SAFE record, that a charge was fraudulent. Each row is a [fraud warning](/risk/fraud-warnings), the same object that the `fraud_warning.created` event carries. File name: `__fraud.csv`. A fraud warning moves no money. When `actionable` is `true`, refunding the charge can prevent a dispute. ## Columns [#columns] The report has 13 columns, in this order. | Column | Description | | :---------------------- | :-------------------------------------------------------------------------------- | | `merchant` | Your merchant ID (`mrchnt_…`) | | `merchant_reference` | Your merchant account's reference, or its name if it has no reference | | `resource` | `fraud_warning` | | `id` | The fraud warning's ID: `frdwrn_` and the charge's digits | | `actionable` | `true` if the charge isn't refunded or disputed yet, so you can still act on it | | `fraud_type` | The kind of fraud reported, such as `made_with_stolen_card` or `account_takeover` | | `created` | When the fraud was reported | | `amount` | The charge's approved amount | | `currency` | The charge's currency | | `charge` | The charge's ID (`chrg_…`) | | `reference` | Your reference on the charge | | `customer_id` | Pay.com's customer ID (`cust_…`) | | `customer_reference_id` | Your ID for the customer | `fraud_type` takes the values of the fraud warning's `fraud_type` in the API: `made_with_lost_card`, `made_with_stolen_card`, `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `unauthorized_use_of_card`, `account_takeover`, `modification_of_payment_order`, or `misc`. ## Next steps [#next-steps] * [Fraud warnings](/risk/fraud-warnings): How to act on a fraud warning. * [Reporting webhooks](/data/reporting/webhooks): Receive each fraud warning as it arrives. * [Daily reports](/data/reporting/daily-reports): The other reports and their format. # Reporting (/data/reporting) Pay.com gives you the same transaction data three ways: webhook events as each change happens, CSV reports after each day's transactions clear, and API lists you can query at any time. The data covers every acquirer and processor your payments go through. Pay.com ingests each one's reporting and maps it to Pay.com's own objects, so events and files have the same format whichever acquirer processed a payment. ## Choose how to receive data [#choose-how-to-receive-data] Most integrations combine webhooks, for updates as transactions clear, with a daily report for accounting. | Method | What you receive | When | Use it for | | :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- | :------------------------------------------ | | [Webhooks](/data/reporting/webhooks) | One event per change, such as a transaction that cleared with its fees, a dispute's new status, or a paid settlement | As each change happens | Updating your systems as transactions clear | | [Daily reports](/data/reporting/daily-reports) | CSV files of cleared transactions, settlements, disputes, fraud warnings, and exchange rates | Once a day, after the day's transactions clear. A settlement report comes with each settlement. | Reconciling your ledger or ERP | | [Custom reports](/data/reporting/customize-reports#custom-reports) | CSV files with the columns, filters, and interval you choose | On a schedule, such as every 30 minutes | Feeds that the daily reports don't cover | | [API](/data/bulk-queries) | Lists of charges, refunds, payouts, cash flow transactions, settlements, disputes, and more | On request, up to 100 objects per call | Lookups and backfills | ## Where reports go [#where-reports-go] Pay.com writes every report to your folder on its SFTP server. It can also push each file to your Amazon S3 bucket or send it by email. For automated ingestion, Pay.com recommends the S3 push. Reading a day's transactions through the API takes one call for every 100 of them. See [Receive report files](/data/reporting/delivery). ## How a report is produced [#how-a-report-is-produced] Each day's reports wait for the clearing data from every acquirer and processor your account uses, so a report holds the day's final amounts and fees. `reconciliation.update` comes before the transaction reconciliation report, and `report.uploaded` follows each file. A settlement report is produced when its settlement is finalized, not on the daily run. See [Reconciliation](/data/reconciliation) for how clearing works. ## Next steps [#next-steps] * [Daily reports](/data/reporting/daily-reports): The reports, their file names, and when they're ready. * [Receive report files](/data/reporting/delivery): SFTP, Amazon S3, and email, and what each needs. * [Reporting webhooks](/data/reporting/webhooks): Events for cleared transactions, disputes, fraud warnings, and settlements. * [Customize reports](/data/reporting/customize-reports): Add or remove columns, and set up custom reports. # Settlement report (/data/reporting/settlement-report) Pay.com generates a settlement report for each settlement it finalizes. It lists the settlement's transactions, the fees it charged, the adjustments and reserve movements it applied, and the amount it paid you. File name: `__settlement_breakdown_.csv`, such as `mrchnt_296645958265997325_20260320_settlement_breakdown_stlmnt_690127572775747584.csv`. Your SFTP folder can also hold the settlement's statement and its tax invoice or credit note, as PDFs named the same way, such as `mrchnt_296645958265997325_20260320_settlement_statement_stlmnt_690127572775747584.pdf`. The PDFs are on SFTP only. They aren't pushed or emailed. ## Rows [#rows] Each row's `category` says what it is. | `category` | Rows | `resource` and `id` | | :---------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------- | | `processing` | One row for each transaction in the settlement, with the same fields as the [transaction reconciliation report](/data/reporting/transaction-reconciliation-report) | The transaction's, such as `charge` and `chrg_…` | | `adjustments` | One row for each [adjustment](/data/reconciliation/adjustments). `description` is the adjustment's kind, and `net_amount` its total. | `adjustments` and `adj_…` | | `rolling_reserve` | One row for each reserve withheld, with a negative amount, and each reserve released, with a positive amount | `reserve` and `rsrv_…`, or `release` and `rsrv_rls_…` | | `invoice` | Fee totals for each pricing segment and transaction type. The fee columns hold the totals, and `net_amount` their sum. | | | `settlement` | One row for the settlement itself, with its payout `status` and its `net_amount`, the amount paid to your bank | `settlements` and `stlmnt_…` | ## Columns [#columns] The report has 35 columns, in this order. | Column | Description | | :----------------------------------- | :----------------------------------------------------------------------------- | | `settlement_date` | The settlement's date | | `category` | The row's kind. See [Rows](#rows). | | `merchant_id` | Your merchant ID (`mrchnt_…`) | | `merchant_name` | Your merchant account's name | | `resource` | The row's object type | | `id` | The row's ID | | `description` | For an adjustment, its kind, such as `monthly_service_fee` | | `payment_session` | The payment session's ID (`ps_…`), for a transaction made in a payment session | | `date` | When the transaction was created | | `reference` | Your reference on the transaction | | `status` | The transaction's status, or on the `settlement` row the payout's status | | `failure_code` | Pay.com's failure code, for a failed transaction | | `currency` | The transaction's currency | | `amount` | The transaction amount. Negative for refunds and payouts. | | `settlement_currency` | The settlement's currency | | `settlement_amount` | The amount in the settlement currency | | `exchange_rate` | The rate used to convert `amount`, when the currencies differ | | `net_amount` | The amount after fees, in the settlement currency | | `fee_interchange` | The interchange fee. `0` on blended pricing. | | `fee_network` | The card network's fee. `0` on blended pricing. | | `fee_processing` | Pay.com's processing fee. On blended pricing, the whole fee. | | `metadata` | The transaction's metadata, as a JSON object | | `jurisdiction` | `domestic`, `international`, or `intraregional` | | `payment_method_type` | The payment method's type, such as `card` | | `payment_method` | The payment method's ID | | `payment_method_serialized` | The masked card number | | `payment_method_card_brand` | The card brand | | `payment_method_card_funding` | `credit`, `debit`, or `prepaid` | | `payment_method_card_issuer_name` | The card issuer's name | | `payment_method_card_issuer_country` | The card issuer's two-letter country code | | `pricing_segment_code` | The pricing segment a fee falls in, on `invoice` rows | | `customer_id` | Pay.com's customer ID (`cust_…`) | | `customer_reference_id` | Your ID for the customer | | `customer_email` | The customer's email address | | `related_transaction` | For a capture, the hold's ID. For a refund, the charge's ID. | ## Next steps [#next-steps] * [Settlements](/data/reconciliation/settlements): The settlement object and its breakdown in the API. * [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement): Check a settlement with four API calls. * [Adjustments](/data/reconciliation/adjustments): The kinds of adjustment a settlement can carry. # Transaction reconciliation report (/data/reporting/transaction-reconciliation-report) The transaction reconciliation report lists every transaction that cleared the day before the report date, with its amounts, fees, and net amount. It's the file to import into your ledger or ERP. File name: `__transaction_reconciliation.csv`. ## Which transactions it includes [#which-transactions-it-includes] The report has one row for each charge, capture, hold, refund, and payout that cleared on the previous day, in UTC. Rows are sorted by `created`, oldest first. * Approved and declined transactions are both included. A declined transaction appears when it carried fees, or when it was an attempt in a payment session or an attempt that Pay.com retried. * Cancellations aren't included. * Chargebacks and representments are in the [disputes reports](/data/reporting/disputes-reports), not in this file. To match a row to your records, use `reference`, your own ID for the transaction, and `customer_reference_id`, your own ID for the customer. `id` is Pay.com's ID. ## Columns [#columns] The report has 32 columns by default, in this order. `id`, `merchant_id`, and `status` always come first. Columns that Pay.com adds for you follow `related_transaction` (see [Customize reports](/data/reporting/customize-reports)). | Column | Description | | :----------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | The transaction's ID: `chrg_…` for a charge, `hld_…` for a hold, `rfnd_…` for a refund, `po_…` for a payout, `psatt_…` for a declined attempt in a payment session, or `rtratt_…` for an attempt that Pay.com retried | | `merchant_id` | Your merchant ID (`mrchnt_…`) | | `status` | `succeeded` or `failed`. A charge can also be `succeeded_partially`, approved for less than the amount requested, or `awaiting_final_confirmation`, approved and waiting for the processor's final confirmation. | | `merchant` | Your merchant ID, the same as `merchant_id` | | `merchant_reference` | Your merchant account's reference | | `resource` | The object type: `charge`, `attempt`, `hold`, `refund`, `payout`, or `retried_attempt` | | `payment_session` | The payment session's ID (`ps_…`), for a transaction made in a payment session | | `created` | When the transaction was created. It can fall on another day than the clearing day. | | `reference` | Your reference on the transaction | | `failure_code` | Pay.com's [failure code](/api-reference/get-started/errors#error-codes), for a failed transaction | | `currency` | The transaction's currency, as a lowercase ISO 4217 code | | `amount` | The transaction amount. Negative for refunds and payouts. | | `settlement_currency` | Your settlement currency | | `settlement_amount` | The amount in your settlement currency. `0` for holds. Negative for refunds and payouts. | | `exchange_rate` | The rate Pay.com used to convert `amount` to your settlement currency, when the two differ | | `net_amount` | The amount after fees, in your settlement currency, with up to 6 decimal places. Negative for payouts, and for failed transactions that carried fees. | | `fee_interchange` | The interchange fee, which goes to the card issuer. `0` on blended pricing. | | `fee_network` | The card network's fee. `0` on blended pricing. | | `fee_processing` | Pay.com's processing fee. On blended pricing, the whole fee. | | `metadata` | The transaction's metadata, as a JSON object of strings | | `jurisdiction` | `domestic`, `international`, or `intraregional` | | `payment_method_type` | `card` for cards, Apple Pay, and Google Pay, or the payment method's own type, such as `paypal` | | `payment_method` | The payment method's ID, such as `pm_card_296645958265997316` | | `payment_method_serialized` | The masked card number: the first 6 digits, `******`, and the last 4 | | `payment_method_card_brand` | The card brand, such as `visa` or `mastercard` | | `payment_method_card_funding` | `credit`, `debit`, or `prepaid` | | `payment_method_card_issuer_name` | The card issuer's name | | `payment_method_card_issuer_country` | The card issuer's two-letter country code | | `customer_id` | Pay.com's customer ID (`cust_…`), when the transaction has your customer reference | | `customer_reference_id` | Your ID for the customer | | `customer_email` | The customer's email address | | `related_transaction` | For a capture, the hold's ID. For a refund, the charge's ID. | Fees are negative, in your settlement currency. See [Daily reports](/data/reporting/daily-reports#file-format) for the format all reports share. ## Example [#example] These rows show a card charge for €60.26 and a €20.00 refund of an earlier charge. Most card columns are left out here. ```csv id,merchant_id,status,resource,created,reference,currency,amount,settlement_currency,settlement_amount,net_amount,fee_interchange,fee_network,fee_processing,customer_reference_id,related_transaction chrg_688930130227113984,mrchnt_296645958265997325,succeeded,charge,2026-07-26T21:03:35.323Z,order_12345,eur,60.26,eur,60.26,59.36,-0.18,-0.12,-0.6,cust_ext_abc123, rfnd_688942261290938368,mrchnt_296645958265997325,succeeded,refund,2026-07-27T09:51:35.522Z,order_11872,eur,-20,eur,-20,-20.25,0,0,-0.25,cust_ext_abc123,chrg_687103676153594880 ``` ## The same data through the API [#the-same-data-through-the-api] [`GET /v1/reconciliation/transactions`](/api-reference/endpoints/reconciliation/list-reconciliation-transactions) returns cleared transactions with most of the same fields, up to 100 per page. Its amounts are integers in the minor unit, and it selects a day's transactions by a clearing date that can differ from the file's for some acquirers. See [Reconcile transactions](/data/reconciliation/reconcile-transactions). ## Next steps [#next-steps] * [Customize reports](/data/reporting/customize-reports): Add columns, or remove the ones you don't use. * [Settlement report](/data/reporting/settlement-report): Match the transactions to the settlement that paid them. * [Reconciliation](/data/reconciliation): How transactions clear and reach a settlement. # Reporting webhooks (/data/reporting/webhooks) Pay.com sends an event for each transaction that clears, each change to a dispute, each fraud warning, and each paid settlement. Each event carries its object in the same format as the API. To receive events, add a webhook endpoint and verify each event's signature, as described in [Webhooks](/developer-resources/webhooks). ## Events [#events] These events report money movement and the data behind your reports. | Event | Sent when | `data` | | :---------------------------------------- | :--------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `cashflow_transaction.created` | A transaction clears and Pay.com books its final fees | The [cash flow transaction](/data/reconciliation/balances-and-cashflow#cash-flow-transactions): the cleared amount, `fee`, `fee_breakdown`, `net_amount`, and the original charge, refund, or payout in `source` | | `dispute.new`, `dispute.won`, and 14 more | A dispute is opened or changes status | The dispute. See [Dispute events](/risk/disputes/events-and-testing). | | `fraud_warning.created` | An issuer's fraud report, a Visa TC40 or a Mastercard SAFE record, is matched to one of your charges | The [fraud warning](/risk/fraud-warnings) | | `settlement.paid` | Pay.com pays a settlement to your bank | The [settlement](/data/reconciliation/settlements) | | `reconciliation.update` | The day's clearing data is ready, before Pay.com generates your transaction reconciliation report | `date`, the clearing day | | `exchange_rates.update` | New exchange rates take effect | `valid_from` and `valid_until` | | `report.uploaded` | A report file is written to your SFTP folder | `filename` and `report_type` | Every acquirer and processor's data reaches you through these same events. `cashflow_transaction.created` and the dispute and fraud events carry Pay.com's objects, not the acquirer's own records. ## Subscribe to the events [#subscribe-to-the-events] Add any of these events except `report.uploaded` to a webhook endpoint with [`POST /v1/webhook_endpoints`](/api-reference/endpoints/webhookendpoints/create-webhook-endpoint) or in the Pay.com dashboard. To receive `report.uploaded`, add it in the dashboard, under **Developers** → **Webhooks**. ## Cleared transactions [#cleared-transactions] Pay.com sends `cashflow_transaction.created` once for each transaction that clears, after the acquirer's clearing data arrives and Pay.com books the transaction's final fees. Its `type` is `charge`, `refund` (a refund or a chargeback), `payout`, or `decline` (a declined payment attempt that carried fees). Amounts are integers in the minor unit of your settlement currency, for example `6026` for €60.26. ```json title="cashflow_transaction.created" { "id": "evt_688930130227114001", "resource": "event", "type": "cashflow_transaction.created", "created": "2026-03-17T02:03:35.323Z", "data": { "id": "cflw_tx_688930130227113984", "resource": "cashflow_transaction", "type": "charge", "amount": 6026, "currency": "eur", "source_amount": 7140, "source_currency": "usd", "exchange_rate": "1.1849340", "fee": -90, "fee_breakdown": [ { "type": "interchange", "identifier": "interchange", "amount": -18, "currency": "eur" }, { "type": "network", "identifier": "network", "amount": -12, "currency": "eur" }, { "type": "acquirer", "identifier": "charge", "amount": -60, "currency": "eur" } ], "net_amount": 5936, "net_amount_human_readable": "59.36", "available_on": "2026-03-20T00:00:00.000Z", "source": { "id": "chrg_688930130227113984", "url": "/v1/charges/chrg_688930130227113984" } } } ``` `net_amount` is what the transaction adds to your balance, or takes from it. `available_on` is the expected settlement date. See [Cash flow transactions](/data/reconciliation/balances-and-cashflow#cash-flow-transactions) for every field, and [Reconciliation](/data/reconciliation) for when transactions clear. ## Report files [#report-files] Pay.com sends `report.uploaded` for each file it writes to your SFTP folder, which is two a day for disputes. `report_type` is `transaction_reconciliation`, `settlement`, `disputes`, `fraud`, or `fx`. The file name holds the report date. ```json title="report.uploaded" { "id": "evt_701808188143438901", "resource": "event", "type": "report.uploaded", "created": "2026-07-28T04:12:09.518Z", "data": { "filename": "mrchnt_296645958265997325_20260728_transaction_reconciliation.csv", "report_type": "transaction_reconciliation" } } ``` Pay.com sends the event before it pushes the file to your S3 bucket or email. If you import from S3, start from the file's arrival in your bucket, not from the event. Settlement PDFs don't send the event. See [Receive report files](/data/reporting/delivery). ## Clearing data ready [#clearing-data-ready] Pay.com sends `reconciliation.update` once the day's clearing data from your acquirers and processors is in, before it generates your transaction reconciliation report. `date` is the clearing day. ```json title="reconciliation.update" { "id": "evt_701808188143438877", "resource": "event", "type": "reconciliation.update", "created": "2026-07-28T03:58:41.204Z", "data": { "date": "2026-07-27T00:00:00.000Z" } } ``` ## Next steps [#next-steps] * [Daily reports](/data/reporting/daily-reports): The files that summarize each day's events. * [Webhooks](/developer-resources/webhooks): Add an endpoint and verify signatures. * [Webhook events](/api-reference/webhooks/webhook-events): Every event Pay.com sends. # Attempts and retries (/data/transaction-data/attempts-and-retries) Pay.com can make more than one attempt for a payment, for example a fallback to another settlement account after a decline. A charge or hold lists the attempts before its final one in `retry_attempts`, each with its own result, network data, and settlement account. The charge's own fields describe the final attempt. ## Read the attempts on a charge [#read-the-attempts-on-a-charge] [`GET /v1/charges/{charge_id}`](/api-reference/endpoints/charges/get-charge) returns `retry_attempts`, oldest first. The array is empty when Pay.com made one attempt. Each attempt has these fields: | Field | Description | | :------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | The attempt's ID, such as `rtratt_685125114794084352_1_1`: `rtratt_`, the charge's digits, the payment attempt's number, and the retry's number | | `type` | Why Pay.com made another attempt after this one. See [Retry types](#retry-types). | | `created` | When the attempt was made | | `failure_code` and `failure_message` | Why the attempt failed | | `underlying_network_details` and `underlying_network_id` | The attempt's [network data](/data/transaction-data/network-data), such as its raw response code | | `underlying_processing_details` | Where the attempt was processed, including its own `settlement_account` | | `payment_method_options` | The options Pay.com applied to the attempt | Holds have `retry_attempts` too. The charges and holds in list responses have an empty `retry_attempts`, so retrieve each one by ID to read its attempts. ```json { "id": "chrg_685125114794084352", "resource": "charge", "status": "succeeded", "underlying_processing_details": { "settlement_account": "sa_296645958265997350" }, "retry_attempts": [ { "id": "rtratt_685125114794084352_1_1", "created": "2026-03-06T14:02:38.112Z", "type": "fallback", "failure_code": "do_not_honour", "underlying_network_details": { "network": "visa", "visa": { "raw_response_code": "05" } }, "underlying_processing_details": { "settlement_account": "sa_296645958265997349" } } ] } ``` A declined charge's `400` error response also carries `retry_attempts`, so you can read why each attempt failed without another call. ## Retry types [#retry-types] `type` tells you why Pay.com made another attempt. | `type` | Why Pay.com retried | Controlled by | | :----------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | | `fallback` | The attempt was declined or failed, and a routing rule's fallback sent the payment to another settlement account | Your [routing rules](/payments/routing/fallbacks-and-retries) | | `soft_decline` | The issuer asked for authentication, and Pay.com retried with 3D Secure | `payment_method_options.card.request_sca_exemption.soft_decline_loop` | | `network_token_fallback` | The attempt with a network token was declined, and Pay.com retried with the card number | `payment_method_options.card.network_token.authorization.full_pan_fallback` | | `abu` | The account billing updater updated the card, and Pay.com retried with the new details | `payment_method_options.card.account_billing_updater` | | `decline_recovery` | The last fallback was declined, and decline recovery retried the payment | An account setting, which Pay.com turns on | Fallback lists, soft decline lists, network token fallback lists, and account billing updater lists all match Pay.com's [failure codes](/data/transaction-data/failure-codes), not the network's raw codes. See [Fallbacks and retries](/payments/routing/fallbacks-and-retries) for how each one works. ## Follow retries as they happen [#follow-retries-as-they-happen] Pay.com sends `retried_attempt.created` before each retry, with the attempt that's being retried. See [Fallbacks and retries](/payments/routing/fallbacks-and-retries). ## Attempts in a payment session [#attempts-in-a-payment-session] A payment session can have several payment attempts, one for each time the customer tried to pay, and each payment attempt has its own `retry_attempts`. List them with [`GET /v1/sessions/payment/{session}/attempts`](/api-reference/endpoints/paymentattempts/get-payment-session-attempts), or [retrieve one](/api-reference/endpoints/paymentattempts/retrieve-attempt-of-a-payment-session) by its `psatt_` ID. A payment attempt's `amount` is the amount requested. To find the charge or hold a session created, read the session's `charge` or `hold`. ## Next steps [#next-steps] * [Fallbacks and retries](/payments/routing/fallbacks-and-retries): Set up fallbacks, and the network's limits on retries. * [Failure codes](/data/transaction-data/failure-codes): Read why each attempt failed. * [Where a transaction was processed](/data/transaction-data/processing-details): The settlement account and route of each attempt. # Failure codes (/data/transaction-data/failure-codes) A declined or failed transaction carries up to three codes for the same decline: Pay.com's failure code, the response code from the network or acquirer, and the processor's own code. Build your logic on Pay.com's code, which is the same for every acquirer. Use the other two to troubleshoot with your acquirer or processor. ## The codes [#the-codes] Each code answers a different question. | Code | Field | What it is | | :------------------- | :----------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------- | | Failure code | `failure_code`, and `decline_code` in the `400` error | Pay.com's code for the reason, such as `insufficient_funds`. See [Error codes](/api-reference/get-started/errors#error-codes). | | Raw response code | `underlying_network_details..raw_response_code` | The response code from the network or acquirer, such as `51`. See [Raw response codes](#raw-response-codes). | | Processor code | `underlying_processing_details.failure_code` and `failure_message` | The processor's own decline code and message. See [Processor codes](#processor-codes). | | Merchant advice code | `underlying_network_details..advice_code` | Whether and when to retry. See [Merchant advice codes](/data/transaction-data/network-data#merchant-advice-codes). | A declined Mastercard charge, retrieved after the decline: ```json { "id": "chrg_685125114794084352", "resource": "charge", "status": "failed", "failure_code": "insufficient_funds", "failure_message": "Insufficient Funds", "underlying_network_details": { "network": "mastercard", "mastercard": { "raw_response_code": "51", "advice_code": "24" } }, "underlying_processing_details": { "failure_code": "51", "failure_message": "Insufficient funds" } } ``` ## How Pay.com sets the failure code [#how-paycom-sets-the-failure-code] Pay.com maps the acquirer's response code to a failure code, by card network first, then by payment method. A code with no mapping becomes `generic_decline`. `failure_code` is set only for a declined, blocked, or failed transaction, and is `null` otherwise. Some failure codes are Pay.com's own decisions, not the issuer's, for example `cancelled_by_risk` when a risk rule blocks the payment, or `authentication_failure` when 3D Secure fails. These have no raw response code. `failure_message` describes the reason. Log it, and show customers your own message for each failure code. See [Handle declines](/developer-resources/handle-errors#handle-declines). ## Where to find the codes [#where-to-find-the-codes] The codes are on the transaction wherever you read it: * **The `400` error:** a declined charge, hold, capture, refund, or payout returns `decline_code`, which is the failure code, and `message`, which is the failure message. The error also has `underlying_network_details`, `underlying_processing_details`, and `retry_attempts`. See [Declines](/api-reference/get-started/errors#declines). * **The object:** retrieve the charge, hold, refund, or payout by ID. * **Events:** `charge.failed`, `hold.failed`, `refund.failed`, `payout.failed`, and `payment_attempt.failed` carry the object with its codes. * **Retry attempts:** each attempt in `retry_attempts` has its own failure code and raw codes. See [Attempts and retries](/data/transaction-data/attempts-and-retries). * **Reports:** the [transaction reconciliation report](/data/reporting/transaction-reconciliation-report) and [`GET /v1/reconciliation/transactions`](/data/reconciliation/reconcile-transactions) have `failure_code`. ## Raw response codes [#raw-response-codes] `raw_response_code` is the response code from the network or the acquirer, for example `51` (insufficient funds) or `05` (do not honor) in the ISO 8583 codes that most card networks use. It's set on approvals too, usually as `00`. It isn't always a network code. Some acquirers return their own codes in this field. Pay.com leaves it out when Pay.com declined the payment itself, for example after a risk rule or a timeout. Use the raw code with your acquirer, and to apply the networks' retry rules. Visa, for example, forbids retries after some response codes and limits retries after the others. See [Card network retry limits](/payments/routing/fallbacks-and-retries#card-network-retry-limits). ## Processor codes [#processor-codes] `underlying_processing_details.failure_code` and `failure_message` are the processor's own code and message for the decline, as the processor sent them. They're set when the processor returns a code, and only when processor details are enabled on your account. Contact your Pay.com account team to enable them. ## Codes in routing and retries [#codes-in-routing-and-retries] Fallback rules, the soft decline loop, network token fallback, and the account billing updater all match Pay.com's failure codes, not raw codes. Only codes marked **Fallbackable** in the [error codes table](/api-reference/get-started/errors#error-codes) can trigger a fallback. See [Fallbacks and retries](/payments/routing/fallbacks-and-retries). ## Next steps [#next-steps] * [Error codes](/api-reference/get-started/errors#error-codes): Every failure code, and which ones can trigger a fallback. * [Handle errors](/developer-resources/handle-errors): Branch on the status, type, and code of an error. * [Decline codes](/payments/concepts/declines): The most common decline codes, and what to do for each. # Read transaction data (/data/transaction-data) Every charge, hold, refund, and payout carries the details of how it was processed: the settlement account and processor that handled it, the attempts Pay.com made, the card network's response, and the codes behind a decline. The same fields are in API responses and in webhook events. ## Where each detail is [#where-each-detail-is] These fields answer the common questions about a transaction. | Question | Field | Page | | :---------------------------------------------------------- | :-------------------------------------------- | :----------------------------------------------------------------------------- | | Which settlement account and processor handled it, and why? | `underlying_processing_details` | [Where a transaction was processed](/data/transaction-data/processing-details) | | Did Pay.com retry it, and why? | `retry_attempts` | [Attempts and retries](/data/transaction-data/attempts-and-retries) | | What are its ARN, RRN, PAR, and authorization code? | `underlying_network_details` | [Network data](/data/transaction-data/network-data) | | What's its network transaction ID? | `underlying_network_id` | [Network data](/data/transaction-data/network-data#network-transaction-id) | | Did it pass the AVS and CVV checks? | `payment_method_details.card.security_checks` | [Network data](/data/transaction-data/network-data#avs-and-cvv-results) | | Why was it declined? | `failure_code`, and the raw codes | [Failure codes](/data/transaction-data/failure-codes) | | What did it cost, and when is it paid out? | The cash flow transaction | [Reconciliation](/data/reconciliation) | ## When the fields are set [#when-the-fields-are-set] A transaction's data arrives in stages, and a field can change after the transaction is created. | Stage | What's set | | :------------ | :-------------------------------------------------------------------------------------------------------------------------------- | | Authorization | Status, failure codes, the settlement account and route, retry attempts, the network's response codes, and the authorization code | | Clearing | The ARN, which can replace an earlier reference. The cash flow transaction, with the final fees. | | Later | Refunds, disputes, fraud warnings, and the payout to your bank, each with its own events | When the ARN arrives or changes at clearing, Pay.com sends `charge.updated` for a charge or `refund.updated` for a refund. See [Reconciliation](/data/reconciliation#events-at-clearing). ## Read the data from events [#read-the-data-from-events] Every event carries its object as it stands when Pay.com sends the event, in the same format as the API. To read the latest state, retrieve the object, for example with [`GET /v1/charges/{charge_id}`](/api-reference/endpoints/charges/get-charge). List endpoints return shorter objects. A charge in [`GET /v1/charges`](/api-reference/endpoints/charges/get-charges) has no refunds and no retry attempts. Retrieve the charge by ID for its full details. See [Bulk queries](/data/bulk-queries). ## Availability [#availability] Card networks, acquirers, and processors don't all return the same data, so a field can be empty for one transaction and set for another. The authorization code and the network's response code come from most card acquirers. The PAR, the merchant advice code, and Mastercard's transaction link ID come from fewer. Read each field as optional. `underlying_processing_details` is present only when processor details are enabled on your account. Contact your Pay.com account team to enable them. ## Next steps [#next-steps] * [Where a transaction was processed](/data/transaction-data/processing-details): The settlement account, processor, and route. * [Network data](/data/transaction-data/network-data): ARN, RRN, PAR, and the other network fields. * [Failure codes](/data/transaction-data/failure-codes): Pay.com's codes, the network's codes, and the processor's. # Network data (/data/transaction-data/network-data) The card network's data for a transaction is in `underlying_network_details`, keyed by network, and in `underlying_network_id`. Acquirers return different subsets of it, so read every field as optional. See [Availability](#availability). ## Read the network details [#read-the-network-details] `underlying_network_details.network` names the network, and the object under that key holds its data. The keys are `visa`, `mastercard`, `amex`, `discover`, `jcb`, `visa_direct`, and `mastercard_send`. ```json { "id": "chrg_685125114794084352", "resource": "charge", "status": "succeeded", "underlying_network_id": "385127914835097", "underlying_network_details": { "network": "visa", "visa": { "auth_code": "831000", "raw_response_code": "00", "arn": "24011346075000012345678", "payment_account_reference": "V0010013826071948572061837495", "eci": "05" } }, "payment_method_details": { "type": "card", "card": { "brand": "visa", "last4": "4242", "security_checks": { "address_line1_check": "pass", "address_postal_code_check": "pass", "cvc_check": "pass" } } } } ``` `underlying_network_details` is `null` when the acquirer returned none of these fields. Charges, holds, refunds, payouts, payment attempts, and retry attempts all carry it, and the `400` response for a declined payment includes it too. | Field | What it is | Set | | :-------------------------- | :------------------------------------------------------------------------------------------------------------------------------ | :--------------- | | `auth_code` | The authorization code the issuer returned | At authorization | | `arn` | The acquirer reference number. See [ARN](#arn). | At clearing | | `rrn` | The retrieval reference number. See [RRN](#rrn). | At authorization | | `raw_response_code` | The response code behind the decline or approval. See [Failure codes](/data/transaction-data/failure-codes#raw-response-codes). | At authorization | | `advice_code` | The merchant advice code, which tells you whether and when to retry. See [Merchant advice codes](#merchant-advice-codes). | At authorization | | `payment_account_reference` | The PAR. See [PAR](#par). | At authorization | | `eci` | The electronic commerce indicator the network returned with the authorization | At authorization | | `aci` and `ucaf` | Visa's authorization characteristics indicator and Mastercard's UCAF indicator | At authorization | | `transaction_link_id` | Mastercard's transaction link ID, which links the payments of one agreement | At authorization | | `ani` | The account name inquiry results. See [Account name inquiry](/risk/account-name-inquiry#read-the-result). | At authorization | ## ARN [#arn] The acquirer reference number (ARN) is the reference the acquirer gives a transaction when it submits it to the network at clearing. The issuer can use it to trace a payment or refund, so give it to a customer who asks their bank where a refund is. Until a transaction clears, `arn` can hold another reference from the acquirer, such as an RRN or the acquirer's own transaction ID, or nothing. When the clearing record brings the ARN, it replaces that value, and Pay.com sends an event with the updated object: * `charge.updated` for a charge or a capture * `refund.updated` for a refund ```json title="charge.updated" { "id": "evt_689214575123456789", "resource": "event", "type": "charge.updated", "created": "2026-03-07T03:14:22.180Z", "data": { "id": "chrg_685125114794084352", "resource": "charge", "status": "succeeded", "underlying_network_details": { "network": "visa", "visa": { "auth_code": "831000", "arn": "24011346075000012345678" } } } } ``` `charge.updated` also fires when Pay.com adds tax details to a charge, so compare the ARN with the one you stored before you act on the event. See [Reconciliation](/data/reconciliation#events-at-clearing) for the other events at clearing. To find a charge by its ARN, filter [`GET /v1/charges`](/api-reference/endpoints/charges/get-charges) by `underlying_network_details.arn`. The filter matches the whole value, so before clearing it matches the earlier reference. A dispute's `arn` comes from the dispute record, or from the charge when the record has none. ## RRN [#rrn] The retrieval reference number (RRN) is the 12-character reference for the authorization. Your acquirer or the issuer can use it to find the authorization in their systems. Fewer acquirers return it than the authorization code. ## PAR [#par] The payment account reference (PAR) identifies the card account behind a payment. It stays the same when the card is reissued with a new number, and for each network token of the account. Use it to recognize a returning customer, or to link payments made with a card and with its tokens. `payment_account_reference` is set at authorization when the acquirer returns it. A network token also carries the PAR, in [`GET /v1/payment_methods/{payment_method_id}/network_token`](/payments/network-tokens/retrieve-a-network-token). ## Merchant advice codes [#merchant-advice-codes] A merchant advice code tells you whether to retry a declined payment, and when. Mastercard sends advice codes with approvals and declines, for example `03` (do not try again) or `24` (retry after 1 hour). See [Mastercard merchant advice codes](/api-reference/get-started/errors/mastercard-advice-codes) for every code. Visa doesn't use merchant advice codes. Its response codes fall into categories that tell you whether a retry can succeed. See [Card network retry limits](/payments/routing/fallbacks-and-retries#card-network-retry-limits). ## Network transaction ID [#network-transaction-id] `underlying_network_id` is the ID the card network gives the authorization, such as Visa's transaction identifier or Mastercard's trace ID. It's on charges, holds, refunds, payment attempts, retry attempts, and payment methods, and not on payouts. The network transaction ID links later merchant-initiated payments to the payment where the customer agreed to them. When a payment saves a card for off-session use, Pay.com stores the ID on the payment method and passes it to the acquirer with later merchant-initiated payments. See [Recurring charges](/payments/saved-cards/recurring-charges). For some acquirers, the clearing record carries a network transaction ID that replaces the one from the authorization. Pay.com sends no event for this change alone, so retrieve the object to read the current value. ## AVS and CVV results [#avs-and-cvv-results] `payment_method_details.card.security_checks` holds the results of the address verification service (AVS) and the CVV check. | Field | Check | | :-------------------------- | :----------------- | | `address_line1_check` | The street address | | `address_postal_code_check` | The postal code | | `cvc_check` | The CVV | Each result is one of these values: | Value | Meaning | | :------------ | :------------------------------------------------------- | | `pass` | The value matches the issuer's records | | `fail` | The value doesn't match | | `unavailable` | The issuer or network couldn't check it | | `unchecked` | No check ran, for example because the request had no CVV | Pay.com maps each acquirer's AVS and CVV codes to these values, and doesn't return the raw codes. `cvc_check` is `unchecked` when the acquirer returned no result, and the address checks are `null`. To decline payments by these results, set `card.security_checks` in your [payment method options](/payments/payment-method-options#risk-options). ## 3D Secure results [#3d-secure-results] `payment_method_details.card.three_d_secure` holds the result of 3D Secure: `result`, `authentication_flow`, the 3D Secure `eci`, and `liability_shift`. `liability_shift` comes from the ECI. See [3D Secure](/payments/3d-secure). ## Payout network data [#payout-network-data] For a card payout, `underlying_network_details` has the same fields as a charge. For a US bank account payout, `network` is `ach`, `rtp`, or `fednow`, and `ach.trace_number` is the ACH trace number. See [Track payouts](/payouts/track-payouts). ## Availability [#availability] Each acquirer returns its own subset of these fields. The table shows how widely each one is returned. | Field | Returned by | | :-------------------------------------------------------- | :----------------------------------------------------------------------------------- | | `auth_code`, `raw_response_code`, `underlying_network_id` | Most card acquirers | | AVS and CVV results | Most card acquirers. Some return the CVV result and only part of the address result. | | `arn` | The acquirers whose clearing records include the ARN | | `eci` | Many acquirers | | `advice_code`, `payment_account_reference` | Some acquirers | | `transaction_link_id` | Some acquirers, for Mastercard payments | | `rrn` | Few acquirers | | `aci` and `ucaf` | Few acquirers | Card payments that Pay.com acquires itself, where `processor` is `pay_com`, return the authorization code, the response code, the network transaction ID, and the ECI. They also return the merchant advice code and the PAR when the network sends them, and the ARN once they clear. ## Next steps [#next-steps] * [Failure codes](/data/transaction-data/failure-codes): Pay.com's codes, the network's codes, and the processor's. * [Reconciliation](/data/reconciliation): What changes when a transaction clears. * [Where a transaction was processed](/data/transaction-data/processing-details): The processor and settlement account behind these fields. # Where a transaction was processed (/data/transaction-data/processing-details) `underlying_processing_details` on a charge, hold, refund, or payout tells you where Pay.com processed it: the settlement account, the processor, the processor's own ID for the transaction, and how Pay.com chose the route. It's present when processor details are enabled on your account. Contact your Pay.com account team to enable them. ## Fields [#fields] These fields describe where the transaction went. | Field | Description | | :----------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `settlement_account` | The settlement account (`sa_…`) of the final attempt. After a fallback, it's the fallback's account. | | `settlement_account_details` | The account's `name`, its `currency`, and the legal entity that owns it, in `entity` and `entity_details`. `currency` is absent for an account where the processor settles to you directly. | | `processor` | The processor that handled the transaction, or `pay_com` when Pay.com acquires the payment itself | | `transaction_id` | The processor's ID for the transaction. For some payments that Pay.com acquires itself, it's the digits of Pay.com's own ID. | | `routing_details` | How Pay.com picked the first route. See [Route](#route). | | `failure_code` and `failure_message` | The processor's own decline code and message. See [Failure codes](/data/transaction-data/failure-codes). | | `return_code` | For a returned payout, the bank's return reason, such as the ACH code `R01` | A declined attempt that never reached a processor, such as one that failed 3D Secure, has no settlement account. ```json { "id": "chrg_685125114794084352", "resource": "charge", "status": "succeeded", "underlying_processing_details": { "processor": "pay_com", "transaction_id": "685125114794084352", "settlement_account": "sa_296645958265997349", "settlement_account_details": { "name": "Main Settlement Account", "currency": "usd", "entity": "ent_296645958265997359", "entity_details": { "legal_name": "ACME Corp", "country": "US" } }, "routing_details": { "selected_methodology": "rule_engine", "rule_engine": { "rule_id": "rl_772846036363248640" } } } } ``` ## Route [#route] `routing_details` records the first routing decision. `selected_methodology` is how Pay.com picked the settlement account: | `selected_methodology` | Where the account came from | | :-------------------------- | :----------------------------------------------- | | `merchant_provided` | The `settlement_account` you sent in the request | | `rule_engine` | A routing rule, named in `rule_engine.rule_id` | | `static_settlement_account` | Your default settlement account | When Smart Router picked the account, `routing_details` also has `smart_router` (`true`), `smart_router_configuration_id`, and `smart_router_configuration_name`. See [How routing works](/payments/routing/how-routing-works). ## Settlement accounts without processor details [#settlement-accounts-without-processor-details] Payment sessions, cash flow transactions, disputes, and fraud warnings have their own top-level `settlement_account` and `settlement_account_details`, whether or not processor details are enabled on your account. ## Find the transaction at the processor [#find-the-transaction-at-the-processor] Pay.com sends each attempt to the processor with its own reference: the digits of the Pay.com ID, `aid`, and the attempt number, such as `685125114794084352aid1`. Use it to find a transaction in the processor's own reports or webhooks. See [Payments routed to another acquirer](/payments/routing/routed-payments). ## Next steps [#next-steps] * [Attempts and retries](/data/transaction-data/attempts-and-retries): The attempts before the final one, each with its own settlement account. * [How routing works](/payments/routing/how-routing-works): How Pay.com picks a settlement account. * [Settlement account routing](/payments/routing/settlement-accounts): Choose the settlement account yourself. # Adjustments (/data/reconciliation/adjustments) An adjustment is a credit or deduction applied to a settlement that isn't a transaction of its own, such as a monthly service fee or an early reserve release. Negative adjustments reduce the settlement amount, and positive adjustments add to it. The sum of a settlement's adjustments appears in the `general_adjustments` field of its [breakdown](/data/reconciliation/settlements#what-a-settlement-contains). The fee for the transfer to your bank isn't an adjustment. It's in the breakdown's `service_fees`. ## Adjustment types [#adjustment-types] The `identifier` field classifies each adjustment. Common values include: | `identifier` | Description | | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `monthly_service_fee` | Monthly service fee. | | `minimum_monthly_processing_fee` | Minimum monthly processing fee in your contract. | | `rdr` | Disputes resolved through Rapid Dispute Resolution (`quantity` is the number of cases). | | `arbitration_lost` | Dispute that went to arbitration and was lost. | | `termination_fee` | Contract termination fee applied to the final settlement when closing an account. | | `interchange_fees_adjustment`, `network_fees_adjustment` | Correction to previously charged interchange or network fees. | | `early_reserve_return` | Reserve funds released ahead of schedule. | | `customer_payout_return` | Payout to a customer returned by their bank. | | `balance_transfer_between_related_entities` | Balance transfer between related accounts (negative on the source account and positive on the destination account). | | `scheme_clearing_rejection` | The card network rejected a cleared transaction, so its amount and fees are reversed. `description` names the charge. | | `payout_reversal_` | A bank transfer payout to a customer was declined after it was taken from a settlement, so its amount is credited back. The fee is kept. | | The charge's digits, such as `688930130227113984` | A chargeback booked as an adjustment, such as a second chargeback without a representment before it. `description` is `Chargeback adjustment on payment: chrg_…`. | Other identifiers can appear. Check each adjustment's `description` field for details. ## When adjustments are applied [#when-adjustments-are-applied] Pay.com applies each adjustment to the next settlement on its settlement account in the matching currency. If a settlement's net total is zero or negative, Pay.com skips that payout and carries the adjustments forward to the next settlement. An adjustment gets its `settlement_id` when the settlement it's on is paid. ## List a settlement's adjustments [#list-a-settlements-adjustments] Call [`GET /v1/adjustments`](/api-reference/endpoints/adjustments/list-adjustments) with the settlement's ID to list its adjustments. Pass `settlement_id` (required) along with optional `page` and `limit` (`1` to `100`, default `10`). Only adjustments on a paid settlement are listed. To retrieve a single adjustment by ID, call [`GET /v1/adjustments/{adjustment_id}`](/api-reference/endpoints/adjustments/get-adjustment-by-id). ```bash curl "https://api.sandbox.pay.com/v1/adjustments?settlement_id=stlmnt_690127572775747584" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "resource": "adjustments", "data": [ { "id": "adj_690127572775747601", "resource": "adjustment", "settlement_id": "stlmnt_690127572775747584", "bank_transfer_reference": null, "currency": "EUR", "description": "Monthly service fee", "identifier": "monthly_service_fee", "quantity": 1, "amount": "-25.00", "total": "-25.00", "test_mode": true } ], "last_page": true, "page": 1, "total_pages": 1, "total_records": 1 } ``` | Field | Description | | ------------- | --------------------------------------------------------------------------------- | | `identifier` | Adjustment type from the table above. | | `description` | Human-readable explanation of the adjustment. | | `quantity` | Number of units charged, such as dispute cases. `0` when it isn't set. | | `amount` | Unit amount. | | `total` | `quantity` × `amount`, representing the net adjustment applied to the settlement. | | `currency` | Settlement currency as an ISO 4217 code. | `amount` and `total` are returned as decimal strings in the major currency unit (such as `"-25.00"`), or `0` when unset. To compare adjustments against a settlement breakdown, sum their totals and convert to minor units. For example, `-25.00` EUR equals `-2500` in `general_adjustments`. ## Where else adjustments appear [#where-else-adjustments-appear] Adjustments appear in settlement breakdowns and merchant balances, but not in cash flow transactions. * **Settlement breakdown:** `general_adjustments` holds the sum of the settlement's adjustments in minor units. Any VAT applied to an adjustment is included in `vat`. * **Balances:** [`GET /v1/cashflow/balances`](/api-reference/endpoints/cashflow/get-merchant-balance) returns one row per adjustment type in the period, with `identifier` converted from underscores to hyphens (for example, `monthly-service-fee`). Adjustments without an identifier are in `general-adjustments`. See [Merchant balance](/data/reconciliation/balances-and-cashflow#merchant-balance). * **Cash flow transactions:** Exclude adjustments and list only charges, refunds, payouts, and declines. * **Settlement report:** Each adjustment is a row with `category` `adjustments`. See [Settlement report](/data/reporting/settlement-report). ## Next steps [#next-steps] * [Settlements](/data/reconciliation/settlements): Review what a settlement contains, field by field. * [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement): Check a settlement against its breakdown and adjustments. * [Balances and cash flow](/data/reconciliation/balances-and-cashflow): Track your running balance. # Balances and cash flow (/data/reconciliation/balances-and-cashflow) Your merchant balance is a running total of all funds received, fees charged, and settlements paid to you on a settlement account. Cash flow transactions are the entries for your charges, refunds, and payouts to customers, one for each transaction that clears. Together they give you a ledger of your account activity between settlements. ## Merchant balance [#merchant-balance] The [`GET /v1/cashflow/balances`](/api-reference/endpoints/cashflow/get-merchant-balance) endpoint returns the net position for one settlement account, and so one currency. If you process transactions in more than one currency, you have a separate settlement account per currency, each with its own balance. Without a date window, the balance covers all activity up to the end of today (UTC). See [Balance for a date or a date range](#balance-for-a-date-or-a-date-range). Balances are computed from cleared transactions. The balance isn't available for every settlement account. For an account where it isn't, the endpoint returns `403`, or `400` for an account your acquirer settles to you directly. All monetary amounts are integers in the minor unit (the smallest unit) of the settlement currency, for example `494945025` for €4,949,450.25. | Field | Description | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `currency` | The settlement currency for this account | | `gross_amount` | Total value of all transaction amounts before fees. This is the sum of every type's `gross_amount`, refunds and chargebacks included | | `net_amount` | Balance remaining after all deductions: fees, refunds, chargebacks, taxes, and settlements already paid out. A negative value means more has been paid out or deducted than currently sits unsettled in the account | | `processing_fees` | Aggregated Pay.com processing fees deducted from the gross, matching the same category in [settlements](/data/reconciliation/settlements) | | `interchange_fees` | Aggregated card-issuer fees deducted from the gross | | `network_fees` | Aggregated card-network fees deducted from the gross | | `count` | Total number of events included in the balance calculation | ### Balance breakdown [#balance-breakdown] The `balance_breakdown` array breaks the net position down by transaction type. Each entry has a `type`, a `count`, a `gross_amount`, a `net_amount`, and the fee fields applicable to that type. An entry's `type` is one of these: | Type | What it represents | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `charges` | Successful card charges, the primary source of incoming funds | | `refunds` | Customer-initiated returns, which reduce the balance | | `chargebacks` | Disputed transactions reversed by the card network | | `representments` | Chargeback disputes won on your behalf, which restore funds | | `declines` | Declined transactions, which may still incur `processing_fees` | | `payouts` | Payouts to your customers, which reduce the balance | | `monthly-service-fee`, … | One row for each kind of [adjustment](/data/reconciliation/adjustments) in the period, typed by its `identifier` in kebab case. An adjustment without an identifier is in `general-adjustments`. | | `service-fees` | The fees for the transfers to your bank | | `top-ups` | Top-ups to your balance | | `rolling-reserves` | Funds withheld as risk collateral | | `released-reserves` | Previously withheld reserves returned to your balance | | `applicable-taxes` | VAT applied to the fees in each settlement | | `settlements` | Completed settlements sent to your bank, which reduce the balance | The `settlements` entry shows a large negative `net_amount` representing the total already paid out to your bank. This is why the top-level `net_amount` can be negative even when your business is profitable. It reflects the unsettled balance after all settlements, not your cumulative revenue. [Retrieve your balance](#retrieve-your-balance) shows a response with every type. ## Retrieve your balance [#retrieve-your-balance] You need a Pay.com API key with reporting access and your settlement account ID (prefix `sa_`). The key needs **Read** on Cash flow, and on Settlements to list your settlements. See [Permissions](/developer-resources/authentication/scoped-api-keys#permissions). ### Find your settlement account ID [#find-your-settlement-account-id] Pay.com assigns your settlement account IDs during onboarding. Your settlement account ID (`sa_...`) is visible in the **Settings** → **Settlement accounts** section of your Pay.com dashboard. You can also find it in the `settlement_account` field of any cash flow transaction, in a charge's `underlying_processing_details.settlement_account` when processor details are enabled on your account, or, if you have completed settlements, list them with [`GET /v1/settlements`](/api-reference/endpoints/settlements/list-settlements) and read the `settlement_account` field from any result: ```bash curl "https://api.sandbox.pay.com/v1/settlements?limit=1" \ -u ':sk-pay-com-sandbox-…' ``` The value looks like `sa_473768761812321280`. Use it as the `settlement_account` parameter in the next step. ### Request the balance [#request-the-balance] Pass your settlement account ID in the required `settlement_account` query parameter of [`GET /v1/cashflow/balances`](/api-reference/endpoints/cashflow/get-merchant-balance). ```bash curl "https://api.sandbox.pay.com/v1/cashflow/balances?settlement_account=sa_473768761812321280" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "resource": "balance", "currency": "eur", "net_amount": -652666, "gross_amount": 494945025, "processing_fees": -5316771, "interchange_fees": -5517766, "network_fees": -7715715, "count": 35163, "balance_breakdown": [ { "type": "chargebacks", "count": 51, "gross_amount": -3986624, "net_amount": -4057124, "network_fees": 0, "interchange_fees": 3586, "processing_fees": -70500 }, { "type": "charges", "count": 19325, "gross_amount": 501762446, "net_amount": 483477146, "network_fees": -7681819, "interchange_fees": -5499808, "processing_fees": -5103673 }, { "type": "refunds", "count": 241, "gross_amount": -6131243, "net_amount": -6191650, "network_fees": -33897, "interchange_fees": 3689, "processing_fees": -26510 }, { "type": "representments", "count": 43, "gross_amount": 3300446, "net_amount": 3275213, "network_fees": 0, "interchange_fees": -25233, "processing_fees": 0 }, { "type": "declines", "count": 13414, "gross_amount": 0, "net_amount": -116088, "network_fees": 0, "interchange_fees": 0, "processing_fees": -116088 }, { "type": "monthly-service-fee", "count": 13, "gross_amount": 0, "net_amount": 3626555, "processing_fees": 0 }, { "type": "rolling-reserves", "count": 476, "gross_amount": 0, "net_amount": -35611088, "processing_fees": 0 }, { "type": "released-reserves", "count": 337, "gross_amount": 0, "net_amount": 26066888, "processing_fees": 0 }, { "type": "service-fees", "count": 421, "gross_amount": 0, "net_amount": -422000, "processing_fees": 0 }, { "type": "applicable-taxes", "count": 421, "gross_amount": 0, "net_amount": -3792004, "processing_fees": 0 }, { "type": "settlements", "count": 421, "gross_amount": 0, "net_amount": -466908515, "processing_fees": 0 } ] } ``` The fields are described under [Merchant balance](#merchant-balance) and [Balance breakdown](#balance-breakdown). ### Balance for a date or a date range [#balance-for-a-date-or-a-date-range] Pass `date_to` to get the cumulative balance up to that moment. Without it, the endpoint covers everything up to the end of today (UTC). ```bash curl "https://api.sandbox.pay.com/v1/cashflow/balances?settlement_account=sa_473768761812321280&date_to=2026-03-17T23:59:59Z" \ -u ':sk-pay-com-sandbox-…' ``` Pass both `date_from` and `date_to` to get the balance movement within a range instead of a cumulative snapshot. To see the individual events behind it, use [`GET /v1/cashflow/transactions`](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk) with the `created.greater_than_or_equals` and `created.less_than_or_equals` parameters. ## Cash flow transactions [#cash-flow-transactions] A cash flow transaction records one cleared charge, refund, or payout to a customer, and what it adds to or takes from your balance. It appears when the transaction clears, and Pay.com sends the `cashflow_transaction.created` [webhook event](/data/reporting/webhooks). Its ID has the transaction's digits, such as `cflw_tx_690017293823913984` for `chrg_690017293823913984`, and the charge, refund, or payout links to it in `cashflow_transaction`. List them with [`GET /v1/cashflow/transactions`](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk), or retrieve one with [`GET /v1/cashflow/transactions/{id}`](/api-reference/endpoints/cashflow/get-cashflow-transaction). Chargebacks, adjustments, reserves, the transfer fee, and VAT have no cash flow transactions. They're in the balance breakdown and the settlement breakdown. **`type`** is `charge`, `refund`, `payout` (a payout to a customer), or `decline` (a declined transaction that carried fees, such as a decline fee). **`created`** is when the transaction itself was created, not when it cleared. A list filtered by `created` can gain entries later, as older transactions clear. **`amount`** is the transaction's value in the settlement currency, in the smallest currency unit. It's positive for refunds and payouts too, and `0` for a decline. **`net_amount`** is the amount credited or debited to your balance after fees. For a charge, `net_amount = amount − |fee|`. For a refund or a payout, it's negative. For a decline, it's the negative decline fee. The `net_amount_human_readable` field provides the decimal equivalent as a string. **`fee`** is the total fee for the transaction as a single negative integer, without VAT. **`fee_breakdown`** is an array of individual fee line items, each with an `amount`, `currency`, `identifier`, and `type`. Breakdown amounts are negative and can be fractional. The `type` values are `acquirer` (Pay.com's fees, such as processing, 3D Secure, and decline fees), `network` (card network fees), and `interchange` (card-issuer fees), in that order. On blended pricing, there are `acquirer` lines only. **`available_on`** is the estimated date the transaction can be paid out in a settlement: the transaction's day plus your funding delay in banking days, or the acquirer's own schedule. Pay.com sets it when the transaction is authorized. It's `null` when Pay.com can't estimate it. **`source`** contains the originating resource: the full charge, refund, or payout, or a `payment_attempt` for a declined attempt in a payment session. The `source.url` field gives you the API path to retrieve that resource directly. ### Currency conversion [#currency-conversion] **`source_amount`** and **`source_currency`** record the transaction's own amount and currency. When they differ from your settlement currency, **`exchange_rate`** is the rate applied to convert them, and otherwise it's `null`. The top-level `amount` field always reflects the converted value in the settlement currency. Call [`GET /v1/cashflow/transactions`](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk) with a date range to list transactions, or with `settlement_id` to list the transactions included in one settlement. Results are returned oldest first. Paginate with `starting_after` when `has_more` is `true`. ```bash curl https://api.sandbox.pay.com/v1/cashflow/transactions \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "created.greater_than_or_equals=2026-03-20" \ -d "created.less_than_or_equals=2026-03-24" \ -d "limit=10" ``` ```json { "resource": "cashflow_transactions", "data": [ { "id": "cflw_tx_690017293823913984", "resource": "cashflow_transaction", "type": "charge", "created": "2026-03-20T02:03:35.323Z", "currency": "eur", "amount": 6026, "net_amount": 5936, "net_amount_human_readable": "59.36", "fee": -90, "available_on": "2026-03-25T00:00:00.000Z", "exchange_rate": "1.1849340", "source_amount": 7140, "source_currency": "usd", "source": { "id": "chrg_690017293823913984", "url": "/v1/charges/chrg_690017293823913984" } } ], "has_more": true } ``` The list returns the same objects as retrieving one, including `fee_breakdown`. To retrieve a single transaction, pass its ID to [`GET /v1/cashflow/transactions/{id}`](/api-reference/endpoints/cashflow/get-cashflow-transaction). ```bash curl https://api.sandbox.pay.com/v1/cashflow/transactions/cflw_tx_690017293823913984 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "cflw_tx_690017293823913984", "resource": "cashflow_transaction", "type": "charge", "created": "2026-03-20T02:03:35.323Z", "currency": "eur", "amount": 6026, "net_amount": 5936, "net_amount_human_readable": "59.36", "fee": -90, "fee_breakdown": [ { "amount": -15, "currency": "eur", "identifier": "charge", "type": "acquirer" }, { "amount": -3, "currency": "eur", "identifier": "threeds", "type": "acquirer" }, { "amount": -2, "currency": "eur", "identifier": "3_h_4095056", "type": "network" }, { "amount": -70, "currency": "eur", "identifier": "interchange", "type": "interchange" } ], "available_on": "2026-03-25T00:00:00.000Z", "exchange_rate": "1.1849340", "source_amount": 7140, "source_currency": "usd", "source": { "id": "chrg_690017293823913984", "url": "/v1/charges/chrg_690017293823913984" } } ``` ## Relationship to settlements [#relationship-to-settlements] The merchant balance and cash flow transactions give you an up-to-date view of all cleared activity on your account. Settlements are discrete transfers. On each settlement run, Pay.com pays out the cleared transactions past their funding delay in a single transfer to your bank, and records it as a `settlements` entry in the balance breakdown. Each completed settlement reduces the balance's `net_amount` by the amount transferred. The balance therefore reflects everything, including activity that has not yet been settled. Use the balance and cash flow endpoints for ongoing monitoring and transaction-level reconciliation. Use the [Settlements API](/api-reference/endpoints/settlements/list-settlements) when you need the details of a specific settlement, its fee breakdown, or the period it covers. ## Next steps [#next-steps] * [Retrieve a merchant balance](/api-reference/endpoints/cashflow/get-merchant-balance): API reference * [List cash flow transactions](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk): API reference * [Retrieve a cash flow transaction](/api-reference/endpoints/cashflow/get-cashflow-transaction): API reference * [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement): verify a settlement with four API calls * [Settlements](/data/reconciliation/settlements) * [Exchange rates](/data/reconciliation/exchange-rates) # Exchange rates (/data/reconciliation/exchange-rates) When a customer pays in a different currency from your settlement currency, Pay.com converts the amount automatically before crediting your balance. Use the Exchange Rates API to read pair rates, quote conversions, or retrieve the rate applied to a specific charge. ## When currency conversion applies [#when-currency-conversion-applies] Pay.com configures an acceptance currency and a settlement currency for your account during onboarding. If those two currencies differ, Pay.com converts each transaction amount to your settlement currency before it reaches your balance. For example, if you accept USD payments but settle in EUR, every USD charge is converted to EUR. Currency conversion applies automatically. You don't need to request it per transaction, and it can't be disabled for transactions that cross currencies. To add a new acceptance currency, contact your Pay.com account manager. ## How the rate is determined [#how-the-rate-is-determined] Each rate comes from your account's FX provider, and can differ by card network. A markup agreed upon during onboarding is applied to the base rate, and charges, refunds, and payouts each have their own rate. The settlement amount is the transaction amount divided by the rate. The rate is set in two steps: 1. **At authorization**, Pay.com converts the amount at the rate in effect at the transaction's time. 2. **At clearing**, the acquirer's clearing data can replace it. For some acquirers, Pay.com uses the rate the acquirer applied, with your markup. The rate in your cash flow transactions, settlements, and reports is the one after clearing. The rate and markup are not configurable through the API. They're fixed at onboarding and apply uniformly to all transactions in the relevant currency pair. The API lets you read rates for reconciliation and analysis, not change them. To review your markup or FX terms, contact your Pay.com account manager. ## Endpoints [#endpoints] Pay.com provides endpoints to read daily pair rates, retrieve the rate applied to a specific charge, and quote a conversion via [`POST /v1/exchange_rates/calculate`](/api-reference/endpoints/exchangerates/calculate-exchange-rates). ### Current rate for a currency pair [#current-rate-for-a-currency-pair] [`GET /v1/exchange_rates`](/api-reference/endpoints/exchangerates/get-exchange-rates) returns the exchange rate in effect now for a transaction currency and settlement currency. It responds with `201`. If no currency conversion is configured for your account, it returns `400 Exchange rates not configured`. Ask your Pay.com account manager to set it up. All query parameters are optional: * `transaction_currency`: the currency the customer paid in (for example, `usd`). Omit it to get rates for every currency you accept, as a list (`"resource": "exchange_rates"`, with a `data` array and `valid_until`). * `settlement_currency`: your settlement currency (for example, `eur`). Defaults to your account's settlement currency. * `network`: the card network (`visa`, `mastercard`, `amex`, `discover`, or `jcb`). Pass `network` when your account's FX provider prices by card network. If it is needed and missing, the API returns `400 Network must be provided`. For other accounts, `network` is ignored. The `payout` rate appears only if payouts to your customers are enabled on your account. ```bash curl "https://api.sandbox.pay.com/v1/exchange_rates" \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "transaction_currency=usd" \ -d "settlement_currency=eur" \ -d "network=visa" ``` ```json { "id": "fx_100001812084473856", "resource": "exchange_rate", "settlement_currency": "eur", "transaction_currency": "usd", "exchange_rate": { "charge": "1.0923", "refund": "1.0923", "payout": "1.0923" } } ``` ### Rate applied to a specific charge [#rate-applied-to-a-specific-charge] [`GET /v1/exchange_rates/charge/{charge_id}`](/api-reference/endpoints/exchangerates/get-charge-exchange-rates) returns the rate applied to a charge: the rate from authorization, or the acquirer's rate once the charge has cleared. Use it when reconciling individual transactions against your records. The response includes `exchange_rate`, `transaction_amount` and `transaction_currency`, and `settlement_amount` and `settlement_currency` (all amounts in minor units). If the charge has no conversion data (for example, it was not converted or not approved), the endpoint returns `400`. A `404` means the charge does not exist. ```bash curl "https://api.sandbox.pay.com/v1/exchange_rates/charge/chrg_690017293823913984" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "fxd_690017293823913984", "resource": "exchange_data", "charge": "chrg_690017293823913984", "exchange_rate": "1.1849340", "transaction_amount": 7140, "transaction_amount_human_readable": "71.40", "transaction_currency": "usd", "settlement_amount": 6026, "settlement_amount_human_readable": "60.26", "settlement_currency": "eur" } ``` ## Next steps [#next-steps] Read rates alongside the rest of your reporting data. * [Retrieve exchange rates](/api-reference/endpoints/exchangerates/get-exchange-rates): The rate for a currency pair. * [Retrieve charge exchange rates](/api-reference/endpoints/exchangerates/get-charge-exchange-rates): The rate applied to one charge. * [Balances and cash flow](/data/reconciliation/balances-and-cashflow): How converted amounts reach your balance. * [Settlements](/data/reconciliation/settlements): The transfers to your bank, in your settlement currency. # Reconciliation (/data/reconciliation) A transaction is final once it clears. Pay.com receives clearing data from every acquirer and processor your payments go through, matches each record to its transaction, and books the final fees. A settlement then pays out the cleared transactions to your bank. Reconciling means matching each of these steps to your own records. ## From authorization to your bank [#from-authorization-to-your-bank] A charge goes through three stages after the customer pays. 1. **Authorization.** The issuer approves or declines the payment. Pay.com books estimated fees, and sets `available_on`, the date the transaction is expected to be paid out. 2. **Clearing.** The acquirer's clearing data confirms the transaction, with its final amount and fees. Pay.com books the final fees and marks the transaction cleared. 3. **Settlement.** On your settlement schedule, Pay.com pays out every cleared transaction whose funding delay has passed, less fees, chargebacks, reserves, and adjustments. ## How clearing data reaches Pay.com [#how-clearing-data-reaches-paycom] Each acquirer and processor sends its clearing data in its own way: daily files, reports, or API calls. Chargebacks and the card networks' fraud reports (Visa TC40 and Mastercard SAFE) arrive the same way. Pay.com reads each one and maps it to Pay.com's own objects, so you receive the same events and reports whichever acquirer processed a payment. Pay.com sends each attempt to the acquirer with its own reference: the digits of the Pay.com ID, `aid`, and the attempt number, such as `685125114794084352aid1`. The acquirer's clearing record carries that reference back, and Pay.com uses it to match the record to the transaction. See [Pay.com's reference at the acquirer](/payments/routing/routed-payments#paycoms-reference-at-the-acquirer). Pay.com also checks the other way: an approved transaction that's missing from the acquirer's data is flagged for Pay.com to follow up. ## What changes when a transaction clears [#what-changes-when-a-transaction-clears] When a charge, refund, or payout clears, Pay.com updates it and creates its cash flow transaction. | What | Change | | :----------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | | `cashflow_transaction` on the charge, refund, or payout | Set to its cash flow transaction's ID, which has the same digits, such as `cflw_tx_688930130227113984` for `chrg_688930130227113984` | | [Cash flow transaction](/data/reconciliation/balances-and-cashflow#cash-flow-transactions) | Created, with the final `fee`, `fee_breakdown`, and `net_amount` | | `underlying_network_details` | Gains the ARN and RRN, when the acquirer sends them. See [Network data](/data/transaction-data/network-data). | | `underlying_network_id` | The network transaction ID, when the acquirer sends it | | Exchange rate and settlement amount | Can change to the acquirer's rate, when the transaction and settlement currencies differ. See [Exchange rates](/data/reconciliation/exchange-rates). | | [Reconciliation transactions](/data/reconciliation/reconcile-transactions) | The transaction is listed for its clearing date | | `paid` | Stays `false` until a settlement pays the transaction out | A declined transaction that carried fees, such as a decline fee, clears too. Its cash flow transaction has `type: "decline"` and a negative `net_amount`. ### Events at clearing [#events-at-clearing] Pay.com sends these events when a transaction clears. | Event | When | | :----------------------------- | :---------------------------------------------------- | | `cashflow_transaction.created` | Every time a charge, refund, or payout clears | | `charge.updated` | A charge or capture cleared with a new or changed ARN | | `refund.updated` | A refund cleared with a new or changed ARN | The events are sent together, so they can arrive in any order, and an event can arrive more than once. Handle each event once, using its `id`, and read the charge again if you need its latest state. When an acquirer reports that it abandoned a charge's clearing, Pay.com sends `charge.clearing_abandoned`. The charge's funds aren't settled. ## Chargebacks and fraud reports [#chargebacks-and-fraud-reports] Chargebacks and fraud reports reach Pay.com in the acquirers' data too: * **Chargebacks** open or update the charge's [dispute](/risk/disputes), and Pay.com sends a `dispute.*` event when its status changes. The chargeback's amount and fees are taken from a later settlement, in `chargeback_amount` and `chargeback_fees`. A chargeback has no cash flow transaction. It's in the [disputes reports](/data/reporting/disputes-reports). * **Fraud reports**, Visa TC40 and Mastercard SAFE records, set `fraud: true` on the charge and create a [fraud warning](/risk/fraud-warnings). Pay.com sends `fraud_warning.created`. A fraud report moves no money. ## How cleared transactions reach a settlement [#how-cleared-transactions-reach-a-settlement] Pay.com builds settlements on your settlement account's schedule: daily, weekly, or monthly, on banking days. A settlement includes every transaction that's cleared, not yet settled, and past its funding delay, together with the chargebacks, fees, reserves, and adjustments due. A transaction that isn't ready waits for a later settlement. Pay.com pays the net amount to your bank with a reference that names the settlement, such as `PAY.COM/stlmnt_690127572775747584`, marks the transactions `paid: true`, and sends `settlement.paid`. If your acquirer pays you directly, Pay.com records the acquirer's payout as the settlement instead, and sends `settlement.paid` when it processes the acquirer's payment report. See [Settlements](/data/reconciliation/settlements). ## Reconcile your records [#reconcile-your-records] Reconcile at the level your accounting needs. | Level | Match | Use | | :----------- | :-------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Transaction | Each cleared transaction, its fees, and its net amount | The [transaction reconciliation report](/data/reporting/transaction-reconciliation-report), or [Reconcile transactions](/data/reconciliation/reconcile-transactions) with the API | | Settlement | A settlement's transactions, fees, and adjustments against its amount | The [settlement report](/data/reporting/settlement-report), or [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement) with the API | | Bank deposit | A deposit in your bank account against a settlement | The deposit's reference, such as `PAY.COM/stlmnt_690127572775747584`, names the settlement | | Balance | What Pay.com owes you, at any point in time | [Balances and cash flow](/data/reconciliation/balances-and-cashflow) | To test your reconciliation in the sandbox, clear a sandbox charge with [Simulate clearing](/data/reconciliation/simulate-clearing). ## Next steps [#next-steps] * [Reconcile transactions](/data/reconciliation/reconcile-transactions): List cleared transactions with their fees. * [Settlements](/data/reconciliation/settlements): What a settlement contains and when it's paid. * [Daily reports](/data/reporting/daily-reports): Receive the same data as files. # Reconcile a settlement (/data/reconciliation/reconcile-a-settlement) To verify a Pay.com settlement, make four API calls: list settlements for a period, retrieve the full financial breakdown, check for adjustments, and cross-check individual transactions in your cash flow. To start as soon as a settlement is paid, instead of polling, listen for the `settlement.paid` [webhook event](/api-reference/webhooks/webhook-events). You need a Pay.com API key with **Read** on Settlements, Adjustments, and Cash flow (see [Permissions](/developer-resources/authentication/scoped-api-keys#permissions)), and a settlement period to reconcile (start and end date). The steps build on [Settlements](/data/reconciliation/settlements) and [Balances and cash flow](/data/reconciliation/balances-and-cashflow). ### List settlements for a period [#list-settlements-for-a-period] Call [`GET /v1/settlements`](/api-reference/endpoints/settlements/list-settlements) with a date range to retrieve all settlements created in that window. Amounts are integers in the minor unit (the smallest unit) of the settlement currency, for example `332477` for €3,324.77. ```bash curl https://api.sandbox.pay.com/v1/settlements \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "created.greater_than_or_equals=2026-03-20" \ -d "created.less_than_or_equals=2026-03-24" \ -d "limit=10" ``` ```json { "resource": "settlements", "data": [ { "id": "stlmnt_690127572775747584", "amount": 332477, "amount_human_readable": "3324.77", "created": "2026-03-20T09:20:35.300Z", "currency": "eur", "payment_date": "2026-03-20T09:21:54.959Z", "period_end": "2026-03-17T23:59:59.000Z", "period_start": "2026-03-17T00:00:00.000Z", "resource": "settlement", "settlement_account": "sa_473768761812321280", "settlement_account_details": { "currency": "eur" }, "test_mode": true, "type": "bank_account" }, { "id": "stlmnt_691239809032669184", "amount": 487938, "amount_human_readable": "4879.38", "created": "2026-03-23T11:00:13.088Z", "currency": "eur", "payment_date": "2026-03-23T11:01:39.508Z", "period_end": "2026-03-18T23:59:59.000Z", "period_start": "2026-03-18T00:00:00.000Z", "resource": "settlement", "settlement_account": "sa_473768761812321280", "settlement_account_details": { "currency": "eur" }, "test_mode": true, "type": "bank_account" } ], "has_more": false } ``` Note these fields on each settlement object: | Field | Description | | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | The settlement ID, used in the following steps | | `amount` | Net amount transferred to your bank, in the minor currency unit | | `currency` | The settlement currency | | `period_start` / `period_end` | The transaction window covered by this settlement. The settlement is created after the period ends, so `created` falls later than `period_end` | | `settlement_account` | The Pay.com settlement account that received the funds (prefix `sa_`) | Pick the `id` of the settlement you want to reconcile and use it in the following steps. ### Retrieve the settlement breakdown [#retrieve-the-settlement-breakdown] Call [`GET /v1/settlements/{settlement_id}/breakdown`](/api-reference/endpoints/settlements/get-settlement-breakdown) to retrieve the itemized fee and adjustment components that sum to the settlement's net `amount`. ```bash curl https://api.sandbox.pay.com/v1/settlements/stlmnt_690127572775747584/breakdown \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "stbrk_stlmnt_690127572775747584", "resource": "settlement_breakdown", "amount": 332477, "chargeback_amount": 0, "chargeback_fees": 0, "currency": "eur", "general_adjustments": -2500, "interchange_fees": -4400, "network_fess": -7071, "payout_amount": 0, "processed_amount": 354727, "processing_fees": -4126, "refund_amount": 0, "rolling_reserve": 0, "rolling_reserve_released": 0, "service_fees": -1000, "test_mode": true, "vat": -3153 } ``` These fields make up the breakdown. | Field | Description | | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `processed_amount` | Charges that cleared in the period, less the refunds and the payouts to your customers taken from this settlement. The starting figure before fees. | | `refund_amount` | Refunds taken from this settlement, as a positive number. Already deducted in `processed_amount`. | | `chargeback_amount` | Chargebacks taken from this settlement, less the representments and chargeback reversals returned to you. Negative unless the returns are larger. | | `chargeback_fees` | The fees charged for chargebacks | | `interchange_fees` | Fees paid to the card-issuing bank. Usually negative. A refund's interchange can be returned to you. | | `network_fess` | Fees paid to the card network (Visa, Mastercard, and so on). Usually negative. | | `processing_fees` | Pay.com's fees for processing, including decline fees. On blended pricing, the whole fee. Usually negative. | | `service_fees` | The fee for the transfer to your bank. Negative. | | `vat` | VAT, when your account is charged VAT, on the fees and the transfer fee. Negative. | | `rolling_reserve` / `rolling_reserve_released` | Reserve withheld in this settlement (negative) and earlier reserve released (positive) | | `general_adjustments` | Fees and credits Pay.com applies as [adjustments](/data/reconciliation/adjustments), such as your monthly service fee. See the next step. | | `payout_amount` | [Payouts](/payouts) to your customers taken from this settlement, as a positive number. Already deducted in `processed_amount`. | Verify that `amount` equals the sum of `processed_amount`, `chargeback_amount`, `chargeback_fees`, `interchange_fees`, `network_fess`, `processing_fees`, `service_fees`, `vat`, `rolling_reserve`, `rolling_reserve_released`, and `general_adjustments`. Leave out `refund_amount` and `payout_amount`, which are already deducted in `processed_amount`. Deductions are already negative, so add every field as returned. In this example, 354727 − 4400 − 7071 − 4126 − 1000 − 2500 − 3153 = 332477. See [What a settlement contains](/data/reconciliation/settlements#what-a-settlement-contains) for the full field reference. ### Check for adjustments [#check-for-adjustments] Call [`GET /v1/adjustments`](/api-reference/endpoints/adjustments/list-adjustments) filtered by `settlement_id` to list the adjustments Pay.com applied to this settlement. ```bash curl "https://api.sandbox.pay.com/v1/adjustments?settlement_id=stlmnt_690127572775747584&limit=10" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "resource": "adjustments", "data": [ { "id": "adj_690127572775747601", "resource": "adjustment", "settlement_id": "stlmnt_690127572775747584", "bank_transfer_reference": null, "currency": "EUR", "description": "Monthly service fee", "identifier": "monthly_service_fee", "quantity": 1, "amount": "-25.00", "total": "-25.00", "test_mode": true } ], "last_page": true, "page": 1, "total_pages": 1, "total_records": 1 } ``` Each adjustment's `total` is a decimal string in the major currency unit, such as `"-25.00"`. Add up the totals, convert the sum to the minor unit, and compare it with `general_adjustments` from the breakdown in the previous step. In this example, −25.00 EUR is `-2500`. An empty `data` means the settlement has no adjustments. The transfer fee isn't an adjustment. It's in `service_fees`. ### Cross-check with cash flow transactions [#cross-check-with-cash-flow-transactions] Call [`GET /v1/cashflow/transactions`](/api-reference/endpoints/cashflow/get-cashflow-transactions-bulk) with `settlement_id` to list every cash flow transaction included in this settlement, so you can match transaction-level amounts to the aggregated totals in the settlement breakdown. Filter by `settlement_id`, not by dates. `period_start` and `period_end` are the first and last days on which the settlement's transactions cleared, and a transaction can be created days before it clears. ```bash curl https://api.sandbox.pay.com/v1/cashflow/transactions \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "settlement_id=stlmnt_690127572775747584" \ -d "limit=10" ``` ```json { "resource": "cashflow_transactions", "data": [ { "id": "cflw_tx_688930130227113984", "amount": 6026, "available_on": "2026-03-20T00:00:00.000Z", "created": "2026-03-17T02:03:35.323Z", "currency": "eur", "exchange_rate": "1.1849340", "fee": -90, "net_amount": 5936, "net_amount_human_readable": "59.36", "resource": "cashflow_transaction", "source": { "id": "chrg_688930130227113984", "url": "/v1/charges/chrg_688930130227113984" }, "source_amount": 7140, "source_currency": "usd", "type": "charge" }, { "id": "cflw_tx_688942261290938368", "amount": 6945, "available_on": "2026-03-20T00:00:00.000Z", "created": "2026-03-17T02:51:35.522Z", "currency": "eur", "exchange_rate": "1.1770788", "fee": -369, "net_amount": 6576, "net_amount_human_readable": "65.76", "resource": "cashflow_transaction", "source": { "id": "chrg_688942261290938368", "url": "/v1/charges/chrg_688942261290938368" }, "source_amount": 8175, "source_currency": "usd", "type": "charge" } ], "has_more": true } ``` For each entry, `net_amount` is the amount credited to your balance after fees. Sum `amount` across `charge` rows and compare it with `processed_amount` plus `refund_amount` and `payout_amount`, which together are the settlement's charges before refunds and payouts were taken off. Sum `fee` across all rows and compare it with `processing_fees`, `interchange_fees`, and `network_fess`. Fee breakdown amounts can be fractional, so allow for small rounding differences. Cash flow covers charges, refunds, payouts, and declined transactions that carried fees. Chargebacks, the transfer fee, VAT, reserves, and adjustments have no cash flow transactions. Check them against the breakdown and the adjustments instead. When `has_more` is `true`, paginate through the remaining results until you have all transactions in the settlement. Pass the `id` of the last transaction in the current page as `starting_after` in your next request: ```bash curl https://api.sandbox.pay.com/v1/cashflow/transactions \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "settlement_id=stlmnt_690127572775747584" \ -d "starting_after=cflw_tx_688942261290938368" \ -d "limit=10" ``` To see the same settlement's transactions with interchange, network, and processing fees already broken out per row, list its reconciliation transactions with `settlement_id` (see [Reconcile transactions](/data/reconciliation/reconcile-transactions#filtering-and-pagination)). Their amounts are integers in the minor unit, like the cash flow amounts. ## Next steps [#next-steps] Read more about the data behind each step. * [List reconciliation transactions](/api-reference/endpoints/reconciliation/list-reconciliation-transactions): The full API reference for reconciliation data. * [Settlements](/data/reconciliation/settlements): How transactions are grouped into settlements. * [Adjustments](/data/reconciliation/adjustments): The fees and credits applied to a settlement. * [Balances and cash flow](/data/reconciliation/balances-and-cashflow): A running ledger view of your account. # Reconcile transactions (/data/reconciliation/reconcile-transactions) [`GET /v1/reconciliation/transactions`](/api-reference/endpoints/reconciliation/list-reconciliation-transactions) lists your cleared transactions: charges, captures, holds, refunds, and payouts to your customers, approved or declined. Each row has its amounts, its interchange, network, and processing fees, and its net amount, so you can match it against your records without joining other API responses. It's the API version of the [transaction reconciliation report](/data/reporting/transaction-reconciliation-report). ## When to use it [#when-to-use-it] Use the list when you need cleared transactions on request: * **Accounting:** list a day's or a date range's transactions and import them into your ledger. * **Settlement verification:** list a settlement's transactions with `settlement_id`. To check the settlement against its breakdown and adjustments as well, see [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement). * **Fee analysis:** add up `fee_interchange`, `fee_network`, and `fee_processing` by card brand, funding type, or jurisdiction. For a whole day's transactions, the daily report is one file instead of a call for every 100 rows. See [Daily reports](/data/reporting/daily-reports). ## Filtering and pagination [#filtering-and-pagination] Pass one filter: `settlement_id`, `date`, or `from_date` together with `to_date`. A request with no filter, or with both `settlement_id` and `date`, returns `400`. Dates are `YYYY-MM-DD` in UTC and filter on the transaction's clearing date, so only cleared transactions are returned. Rows are sorted by `created`, oldest first. The list is paginated by page number. Request each page with `page` until `last_page` is `true`. | Parameter | Description | | :-------------- | :------------------------------------------------------------------------------ | | `settlement_id` | Return the transactions in this settlement | | `date` | Return the transactions that cleared on this date (`YYYY-MM-DD`) | | `from_date` | Start of the clearing date range (inclusive). Required together with `to_date`. | | `to_date` | End of the clearing date range (inclusive). Required together with `from_date`. | | `page` | Page number. Default `1`. | | `limit` | Rows per page. Default `10`, maximum `100`. | The response's `total_records` and `total_pages` count every row and page for your filter. ## Key fields [#key-fields] Each row has these fields. Amounts are integers in the minor unit of their currency, for example `7140` for $71.40, and are negative for refunds and payouts. | Field | Description | | :----------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | The transaction's ID: `chrg_…`, `hld_…`, `rfnd_…`, or `po_…`, `psatt_…` for a declined attempt in a payment session, or `rtratt_…` for an attempt that Pay.com retried | | `resource` | `charge`, `attempt`, `hold`, `refund`, `payout`, or `retried_attempt` | | `status` | `succeeded` or `failed`. A charge can also be `succeeded_partially` or `awaiting_final_confirmation`. | | `created` | When the transaction was created | | `reference` | Your reference on the transaction | | `failure_code` | Pay.com's failure code, for a failed transaction | | `currency` | The transaction's currency | | `amount` | The transaction amount, in `currency` | | `settlement_currency` | Your settlement currency | | `settlement_amount` | The amount in your settlement currency | | `exchange_rate` | The rate used to convert `amount`, as a number, or `null` when the currencies are the same | | `net_amount` | The amount after fees, in your settlement currency | | `fee_interchange` | The interchange fee, in the minor unit of your settlement currency. It can have a fractional part. `null` on blended pricing. | | `fee_network` | The card network's fee, the same way. `null` on blended pricing. | | `fee_processing` | Pay.com's processing fee, the same way. On blended pricing, the whole fee. | | `metadata` | The transaction's metadata, or `null` when it has none. It's a string that holds the metadata's JSON text encoded as a JSON string, so decode it twice to get the object. | | `jurisdiction` | `domestic`, `international`, or `intraregional` | | `payment_method_type` | The payment method's type, such as `card` | | `payment_method` | The payment method's ID | | `payment_method_serialized` | The masked card number, such as `424242******4242` | | `payment_method_card_brand` | The card brand, such as `visa` | | `payment_method_card_funding` | `credit`, `debit`, or `prepaid` | | `payment_method_card_issuer_name` | The card issuer's name | | `payment_method_card_issuer_country` | The card issuer's two-letter country code | | `customer_id` | Pay.com's customer ID (`cust_…`) | | `customer_reference_id` | Your ID for the customer | | `customer_email` | The customer's email address | | `merchant` | Your merchant ID (`mrchnt_…`) | | `merchant_reference` | Your merchant account's reference | | `payment_session` | The payment session's ID (`ps_…`), for a transaction made in a payment session | Fees are negative. ```bash curl https://api.sandbox.pay.com/v1/reconciliation/transactions \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "date=2026-03-17" \ -d "limit=100" ``` ```json { "id": "txrcn_688826003734855680", "resource": "transaction_reconciliation", "data": [ { "id": "chrg_688930130227113984", "resource": "charge", "status": "succeeded", "created": "2026-03-17T02:03:35.323Z", "reference": "order_12345", "currency": "usd", "amount": 7140, "settlement_currency": "eur", "settlement_amount": 6026, "exchange_rate": 1.184934, "net_amount": 5936, "fee_interchange": -18.4521, "fee_network": -11.9012, "fee_processing": -59.6467, "metadata": null, "payment_method_type": "card", "payment_method_card_brand": "visa", "customer_reference_id": "cust_ext_abc123" } ], "page": 1, "last_page": true, "total_pages": 1, "total_records": 1 } ``` For the full endpoint, see [List reconciliation transactions](/api-reference/endpoints/reconciliation/list-reconciliation-transactions). ## Next steps [#next-steps] * [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement): Check a settlement against its breakdown, adjustments, and transactions. * [Transaction reconciliation report](/data/reporting/transaction-reconciliation-report): The same data as a daily file. * [Reconciliation](/data/reconciliation): How transactions clear. # Settlements (/data/reconciliation/settlements) A settlement is a transfer of your net proceeds to your bank. On your settlement schedule, Pay.com takes every cleared transaction that's ready to be paid out, deducts fees, chargebacks, reserves, and adjustments, and sends the net amount to your bank account. The Settlements API returns every settlement and its full breakdown. ## What is a settlement [#what-is-a-settlement] A settlement includes every transaction that's cleared, not yet settled, and past its funding delay on the day the settlement runs. A cleared transaction that isn't past its funding delay yet waits for a later settlement. Its [cash flow transaction](/data/reconciliation/balances-and-cashflow#cash-flow-transactions)'s `available_on` estimates when it's paid out. * `period_start` and `period_end` are the first and last days on which the settlement's transactions cleared. * `amount` is the amount transferred to your bank, as an integer in the minor unit of the settlement currency, for example `332477` for €3,324.77. `amount_human_readable` is the same amount as a decimal string. * `payment_date` is when Pay.com paid the settlement. It's in list responses. When Pay.com has paid a settlement, it sends a `settlement.paid` [webhook event](/api-reference/webhooks/webhook-events), marks the settlement's transactions `paid: true`, and generates the [settlement report](/data/reporting/settlement-report). The bank transfer's reference names the settlement, such as `PAY.COM/stlmnt_690127572775747584`. If a settlement's net amount would be zero or negative, Pay.com doesn't pay one, and its transactions, fees, and adjustments carry forward to the next settlement. If your acquirer pays you directly, as some acquirers do, Pay.com records the acquirer's payout as the settlement when it processes the acquirer's payment report, and sends `settlement.paid` then. ## Settlement accounts [#settlement-accounts] A settlement account is an account with an acquirer or processor in one settlement currency. Each settlement account has a unique ID with the prefix `sa_`, for example `sa_473768761812321280`. See [Workspaces and settlement accounts](/get-started/how-pay-com-works/workspaces). If you process transactions in more than one currency, you have a separate settlement account for each settlement currency, each with its own settlements. The [`GET /v1/cashflow/balances`](/api-reference/endpoints/cashflow/get-merchant-balance) endpoint takes a settlement account ID to scope the response to one currency. To find your settlement account IDs, see [Find your settlement account ID](/data/reconciliation/balances-and-cashflow#find-your-settlement-account-id). ## Settlement schedule [#settlement-schedule] Pay.com sets a schedule for each settlement account during onboarding: * **Daily**, on every banking day. * **Weekly**, on one weekday. * **Monthly**, on one day of the month. Settlements run on banking days. A run that falls on another day moves to the next banking day. To change your schedule, contact your Pay.com account manager. ## List and retrieve settlements [#list-and-retrieve-settlements] The Settlements API has three retrieval endpoints: list your settlements, retrieve a settlement by ID, and retrieve a settlement's full financial breakdown. The breakdown is described in [What a settlement contains](#what-a-settlement-contains). Call [`GET /v1/settlements`](/api-reference/endpoints/settlements/list-settlements) to list the settlements Pay.com has paid. Use `created.greater_than_or_equals` and `created.less_than_or_equals` to scope the results to when the settlements were created. Results are returned oldest first. ```bash curl "https://api.sandbox.pay.com/v1/settlements" \ -u ':sk-pay-com-sandbox-…' \ -G \ -d "created.greater_than_or_equals=2026-03-01" \ -d "created.less_than_or_equals=2026-03-31" \ -d "limit=10" ``` ```json { "resource": "settlements", "data": [ { "id": "stlmnt_690127572775747584", "resource": "settlement", "amount": 332477, "amount_human_readable": "3324.77", "created": "2026-03-20T09:20:35.300Z", "currency": "eur", "period_start": "2026-03-17T00:00:00.000Z", "period_end": "2026-03-17T23:59:59.000Z", "payment_date": "2026-03-20T09:21:54.959Z", "settlement_account": "sa_473768761812321280", "settlement_account_details": { "currency": "eur" }, "test_mode": true, "type": "bank_account" } ], "has_more": false } ``` To retrieve a single settlement, pass the settlement ID to [`GET /v1/settlements/{settlement_id}`](/api-reference/endpoints/settlements/get-settlement). ```bash curl "https://api.sandbox.pay.com/v1/settlements/stlmnt_690127572775747584" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "stlmnt_690127572775747584", "resource": "settlement", "amount": 332477, "amount_human_readable": "3324.77", "created": "2026-03-20T09:20:35.300Z", "currency": "eur", "period_start": "2026-03-17T00:00:00.000Z", "period_end": "2026-03-17T23:59:59.000Z", "settlement_account": "sa_473768761812321280", "settlement_account_details": { "currency": "eur" }, "test_mode": true, "type": "bank_account" } ``` ## What a settlement contains [#what-a-settlement-contains] Call [`GET /v1/settlements/{settlement_id}/breakdown`](/api-reference/endpoints/settlements/get-settlement-breakdown) with the settlement ID to retrieve every component of the amount transferred. Amounts are integers in the settlement currency's minor unit. | Field | Sign | Description | | -------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `processed_amount` | Positive, unless refunds and payouts exceed charges | Charges and captures in the settlement, less its refunds and payouts to your customers. The starting figure before fees. | | `refund_amount` | Positive | Refunds in the settlement. Already deducted in `processed_amount`, so not part of the sum below. | | `payout_amount` | Positive | [Payouts](/payouts) to your customers in the settlement. Already deducted in `processed_amount`, so not part of the sum below. | | `chargeback_amount` | Usually negative | Chargebacks, less the representments and chargeback reversals that returned money to you. Positive when the returns are larger. | | `chargeback_fees` | Negative | The fees charged for chargebacks. | | `interchange_fees` | Usually negative | Fees paid to the card-issuing bank. A refund's interchange can be returned to you. `0` on blended pricing. | | `network_fess` | Usually negative | Fees paid to the card network (Visa, Mastercard, and so on). `0` on blended pricing. | | `processing_fees` | Usually negative | Pay.com's fees for processing, including decline fees. On blended pricing, the whole fee. | | `service_fees` | Negative | The fee for the transfer to your bank. | | `vat` | Negative | VAT on the fees and the transfer fee, when your account is charged VAT. | | `rolling_reserve` | Negative | Amount withheld as a rolling reserve in this settlement. `0` if no reserve applies. | | `rolling_reserve_released` | Positive | Earlier reserves returned in this settlement. `0` if none. | | `general_adjustments` | Either | Fees and credits Pay.com applies as [adjustments](/data/reconciliation/adjustments), such as your monthly service fee. Negative when they deduct. | The settlement's `amount` is the sum of `processed_amount`, `chargeback_amount`, `chargeback_fees`, `interchange_fees`, `network_fess`, `processing_fees`, `service_fees`, `vat`, `rolling_reserve`, `rolling_reserve_released`, and `general_adjustments`, added as returned. In the example below, 354727 − 4400 − 7071 − 4126 − 1000 − 2500 − 3153 = 332477. For some acquirers, every fee field is `0`, and the fees are deducted as adjustments instead. ```bash curl "https://api.sandbox.pay.com/v1/settlements/stlmnt_690127572775747584/breakdown" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "stbrk_stlmnt_690127572775747584", "resource": "settlement_breakdown", "amount": 332477, "chargeback_amount": 0, "chargeback_fees": 0, "currency": "eur", "general_adjustments": -2500, "interchange_fees": -4400, "network_fess": -7071, "payout_amount": 0, "processed_amount": 354727, "processing_fees": -4126, "refund_amount": 0, "rolling_reserve": 0, "rolling_reserve_released": 0, "service_fees": -1000, "test_mode": true, "vat": -3153 } ``` ## Adjustments [#adjustments] Pay.com charges the fees that aren't tied to a transaction, and pays back amounts it owes you, as adjustments on a settlement, such as your monthly service fee or a chargeback adjustment. The breakdown's `general_adjustments` is their sum. See [Adjustments](/data/reconciliation/adjustments) for each kind and how to list them. ## Next steps [#next-steps] Use settlements in your reconciliation workflow. * [Reconcile a settlement](/data/reconciliation/reconcile-a-settlement): Verify a settlement against its breakdown, adjustments, and cash flow. * [Settlement report](/data/reporting/settlement-report): Every row of a settlement, as a file. * [Balances and cash flow](/data/reconciliation/balances-and-cashflow): Your running balance and per-event ledger. * [List settlements](/api-reference/endpoints/settlements/list-settlements): The full API reference for settlements. # Simulate transaction clearing (/data/reconciliation/simulate-clearing) In the live environment, a transaction clears when Pay.com receives the acquirer's clearing data for it and books its final fees, such as interchange and network fees. Clearing creates the cash flow transaction that you use for reconciliation. See [Reconciliation](/data/reconciliation). Pay.com's sandbox lets you **simulate clearing** so you can build and test your reconciliation logic before going live. The simulate endpoint books dummy IC++ fees, clears the charge, and sends `cashflow_transaction.created`, as live clearing does. The simulate clearing endpoint is only available in the **sandbox** environment. In the live environment, it returns `403`. ## Supported resources [#supported-resources] You can simulate clearing for **charges** only. The charge must already be processed (approved or declined). Otherwise, the endpoint returns `422`, or `404` for a charge that ended in an error. A charge can be cleared only once, and a second call returns `400`. ### Create a charge in the sandbox [#create-a-charge-in-the-sandbox] Create a charge in the sandbox. If you haven't done this before, follow the [create a charge](/payments/create-a-charge) guide using the sandbox base URL: ``` https://api.sandbox.pay.com/v1/charges ``` Take note of the charge `id` (`chrg_…`) in the response. You need it for the next step. ### Simulate clearing [#simulate-clearing] Send a `POST` request to the simulate clearing endpoint, replacing `{charge_id}` with the ID from the previous step. ```bash curl -X POST https://api.sandbox.pay.com/v1/charges/{charge_id}/simulate/clear \ -u ':sk-pay-com-sandbox-…' \ --header 'Content-Type: application/json' ``` `204 No Content` (empty body). The charge is cleared asynchronously. The endpoint returns immediately and starts the clearing in the background. Within a few seconds, Pay.com: * Books simulated fees for the transaction: a 0.30 gateway fee in your settlement currency, a 0.1% acquiring fee (approved charges only), and random network and interchange fees of up to 5% of the amount each. * Clears the transaction, with today as its clearing date, making the data available in the reconciliation endpoint. * Creates a `cashflow_transaction` resource. * Sends a `cashflow_transaction.created` webhook. The cash flow transaction's ID is the charge's digits with the `cflw_tx_` prefix. You can also wait for the webhook, or retrieve the charge and read its `cashflow_transaction` field. Live clearing also adds the acquirer's network data, such as the ARN, to the charge, and sends `charge.updated` when it does. The simulator doesn't. ### Query the cash flow transaction [#query-the-cash-flow-transaction] After clearing, you can query the cash flow transaction directly: ``` GET https://api.sandbox.pay.com/v1/cashflow/transactions/cflw_tx_{id} ``` You can also listen for the `cashflow_transaction.created` [webhook event](/api-reference/webhooks/webhook-events) to receive the data automatically. The response contains the fee breakdown and the original charge. The simulator generates random fees and also books the gateway and acquiring fees, so your `fee` and `fee_breakdown` values will differ from this example. ```json { "id": "cflw_tx_471314779009449984", "resource": "cashflow_transaction", "amount": 1200, "available_on": null, "created": "2024-07-24T13:56:45.136Z", "currency": "eur", "exchange_rate": null, "fee": -99, "fee_breakdown": [ { "amount": -30, "currency": "eur", "identifier": "charge", "type": "acquirer" }, { "amount": -1.2, "currency": "eur", "identifier": "charge", "type": "acquirer" }, { "amount": -41, "currency": "eur", "identifier": "network", "type": "network" }, { "amount": -27, "currency": "eur", "identifier": "interchange", "type": "interchange" } ], "net_amount": 1101, "net_amount_human_readable": "11.01", "source": { "id": "chrg_471314779009449984", "charge": { "id": "chrg_471314779009449984", "amount": 1200, "amount_human_readable": "12.00", "amount_refunded": 0, "billing_details": { "address": null, "email": null, "name": "123", "phone": null }, "calculated_statement_descriptor": "PAYCOM", "cashflow_transaction": "cflw_tx_471314779009449984", "created": "2024-07-24T13:56:45.136Z", "currency": "eur", "customer": null, "customer_reference_id": null, "description": null, "disputed": false, "failure_code": null, "failure_message": null, "fraud": false, "hold": null, "metadata": {}, "paid": false, "payment_method": "pm_card_471314801075683328", "payment_method_details": { "card": { "bin": "424242", "brand": "visa", "cardholder_currency": "usd", "country": "US", "exp_month": "11", "exp_year": "2025", "fingerprint": "37ec5c5745cf0ab6d2d7f9bf78d5d5ea14ae22db04a3bcfe80a3da6918e9b390", "funding": "debit", "last4": "4242", "name": "123", "network": "visa", "security_checks": { "address_line1_check": "unchecked", "address_postal_code_check": "pass", "cvc_check": "pass" }, "three_d_secure": null, "token": "tok_card_252811631061373952", "wallet": null }, "reference": null, "type": "card" }, "payment_method_options": { "card": { "accepted_card_brands": [], "accepted_card_categories": [], "accepted_card_countries": [], "accepted_card_funding": [], "accepted_card_jurisdictions": [], "accepted_eci_values": [], "request_threed_secure": "automatic", "security_checks": { "cvv_check": true } } }, "payment_session": null, "receipt": null, "reference": null, "refunded": false, "refunds": { "data": [], "url": "/v1/charges/chrg_471314779009449984/refunds" }, "resource": "charge", "shipping": null, "statement_descriptor_suffix": null, "status": "succeeded", "test_mode": true, "underlying_network_details": { "network": "visa", "visa": { "arn": "191262468630", "auth_code": "777637", "raw_response_code": "00" } }, "underlying_network_id": "651e3857-df71-4956-aff1-ba25d3a112f3", "underlying_processing_details": { "processor": "sandbox", "transaction_id": "062a89af-69c5-4062-9819-b8b90753279c" } }, "url": "/v1/charges/chrg_471314779009449984" }, "source_amount": 1200, "source_currency": "eur", "type": "charge" } ``` ## Key response fields [#key-response-fields] In the example, a €12.00 charge clears with €0.99 in fees, leaving €11.01. | Field | Description | | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `amount` | The original charge amount in the minor currency unit (the smallest unit). `1200` = €12.00. | | `fee` | Total fees deducted from the charge, rounded to the minor unit. `-99` = €0.99 deducted. | | `fee_breakdown` | Itemized list of fees. Each entry includes the fee `type` (`acquirer`, `network`, or `interchange`), the `amount`, and the `currency`. Here the two `acquirer` entries are the €0.30 gateway fee and the 0.1% acquiring fee (`-1.2`, because breakdown amounts aren't rounded). | | `net_amount` | The amount after fees. `1101` = €11.01 from a €12.00 charge. | | `source` | The full original charge object, including payment method details, status, and network data. | The fee values are dummy data generated for testing purposes. Live clearing books the fees from your acquirer's clearing data. Some acquirers and payment methods don't split out interchange and network fees, and on blended pricing the breakdown shows Pay.com's fees only. ## Next steps [#next-steps] * [Webhook events](/api-reference/webhooks/webhook-events): listen for `cashflow_transaction.created` to automate reconciliation. * [Environments](/get-started/environments): understand the difference between the sandbox and live. * [Create a charge](/payments/create-a-charge): create charges to test the clearing simulation flow. # Client certificates (/developer-resources/authentication/client-certificates) An [API key](/developer-resources/authentication/scoped-api-keys) can require a client certificate on every call. The key alone is then not enough. A call must also present, in its TLS connection, one of the certificates you added to that key. A leaked key can't be used without the matching certificate and its private key. ## How it works [#how-it-works] A client certificate works alongside the API key, not in place of it. * **Use your own certificate authority.** Pay.com doesn't issue client certificates. You add the certificate of the certificate authority (CA) that signs yours, then add client certificates it signed to each key. * **Pay.com matches the exact certificate.** On each call, Pay.com compares the SHA-256 fingerprint of the certificate your client presented with the key's active certificates, and checks that it hasn't expired. Your CA is checked when you add a certificate, not on each call. * **The host stays the same.** Your client presents the certificate when it connects to the API host it already uses. These limits apply to certificate authorities and client certificates. | Limit | Value | | :---------------------------------------------- | :-------------------------------------------------------------------------------------- | | Active certificate authorities per organization | 2 | | Active client certificates per API key | 2 | | Certificate format | PEM format (one certificate under **Certificate**, and up to 4 under **Intermediates**) | | Key types | RSA 2048, 3072, or 4096 bits, or ECDSA on P-256 or P-384 | | Signature hash | SHA-256, SHA-384, or SHA-512 | | Size | Up to 16 KB per certificate | Every certificate must be currently valid (past its start date and not expired) when you add it. Never paste a private key. A paste that contains one is refused. Owners and Payments admins manage certificate authorities and a key's client certificates, in Organization or in the Pay.com dashboard under **Developers**. Each change asks you to confirm it's you, and takes effect within a minute. ## Set it up [#set-it-up] Add your certificate authority, add a client certificate to the key, require it, and present it on every call. ### Add your certificate authority [#add-your-certificate-authority] Go to **Developers** → **Certificate authorities** and select **Add a certificate authority**. Give it a name of up to 60 characters and paste its certificate as PEM. The certificate must be a CA certificate. Its basic constraints say it's a CA, and if it has a key usage extension, that includes certificate signing. ### Add a client certificate to the key [#add-a-client-certificate-to-the-key] Open the API key's page. On the **Client certificates** card, select **Add a client certificate** and paste it as PEM under **Certificate**. If your CA signs through intermediates, paste them under **Intermediates** (up to 4 CA certificates, each still valid). The certificate must not be a CA certificate or allowed to sign certificates, and it must chain to one of your active certificate authorities that hasn't expired. Pay.com checks the intermediates when you add the certificate but doesn't keep them. ### Require a client certificate [#require-a-client-certificate] Turn on **Require a client certificate**. From then on, calls with this key must present one of its certificates. The switch stays off until the key has an active certificate that's still valid. ### Present the certificate on every call [#present-the-certificate-on-every-call] Configure your HTTP client with the certificate and its private key. Calls that don't present an accepted certificate are refused with `403`. See [Errors](#errors). ## Generate a client certificate [#generate-a-client-certificate] Any tooling that produces a PEM certificate meeting the [requirements](#how-it-works) works. With OpenSSL, generate the private key and a certificate signing request (CSR) on the machine that will call the API, then sign the CSR with your CA. ```bash # On the client: an ECDSA P-256 private key, which never leaves this machine openssl ecparam -name prime256v1 -genkey -noout -out client.key # A certificate signing request for it openssl req -new -key client.key \ -subj "/CN=payments-api-client/O=Example Ltd" \ -out client.csr ``` ```bash # On your CA: client certificate extensions cat > client.ext <<'EOF' basicConstraints = critical, CA:FALSE keyUsage = critical, digitalSignature extendedKeyUsage = clientAuth EOF # Sign the CSR with your CA's certificate and key, valid for one year openssl x509 -req -in client.csr \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -days 365 -sha256 -extfile client.ext \ -out client.crt ``` ```bash # It chains to your CA openssl verify -CAfile ca.crt client.crt # Its SHA-256 fingerprint, as Copy fingerprint on the Client certificates card gives it openssl x509 -in client.crt -noout -fingerprint -sha256 # Its dates openssl x509 -in client.crt -noout -dates ``` Paste the contents of `client.crt`, from `-----BEGIN CERTIFICATE-----` to `-----END CERTIFICATE-----`, into **Add a client certificate**. Keep `client.key` on the client. If you don't have a CA yet, you can create one for testing with `openssl req -x509 -newkey rsa:3072 -sha256 -days 1825 -nodes -keyout ca.key -out ca.crt -subj "/CN=Example API client CA" -addext "basicConstraints=critical,CA:TRUE" -addext "keyUsage=critical,keyCertSign,cRLSign"`. For live traffic, use your organization's own CA and keep its private key offline. ## Call the API [#call-the-api] Pass the certificate and its private key to your HTTP client alongside your API key. Include `$MERCHANT_ID` as the Basic auth username only if your live key covers multiple workspaces (leave the username empty for sandbox or single-workspace keys). This example uses [Retrieve a charge](/api-reference/endpoints/charges/get-charge): ```bash curl https://api.pay.com/v1/charges/$CHARGE_ID \ --cert client.crt \ --key client.key \ -u "$MERCHANT_ID:$PAY_COM_API_KEY" ``` Without a certificate: ```json { "error": { "type": "invalid_request_error", "code": "client_certificate_required", "message": "This API key requires a client certificate." } } ``` Status: `403 Forbidden`. ## Rotate certificates [#rotate-certificates] Pay.com doesn't email you before a certificate expires. The lists show each certificate's expiration date and mark those expiring within 30 days, so plan renewals yourself. Rotate by overlap, using the second slot: 1. Issue a new client certificate from the same CA. 2. Add it to the key. The key now has two active certificates, and calls with either are accepted. 3. Move every client to the new certificate. 4. Archive the old certificate on the key's **Client certificates** card. 1. Add the new CA under **Certificate authorities**. You can have two active at the same time. 2. Issue client certificates from the new CA and add them to each key. 3. Move every client to the new certificates. 4. Archive the old CA. Archiving a CA also archives every client certificate it signed, so keys that require a certificate refuse calls that present one of them. While **Require a client certificate** is on, a key's last active certificate can't be archived on its own. Add another certificate first, or turn the requirement off. Archiving its certificate authority still archives it. If a key that requires a certificate has no active certificate that's still valid, its page says **Calls with this key are refused**. ## Errors [#errors] When a key requires a client certificate, Pay.com refuses calls without an accepted one with `403 Forbidden` and `type` `invalid_request_error`. | `code` | `message` | What to do | | :-------------------------------- | :---------------------------------------------------------------------- | :---------------------------------------------------------------------- | | `client_certificate_required` | `This API key requires a client certificate.` | Configure your client to present the certificate and its private key. | | `client_certificate_not_accepted` | `This certificate isn't one of this API key's active certificates.` | Add the certificate to this key, or present one that's on it. | | `client_certificate_expired` | `This certificate expired on 2026-12-02.` (its expiration date, in UTC) | Issue a new certificate, add it to the key, and move your client to it. | Other refusals for the key are listed under [Manage API keys](/developer-resources/authentication/scoped-api-keys#errors). # Authentication (/developer-resources/authentication) Every request to the Pay.com API is authenticated with a secret API key, sent over HTTPS with HTTP Basic auth. The key is the password, and the username stays empty. Your API key identifies your organization, so keep it on your servers and never expose it to browsers, mobile apps, or source control. Each key works in one environment. A sandbox key (`sk-pay-com-sandbox-…`) works with `https://api.sandbox.pay.com/v1`, and a live key (`sk-pay-com-live-…`) with `https://api.pay.com/v1`. To create a key and keep it safe, see [API keys](/get-started/api-keys). ## Make an authenticated request [#make-an-authenticated-request] Send the key as the Basic auth password, with an empty username. This example creates a [payment session](/api-reference/endpoints/paymentsessions/create-ps) in the sandbox: ```bash curl https://api.sandbox.pay.com/v1/sessions/payment \ -u ":$PAY_COM_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "amount": 2000, "currency": "usd", "customer_reference_id": "cust_ext_abc123", "payment_method_types": ["card"] }' ``` ```js const response = await fetch('https://api.sandbox.pay.com/v1/sessions/payment', { method: 'POST', headers: { // Basic auth: an empty username, then ":", then the key, in base64. Authorization: `Basic ${Buffer.from(`:${process.env.PAY_COM_API_KEY}`).toString('base64')}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ amount: 2000, currency: 'usd', customer_reference_id: 'cust_ext_abc123', payment_method_types: ['card'], }), }); ``` ```python import os import requests response = requests.post( "https://api.sandbox.pay.com/v1/sessions/payment", auth=("", os.environ["PAY_COM_API_KEY"]), json={ "amount": 2000, "currency": "usd", "customer_reference_id": "cust_ext_abc123", "payment_method_types": ["card"], }, ) ``` ```json title="Response" { "id": "ps_217940156986951680", "resource": "payment_session", "amount": 2000, "currency": "usd", "client_secret": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "status": "open" } ``` The response is shortened. See [Create a payment session](/api-reference/endpoints/paymentsessions/create-ps) for every field. ### Live keys for several workspaces [#live-keys-for-several-workspaces] Every sandbox key, and any key for one chosen workspace, leaves the username empty. With a live key that serves several workspaces, or all of them, each request names its workspace. Put that workspace's merchant ID in the username. ```bash curl https://api.pay.com/v1/charges/$CHARGE_ID \ -u "$MERCHANT_ID:$PAY_COM_API_KEY" ``` To move to live, change the base URL to `https://api.pay.com/v1` and use your live key. Nothing else about authentication changes. See [Go live](/get-started/go-live). ## Authentication errors [#authentication-errors] When Pay.com can't authenticate a request, it responds with an HTTP error and the standard [error object](/api-reference/get-started/errors#error-response-format). The request isn't processed. | Status | When it happens | What to do | | :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------- | | `400 Bad Request` | The `x-paycom-merchant-id` header and the Basic auth username name different workspaces (`merchant_conflict`). | Send one of them. | | `401 Unauthorized` | The key is missing, isn't recognized (for example, it's mistyped or belongs to the other environment), or has stopped working. | Check that the key is the Basic auth password and that its prefix matches the base URL. | | `403 Forbidden` | The key is recognized but isn't allowed to make this request. It's disabled, or its permissions, network access, or workspaces don't cover the request. | Read `error.code`. See [the key errors](/developer-resources/authentication/scoped-api-keys#errors). | ```bash # A sandbox key sent to the live URL curl https://api.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H 'Content-Type: application/json' \ -d '{ "amount": 2000, "currency": "usd" }' ``` ```json { "error": { "type": "invalid_request_error", "code": "invalid_key", "message": "Invalid API key provided" } } ``` Status: `401 Unauthorized`. Handle authentication errors by HTTP status. Don't retry a `401` or `403` with the same key. It fails the same way until the key or request changes. ## Browsers and mobile apps [#browsers-and-mobile-apps] Your customers' devices never need your API key. To take payments in the browser with [Pay.com.js](/sdks/pay-com-js), your server creates a session with its API key, for example with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) or [`POST /v1/sessions/tokenization`](/api-reference/endpoints/tokenizationsessions/create-tokenization-session). It then passes only the session's `id` and short-lived `client_secret` to the browser, where Pay.com.js uses them. # Keyless access (/developer-resources/authentication/keyless-access) Keyless access lets a workload, such as a GitHub Actions job, an AWS role, a Google Cloud service account, or a Kubernetes pod, call the Pay.com API without a stored API key. The workload gets a short-lived OpenID Connect (OIDC) token from the platform it runs on, exchanges it with Pay.com for a short-lived Pay.com access token, and calls the API with that. There's no long-lived secret to store, leak, or rotate. The exchange follows the JWT bearer grant of [RFC 7523](https://www.rfc-editor.org/rfc/rfc7523). ## How it works [#how-it-works] Your workload exchanges a token from its identity provider for a short-lived Pay.com access token, then calls the API with that token. You set up three things in Pay.com: | Object | ID prefix | What it is | | :-------------- | :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Issuer | `wli_` | A token signer your organization trusts, such as GitHub Actions or your Kubernetes cluster. One per issuer URL. | | Rule | `wlr_` | Which of the issuer's tokens are accepted: the subject, claims, audience, and an optional condition. A rule can also narrow the workspaces. | | Service account | `sva_` | What the Pay.com tokens act as. It carries what an API key does: workspaces, [permissions](/developer-resources/authentication/scoped-api-keys#permissions), and [network access](/developer-resources/authentication/scoped-api-keys#network-access). | ## Set up a workload [#set-up-a-workload] Owners and Payments admins connect workloads, in Organization or in the Pay.com dashboard. Go to **Developers** → **Keyless access** and select **Connect a workload**. In the Pay.com dashboard, the rule and a new service account are for the open workspace. The setup has four steps. ### Issuer [#issuer] Choose where your workload runs: **GitHub Actions**, **AWS** (EC2, Lambda, EKS through STS), **Google Cloud**, **Microsoft Entra**, **Kubernetes** (EKS and self-managed clusters), or **Custom OIDC**. Reuse an issuer your organization already trusts, or connect a new one. For AWS, the step says: "AWS workloads get their tokens from STS. Turn on outbound identity federation for the account, then enter the account’s issuer URL. For a pod’s own service account token on EKS, choose Kubernetes." See the AWS tab under [Get a workload token](#get-a-workload-token). The issuer URL depends on the provider. | Provider | Issuer URL | | :--------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | | GitHub Actions | `https://token.actions.githubusercontent.com`, filled in for you | | Google Cloud | `https://accounts.google.com`, filled in for you | | Microsoft Entra | Built from your directory (tenant) ID, using v1 (`https://sts.windows.net//`, the default) or v2.0 (`https://login.microsoftonline.com//v2.0`) | | AWS, Kubernetes, Custom OIDC | Typed by you, exactly as your tokens' `iss` claim has it | For an issuer you type, choose how Pay.com gets its signing keys: * **Discovery**: Pay.com reads the issuer's `/.well-known/openid-configuration`. * **JWKS URL**: Pay.com fetches the keys from an address you give. * **Paste keys**: for issuers the internet can't reach. Paste the issuer's JSON Web Key Set, and paste new keys when the issuer rotates them. Pay.com fetches only from `https` addresses with a public hostname, on port 443, and doesn't follow redirects. Fetched keys are refreshed regularly, and fetched again when a token names a key Pay.com doesn't have yet. For Microsoft Entra and the issuers you type, set **Longest token accepted**: 1 hour (the default), 2 hours, or 24 hours. Microsoft Entra issuers start at 24 hours, which managed identities need. GitHub Actions and Google Cloud issuers start at 1 hour, and you can change any issuer's on its page. Pay.com refuses workload tokens that last longer. ### Rule [#rule] Name the rule (lowercase letters, numbers, and hyphens) and fill in the provider's match conditions: | Provider | You enter | Pay.com matches | | :-------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | GitHub Actions | GitHub organization. Optionally, a repository, a branch or ref, and the organization's numeric ID. | `repository_owner`, and `repository`, `ref`, and `repository_owner_id` when given. **Allowed events** defaults to push only (`event_name` `push`), which keeps fork pull-request runs from matching. | | Google Cloud | Service account email and its 21-digit unique ID, and optionally the project ID | `sub` equals the unique ID | | Kubernetes | Namespace and service account | `sub` equals `system:serviceaccount::` | | AWS | IAM role ARN, with **I’ve allowed this role to call sts:GetWebIdentityToken** selected | `sub` equals the role ARN | | Microsoft Entra | Managed identity object ID, audience (your app registration's client ID, formatted as `api://` for v1 tokens or the bare GUID for v2.0), and optionally the calling app's client ID for a service principal | `oid` and `sub` equal the object ID, `tid` equals the tenant, `aud` equals the audience, and `appid` (v1) or `azp` (v2.0) equals the client ID when given | | Custom OIDC | Subject and audience | `sub` exactly, or as a prefix when it ends in `*` | The audience defaults to the environment's API host (without `/v1`) for every provider except Microsoft Entra: `https://api.pay.com` for live, and `https://api.sandbox.pay.com` for the sandbox. A token's `aud` claim must equal this URL, or contain it when `aud` is a list. **Advanced match options** replace the provider's fields when you use them: * **Subject pattern**: the `sub` claim exactly, or a prefix ending in `*`. * **Claims**: up to 20 top-level claims, each equal to its value as text, so a claim whose value is a number or `true`/`false` doesn't match. Use a condition for those. `iss`, `aud`, `exp`, `iat`, `nbf`, and `jti` can't be used, because Pay.com checks those itself. * **Expected audience**: leave blank for Pay.com's. * **CEL condition**: a [Common Expression Language](https://cel.dev) expression over the verified claims that must be true, such as `claims.environment == "live"`. `matches()`, `cel.bind()`, `map()`, and list macros inside other list macros aren't supported. A rule must name its workload with a subject, a claim, or a condition. The audience alone isn't enough, since every workload of the issuer can ask for it, and neither is a subject of `*`. Under **Enable in workspaces**, choose **All workspaces, including future ones** or chosen workspaces. ### Service account [#service-account] Choose an existing service account or create one. A new one is set up like an API key, with workspaces, permissions, and network access. Tokens from this rule act as the service account. Set how this rule's Pay.com tokens behave (you can change them later on the rule's page): * **Token lifetime**: 1, 5, 10 (the default), 15, or 30 minutes, or 1 hour. * **Single-use tokens**: each workload token can be exchanged once. If you turn this off, a stolen workload token can be exchanged again until it expires. ### Test [#test] Select **Create and test** and confirm it's you. Pay.com creates the issuer, the rule, and the service account, then waits 15 minutes for your workload's first exchange. The step shows **Connected** with the time and source address, **Failed** with the reason, or **Nothing arrived in 15 minutes**. You can leave the page and test again from the rule's page. **Verify issuer**, before you create, optionally checks that Pay.com can read the issuer's keys. The Test step shows an example token request with your rule ID and organization ID filled in. ## Get a workload token [#get-a-workload-token] Request a token with the audience your rule expects: the environment's API host (without `/v1`) unless you configured a custom audience, or your app registration's client ID for Microsoft Entra. The examples below use the live audience, `https://api.pay.com`. The job needs the `id-token: write` permission. GitHub then gives it `ACTIONS_ID_TOKEN_REQUEST_URL` and `ACTIONS_ID_TOKEN_REQUEST_TOKEN`, which it uses to request a token for Pay.com's audience: ```yaml jobs: reconcile: runs-on: ubuntu-latest permissions: id-token: write contents: read steps: - name: Get a GitHub OIDC token for Pay.com run: | ID_TOKEN=$(curl -sS \ -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://api.pay.com" | jq -r .value) echo "::add-mask::$ID_TOKEN" echo "ID_TOKEN=$ID_TOKEN" >> "$GITHUB_ENV" ``` The token's issuer is `https://token.actions.githubusercontent.com`. Its `repository_owner`, `repository_owner_id`, `repository`, `ref`, and `event_name` claims are what the GitHub Actions rule matches. Use AWS STS outbound identity federation. Turn it on once for the account, and use the account's issuer URL as the Pay.com issuer: ```bash aws iam enable-outbound-web-identity-federation aws iam get-outbound-web-identity-federation-info ``` Allow `sts:GetWebIdentityToken` in the permissions policy of the role that runs your workload. It's a permissions-policy action, not a trust policy. The rule's **I’ve allowed this role to call sts:GetWebIdentityToken** box asks you to confirm it. Then request a token from a regional STS endpoint: ```bash ID_TOKEN=$(aws sts get-web-identity-token \ --region us-east-1 \ --endpoint-url https://sts.us-east-1.amazonaws.com \ --audience https://api.pay.com \ --signing-algorithm RS256 \ --duration-seconds 300 \ --query WebIdentityToken --output text) ``` The token's `sub` is the role's ARN, such as `arn:aws:iam::123456789012:role/payments`, which the AWS rule matches. On Amazon EKS, a pod with an IAM role can get a token from STS as above. To use the pod's own service account token instead, choose **Kubernetes**, not AWS, when you connect it, and follow the Kubernetes tab. The cluster's issuer URL is the output of `aws eks describe-cluster --name --query cluster.identity.oidc.issuer --output text`. On Compute Engine, Cloud Run, GKE, and other Google Cloud runtimes, ask the metadata server for an identity token with Pay.com's audience: ```bash ID_TOKEN=$(curl -sS -H "Metadata-Flavor: Google" \ "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=https://api.pay.com") ``` The token's issuer is `https://accounts.google.com` and its `sub` is the service account's unique ID, which the Google Cloud rule matches. Google identity tokens last 1 hour. Mount a projected service account token with Pay.com's audience. The kubelet refreshes the file before it expires, so read it on each exchange. ```yaml apiVersion: v1 kind: Pod metadata: name: payments-worker namespace: payments spec: serviceAccountName: payments-worker containers: - name: app image: registry.example.com/payments-worker:1.0 volumeMounts: - name: pay-com-token mountPath: /var/run/secrets/pay-com readOnly: true volumes: - name: pay-com-token projected: sources: - serviceAccountToken: path: token audience: https://api.pay.com expirationSeconds: 3600 ``` ```bash ID_TOKEN=$(cat /var/run/secrets/pay-com/token) ``` Keep `expirationSeconds` within the issuer's **Longest token accepted**. The token's `sub` is `system:serviceaccount:payments:payments-worker`. The cluster's issuer URL is the `issuer` in `kubectl get --raw /.well-known/openid-configuration`. If the internet can't reach it, choose **Paste keys** and paste the output of `kubectl get --raw /openid/v1/jwks`. ### What Pay.com checks [#what-paycom-checks] The workload token must be a signed JWT that: * Is at most 16 KB, and is signed with an asymmetric algorithm (`RS256`, `RS384`, `RS512`, `PS256`, `PS384`, `PS512`, `ES256`, `ES384`, `ES512`, or `EdDSA`) by a key the issuer publishes, named by a `kid` header. * Has an `iss` exactly equal to the issuer URL. * Has an `exp`, and an `iat` or `nbf`, and hasn't expired. Pay.com allows 30 seconds of clock skew. * Lasts no longer than the issuer's longest token accepted, from `iat` (or `nbf`) to `exp`. * Matches the rule: subject, claims, audience, and condition. * Hasn't been exchanged before, when the rule has single-use tokens. Pay.com tracks this by `jti`, or by the whole token when it has no `jti`. ## Exchange it for a Pay.com token [#exchange-it-for-a-paycom-token] Send the workload token to the token endpoint as a form-encoded `POST`. | Field | Required | Value | | :------------------- | :------- | :---------------------------------------------------------------------------- | | `grant_type` | Yes | `urn:ietf:params:oauth:grant-type:jwt-bearer` | | `assertion` | Yes | The workload token | | `rule_id` | Yes | The rule's ID, `wlr_...` | | `organization_id` | Yes | Your organization's ID, `org_...` | | `service_account_id` | No | The rule's service account, `sva_...`. If you send it, it must be the rule's. | ```bash curl https://api.pay.com/v1/oauth/token \ -d grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer \ -d assertion="$ID_TOKEN" \ -d rule_id="$PAY_COM_RULE_ID" \ -d organization_id="$PAY_COM_ORGANIZATION_ID" ``` ```json { "access_token": "at-pay-com-live-<95 letters and digits>", "token_type": "Bearer", "expires_in": 600 } ``` Status: `200 OK`, with `Cache-Control: no-store`. `expires_in` is in seconds. It's the rule's token lifetime, but never more than twice the time the workload token has left, and never less than 60 seconds. Exchange a new workload token when the Pay.com token expires. ## Call the API [#call-the-api] Send the Pay.com token in the `Authorization` header. Add `x-paycom-merchant-id` with the workspace's merchant ID unless the token reaches only one workspace. ```bash curl https://api.pay.com/v1/charges/$CHARGE_ID \ --header "Authorization: Bearer $PAY_COM_TOKEN" \ --header "x-paycom-merchant-id: $MERCHANT_ID" ``` With an expired token: ```json { "error": { "type": "invalid_request_error", "code": "invalid_token", "message": "The access token is unknown or has expired. Exchange a new one." } } ``` Status: `401 Unauthorized`. The request is then checked like an API key's, against the service account's network access and permissions, in the workspaces both the rule and the service account reach. See [Retrieve a charge](/api-reference/endpoints/charges/get-charge) for the endpoint above. Archiving a rule, its issuer, or its service account stops the tokens it handed out within a minute. Archiving an issuer archives its rules. ## Errors [#errors] Errors come from the token endpoint, or from the API calls you make with a Pay.com token. ### Token endpoint [#token-endpoint] Token endpoint errors follow [RFC 6749](https://www.rfc-editor.org/rfc/rfc6749#section-5.2), with `error` and `error_description`: ```json { "error": "invalid_grant", "error_description": "The token has expired. Get a new one from its issuer." } ``` | Status | `error` | `error_description` | | :----- | :------------------------ | :------------------------------------------------------------------------------------------ | | `400` | `invalid_request` | `grant_type is required.`, or the same for `assertion`, `rule_id`, or `organization_id` | | `400` | `invalid_request` | `Send the fields as application/x-www-form-urlencoded.` | | `400` | `invalid_request` | ` is given more than once.` | | `400` | `invalid_request` | `The request is too large.` (over 24 KB) | | `400` | `unsupported_grant_type` | `grant_type must be urn:ietf:params:oauth:grant-type:jwt-bearer.` | | `400` | `invalid_grant` | `There's no active rule with this id in this organization.` | | `400` | `invalid_grant` | `The service account isn't this rule's.` | | `400` | `invalid_grant` | `The token's claims don't match the rule's conditions.` | | `400` | `invalid_grant` | `The token has expired. Get a new one from its issuer.` | | `400` | `invalid_grant` | `The token was already exchanged, and this rule takes each token once.` | | `400` | `invalid_grant` | `Pay.com couldn't get the issuer's keys. Try again in a few minutes.` | | `400` | `invalid_grant` | `The token's issuer isn't the one this rule trusts.` | | `400` | `invalid_grant` | `The token wasn't signed by a key the issuer publishes.` | | `400` | `invalid_grant` | `The token lasts longer than this issuer accepts: at most 1 hour.` (the issuer's own limit) | | `400` | `invalid_grant` | `The rule's service account is archived.` | | `400` | `invalid_grant` | `The token couldn't be read as a signed JWT.` | | `503` | `temporarily_unavailable` | `Try again in a moment.` The response has a `Retry-After: 5` header. | Non-`POST` requests return `405 Method Not Allowed` with `invalid_request` and `Use POST.`. While you set up a rule, its Test step shows why an exchange under it failed. Errors about the request format, the rule ID, or the service account ID appear only in the HTTP response. ### API calls [#api-calls] A Pay.com token that's unknown, expired, or from an archived rule, issuer, or service account is refused with `401 invalid_token`. Other refusals are the same as for an API key. See [Manage API keys](/developer-resources/authentication/scoped-api-keys#errors). # Manage API keys (/developer-resources/authentication/scoped-api-keys) An API key belongs to your organization rather than to a single workspace. For each key you choose which workspaces it reaches, what it may do with each API resource, and which networks it may be used from. A key can be rolled to a new secret while the old one keeps working for a time you choose. ## Key format [#key-format] A key's secret is its environment's prefix followed by 95 letters and digits (`A` to `Z`, `a` to `z`, `0` to `9`): ```text sk-pay-com-sandbox-<95 letters and digits> sk-pay-com-live-<95 letters and digits> ``` * A sandbox key works only on `https://api.sandbox.pay.com/v1`, and a live key only on `https://api.pay.com/v1`. * The secret is shown once, when you create or roll the key. Pay.com keeps only a digest of it and its last six characters, which the pages show as `sk-pay-com-live-…7Qk2Xa`. * A key that starts with `sk-pay-com-` but doesn't have exactly this shape is refused with `401 invalid_key`. ## Who can manage keys [#who-can-manage-keys] You manage keys in Organization or in the Pay.com dashboard, depending on your role. | Where | Who | What they can do | | :---------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Organization** (`login.pay.com`), **Developers** → **API keys** | Owners and Payments admins of the organization | Create keys for all workspaces or chosen ones, and manage every key | | Pay.com dashboard, **Developers** → **API keys** | Owners and Payments admins, and anyone whose role has the `edit_api_keys` permission on the open workspace | Create keys for the open workspace. Owners and Payments admins change any key shown there. Others change only keys whose workspaces all give them `edit_api_keys`, never a key for all workspaces. | Creating, saving, rolling, enabling, and deleting a key, and saving a policy that keys use, ask you to **Confirm it’s you**. In Organization, this prompt appears unless you signed in with a strong method in the last 5 minutes. In the Pay.com dashboard, it appears every time. Disabling a key and **End it now** don't ask. ## Create a key [#create-a-key] Each key gets a name, workspaces, permissions, and, for a live key, network access. ### Start a new key [#start-a-new-key] Go to **Developers** → **API keys** and select **Create an API key**. ### Name it [#name-it] Give the key a name of up to 60 characters. Names are unique in your organization, ignoring case. ### Choose its workspaces [#choose-its-workspaces] Choose **All workspaces** (including ones added later) or **Chosen workspaces**. A key made in the Pay.com dashboard is for the open workspace. ### Set its permissions [#set-its-permissions] Set each resource to **None**, **Read**, or **Write**. A key needs at least one permission. See [Permissions](#permissions). ### Choose its network access [#choose-its-network-access] For a live key, choose **A policy**, **IP addresses**, or **Any network**. Every live key needs one, and there's no default. Sandbox keys skip this step. See [Network access](#network-access). ### Create it and copy the secret [#create-it-and-copy-the-secret] Select **Create key**, then confirm it's you. Copy the secret from the **Copy your API key** dialog. You won't see it again after you close it. ## Permissions [#permissions] Each resource has a level: * **None**: the key can't call the resource. * **Read**: `GET` requests. * **Write**: `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` requests. A resource offers only the levels that apply to it. One with only read endpoints offers None and Read, and one with a single `POST` endpoint offers None and Write. A request the key's levels don't allow is refused with `403 resource_not_allowed`. Each resource covers these paths, under `/v1`. Groups and resources are named as the key form shows them. Actions follow the resource they act on. For example, [`POST /v1/charges/{id}/refunds`](/api-reference/endpoints/charges/create-refunds) needs Write on Charges. A path that belongs to two resources, such as `/v1/sessions/payment/{id}/attempts`, is allowed when either resource allows the method. | Group | Resource | Levels | Paths | | :------------------------- | :---------------------------------- | :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Core** | Charges | None, Read, Write | `/charges`, `/charges/{id}` and its actions, `/charges/reference/{reference}`, `/transaction_status/{id}` | | **Core** | Holds | None, Read, Write | `/holds`, `/holds/{id}` and its actions, `/holds/reference/{reference}` | | **Core** | Refunds | None, Read, Write | `/refunds`, `/refunds/{id}`, `/refunds/reference/{reference}` | | **Core** | Payouts | None, Read, Write | `/payouts`, `/payouts/{id}` and its actions, `/payouts/reference/{reference}` | | **Core** | Customers | None, Read, Write | `/customers`, `/customers/{id}`, `/customers/{id}/payment_methods`, `/customers/{id}/underlying_identifiers_map` | | **Core** | Authentication sessions | None, Read, Write | `/sessions/authentication/{id}` | | **Core** | Independent authentication sessions | None, Read, Write | `/authentication/session/independent`, `/authentication/{id}`, `/authentication/{id}/submit` | | **Core** | Tax quotes | None, Read, Write | `/tax_quotes`, `/tax_quotes/{id}` | | **Web SDK** | Payment sessions | None, Read, Write | `/sessions/payment`, `/sessions/payment/{id}` and its actions | | **Web SDK** | Setup sessions | None, Read, Write | `/sessions/setup`, `/sessions/setup/{id}` | | **Web SDK** | Setup attempts | None, Read | `/attempts/setup`, `/attempts/setup/{id}`, `/sessions/setup/{id}/attempts` | | **Web SDK** | Payment attempts | None, Read | `/attempts/payment`, `/attempts/payment/{id}`, `/sessions/payment/{id}/attempts` | | **Web SDK** | Tokenization sessions | None, Write | `/sessions/tokenization` | | **Payment methods** | Payment methods | None, Read, Write | `/payment_methods`, `/payment_methods/{id}` and its actions | | **Payment methods** | Payment method domains | None, Read, Write | `/payment_method_domains`, `/payment_method_domains/register`, `/payment_method_domains/unregister` | | **Payment methods** | Apple Pay sessions | None, Write | `/sessions/applepay` | | **Payment methods** | Tokens | None, Read | `/tokens/{id}` | | **Risk, disputes & fraud** | Risk | None, Read, Write | `/risk/assessments`, `/risk/review/{id}`, `/risk/review/reference/{reference}` | | **Risk, disputes & fraud** | Fraud warnings | None, Read | `/fraud_warnings`, `/fraud_warnings/{id}` | | **Risk, disputes & fraud** | Value lists | None, Read, Write | `/value_lists`, `/value_lists/card_blacklist`, `/value_lists/{id}`, `/value_lists/{id}/items`, `/value_lists/{id}/items/{item_id}` | | **Risk, disputes & fraud** | Customer block reviews | None, Read, Write | `/customer_block_reviews`, `/customer_block_reviews/{id}/snooze` and `/exclude`, `/customer_block_reviews/rule/{id}` and below, `/customer_block_reviews/customer/{id}` | | **Risk, disputes & fraud** | Disputes | None, Read, Write | `/disputes`, `/disputes/{id}` and its actions | | **Risk, disputes & fraud** | Collaborations | None, Read, Write | `/collaborations`, `/collaborations/{id}`, `/collaborations/{id}/refund` and `/ignore` | | **Risk, disputes & fraud** | Documents | None, Read, Write | `/documents`, `/documents/{id}`, `/documents/{id}/contents`, `/documents/{id}/upload` | | **Financial reporting** | Settlements | None, Read | `/settlements`, `/settlements/{id}`, `/settlements/{id}/breakdown` | | **Financial reporting** | Adjustments | None, Read | `/adjustments`, `/adjustments/{id}` | | **Financial reporting** | Reconciliation | None, Read | `/reconciliation/transactions` | | **Financial reporting** | Cash flow | None, Read | `/cashflow/balances`, `/cashflow/transactions`, `/cashflow/transactions/{id}` | | **Financial reporting** | Exchange rates | None, Read, Write | `/exchange_rates`, `/exchange_rates/calculate`, `/exchange_rates/charge/{id}` | | **Configuration** | Merchants | None, Read, Write | `/merchants/current/payment_method_options` | | **Configuration** | Configuration sets | None, Read, Write | `/configuration_sets/default/payment_methods` | | **Configuration** | Webhook endpoints | None, Read, Write | `/webhook_endpoints`, `/webhook_endpoints/{id}` | ### Commerce resources [#commerce-resources] The [Commerce API](/commerce/commerce-api)'s resources take the same levels. Checkouts, Payment links, and Subscriptions keep the levels your keys already give them, and Checkouts gains Read. Prices replace subscription packages. The resources Commerce adds start at None on existing keys. To read refunds created by [`POST /v1/orders/{id}/refund`](/api-reference/commerce/orders/refund-order) or [`POST /v1/invoices/{id}/refund`](/api-reference/commerce/invoices/refund-invoice), grant **Read** on **Refunds**. Listing an order's refunds with [`GET /v1/orders/{id}/refunds`](/api-reference/commerce/orders/list-order-refunds) takes **Read** on **Orders**. | Group | Resource | Levels | Paths | | :---------------------- | :-------------------- | :---------------- | :--------------------------------------------------------------------------------------------- | | **Checkout** | Checkouts | None, Read, Write | `/checkout`, `/checkout/{id}` and its actions | | **Checkout** | Payment links | None, Read, Write | `/payment_links`, `/payment_links/{id}` | | **Checkout** | Customer claims | None, Write | `/customer_claims` | | **Checkout** | Shipping rates | None, Read, Write | `/shipping_rates`, `/shipping_rates/{id}` | | **Checkout** | Design profiles | None, Read, Write | `/design_profiles`, `/design_profiles/{id}` and its actions, `/design_profile_previews` (Read) | | **Catalog** | Products | None, Read, Write | `/products`, `/products/{id}` | | **Catalog** | Prices | None, Read, Write | `/prices`, `/prices/{id}` | | **Orders** | Orders | None, Read, Write | `/orders`, `/orders/{id}`, `/orders/{id}/refund`, `/orders/{id}/refunds` | | **Orders** | Invoices | None, Read, Write | `/invoices`, `/invoices/{id}`, `/invoices/{id}/tax`, `/invoices/{id}/refund` | | **Orders** | Credit notes | None, Read | `/credit_notes`, `/credit_notes/{id}` | | **Orders** | Commerce settings | None, Read, Write | `/commerce_settings` | | **Subscriptions** | Subscriptions | None, Read, Write | `/subscriptions`, `/subscriptions/{id}` and its actions | | **Subscriptions** | Subscription settings | None, Read, Write | `/subscription_settings`, `/subscription_connections` and its actions | | **Subscriptions** | Portal sessions | None, Write | `/portal_sessions` | | **Subscriptions** | Entitlements | None, Read | `/entitlements` | | **Financial reporting** | Report runs | None, Read, Write | `/report_runs`, `/report_runs/{id}` | | **Financial reporting** | Insights | None, Read | `/insights` | ## Network access [#network-access] Each live key allows requests from one of these. Sandbox keys have no network access setting. | Choice | What it allows | | :--------------- | :----------------------------------------------------------------------------------------------------------------------------- | | **A policy** | The networks a saved network access policy allows. Several keys can share one policy. | | **IP addresses** | Up to 100 IPv4 and IPv6 addresses or CIDR ranges (such as `192.0.2.0/24` or `2001:db8::/32`), entered one per line on the key. | | **Any network** | Every network. Available only once Pay.com has allowed it for your organization. | Manage policies under **Developers** → **Network access policies**. A policy is one of two types: * **IP addresses**: up to 100 IPv4 and IPv6 addresses or ranges. * **Advanced**: autonomous system numbers (ASNs, such as `16509`), countries, and denying Tor exit nodes. Every part you set must hold. A request whose ASN or country Pay.com can't determine passes only an Advanced policy that doesn't set that part. While Any network isn't allowed for your organization, IP addresses that together cover every public IPv4 or IPv6 address are refused too, on a key or in a policy. A `/0` range is never accepted, even where Any network is allowed. A key already on Any network keeps it if Pay.com stops allowing it, until you change its network access. To ask for Any network, contact Pay.com support. A request from a network the key doesn't allow is refused with `403 network_not_allowed`. ## PCI compliant keys [#pci-compliant-keys] A request that sends raw card details needs a key marked **PCI compliant**, and is otherwise refused with `403 pci_required`. The **PCI compliant** switch appears only when every workspace the key is for is one Pay.com has enabled for PCI compliant keys. A key for all workspaces can't be PCI compliant. ## Send the key [#send-the-key] Send the key with HTTP Basic auth, with the key as the password. ### Choose the workspace [#choose-the-workspace] Every sandbox key, and any key for one chosen workspace, leaves the username empty. With a live key for several workspaces, or for all of them, each request names its workspace with the workspace's merchant ID as the username. The same ID with an `mct_` or `res_` prefix names the same workspace. ```bash curl https://api.sandbox.pay.com/v1/charges/$CHARGE_ID \ -u ":$PAY_COM_API_KEY" ``` ```bash # A live key for several workspaces: the workspace's merchant ID is the username. curl https://api.pay.com/v1/charges/$CHARGE_ID \ -u "$MERCHANT_ID:$PAY_COM_API_KEY" ``` A live key for several workspaces, sent with an empty username: ```json { "error": { "type": "invalid_request_error", "code": "merchant_required", "message": "The x-paycom-merchant-id header or the Basic authentication username should be provided" } } ``` Status: `403 Forbidden`. See [Retrieve a charge](/api-reference/endpoints/charges/get-charge) for the endpoint used above. ## Roll a key [#roll-a-key] Rolling gives a key a new secret and keeps its name, workspaces, permissions, and network access. ### Roll it [#roll-it] On the key's page, select **Roll key**. ### Choose when the old secret stops [#choose-when-the-old-secret-stops] Under **The old key stops working**, choose **Now**, **In 1 hour**, **In 24 hours** (the default), or **In 7 days**. ### Copy the new secret [#copy-the-new-secret] Confirm it's you, then copy the secret from **Copy your new key**. It's shown once. ### Move your servers [#move-your-servers] Deploy the new secret before the old one stops. To stop the old secret early, select **End it now** on the key's page. You can also **Disable** a key, which refuses its requests until you enable it again, or **Delete** it, which refuses them immediately and can't be undone. Disabling, rolling, and deleting reach every Pay.com server within 30 seconds. An old secret you keep for 1 hour, 24 hours, or 7 days stops at exactly that time. **Now** and **End it now** take up to 30 seconds. ## Errors [#errors] A refused request gets the standard [error object](/api-reference/get-started/errors#error-response-format), with `type` `invalid_request_error` (`api_error` for `503`). Pay.com checks the key, its organization and status, its client certificate, the network, the permission, and then the workspace, and returns the first refusal. A request with card details is then checked for PCI compliance. A header and a Basic username that name different workspaces are refused before anything else. | Status | `code` | `message` | | :----- | :--------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------- | | `400` | `merchant_conflict` | `The x-paycom-merchant-id header and the Basic authentication username name different workspaces. Send one of them.` | | `401` | `invalid_key` | `Invalid API key provided` | | `403` | `organization_inactive` | `The API key’s organization isn’t active.` | | `403` | `key_disabled` | `API Key is not enabled` | | `403` | `client_certificate_required`, `client_certificate_not_accepted`, `client_certificate_expired` | See [Client certificates](/developer-resources/authentication/client-certificates#errors). | | `403` | `network_not_allowed` | `The API key doesn’t allow requests from this network.` | | `403` | `resource_not_allowed` | `API key does not have access permission to the requested resource.` | | `403` | `pci_required` | `API key does not have PCI compliant permissions.` | | `403` | `merchant_required` | `The x-paycom-merchant-id header or the Basic authentication username should be provided` | | `403` | `merchant_not_allowed` | `API key does not have access to the requested merchant.` | | `503` | `unavailable` | `Try again in a moment.` The response has a `Retry-After: 5` header. | ## Move from older API keys [#move-from-older-api-keys] Keys that start with `live_` keep working until a month after the day Pay.com gives notice. They stop at midnight UTC on the same day of the following month, or on that month's last day when it has no such day (a notice on 31 January ends on 28 February). Before then, Pay.com can turn off a workspace's old keys early. ### Find your old keys [#find-your-old-keys] In Organization, go to **Developers** → **API keys**. The **Old API keys** list shows your existing keys, and the day they stop once it's set. It leaves out keys of workspaces Pay.com has turned off. If the list is empty, [create a new key](/get-started/api-keys#create-a-key) with the old key's workspace and permissions, and use it in place of the old one. ### Replace each one [#replace-each-one] Select **Replace with a new key**. **Create an API key** opens with the old key's name, workspace, permissions, network access, and PCI compliant setting filled in (PCI compliant starts off for All workspaces). An old name longer than 60 characters is cut to 60, with **Shortened to 60 characters** under **Name** until you type your own. Check the workspaces, review the form, then create the key. Some settings don't carry over, and the form indicates which: * Resources new keys don't have, such as Batch. * Network access, when the old key allows no network, more than 100 entries, or entries new keys don't take. An old key open to every IPv4 address fills in Any network only where Pay.com has allowed it. ### Update your servers [#update-your-servers] Send the new key with Basic auth, with the key as the password. If the new key is for All workspaces or several workspaces, put the workspace's merchant ID in the username. ### Retire the old key [#retire-the-old-key] The old key's row shows **Replaced by** and the new key once you create it. When your traffic has moved, disable the old key in the Pay.com dashboard (**Roll, disable or delete old keys**). When old keys stop, their requests are refused: | Status | `code` | When | | :----- | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------- | | `401` | `legacy_keys_ended` | After old keys stop everywhere. The message names the environment's old prefix (`live_` on live), says when they stopped, and where to create a new key. | | `401` | `legacy_keys_off` | Pay.com turned off this workspace's old keys (requests that send card details). | ```bash curl https://api.pay.com/v1/charges/$CHARGE_ID \ -u ':live_…' ``` ```json { "error": { "type": "invalid_request_error", "code": "legacy_keys_ended", "message": "API keys that start with live_ stopped working on 12 Dec 2026. Create a key in the Pay.com dashboard (Developers › API keys) or in Organization (Developers › API keys), and use it instead." } } ``` Status: `401 Unauthorized`. The date is an example. # Call the API (/developer-resources/cli/call-the-api) Every API operation has a command named after its resource and action. Successes print the API's JSON to standard output, on one line with `--raw`, and errors print the API's error JSON to standard error. When a retry hid an earlier failure, lines about that failure follow the JSON. Amounts are integers in minor units (for example, `--amount 2000` is $20.00 USD). ```bash title="Terminal" pay charges create --amount 2000 --currency usd --source pm_card_685125127054035968 pay charges retrieve chrg_685125114794084352 pay refunds list --limit 10 ``` `pay --help` lists the resources, `pay charges --help` a resource's commands, and `pay charges create --help` a command's arguments and fields. ## Parameters [#parameters] Pass endpoint parameters as positional arguments, flags, key-value pairs, or raw JSON. * **Path parameters** are arguments, in the path's order. * **Query parameters and body fields** are flags, with dashes for dots and underscores. For example, `created.greater_than` is `--created-greater-than`. Pass object values as JSON strings (for example, `--metadata '{"order_id":"6735"}'`). * **`-d key=value`** sets any field, and dots nest. A value that's valid JSON is sent as JSON, so quote a number that must be a string. * **`--data-json`** passes the full request body inline, from a file with `@`, or from standard input with `-`. Explicit flags override fields set in `--data-json`. ```bash title="Terminal" pay charges create --data-json '{"amount":2000,"currency":"usd"}' --source pm_card_685125127054035968 pay charges create --amount 2000 --currency usd --source pm_card_685125127054035968 -d 'metadata.order_id="6735"' ``` Every command that takes an idempotency key sends a new one. To send your own, use `--idempotency-key`. ## Retries [#retries] A command retries twice by default, and `--max-retries` changes that. `--max-retries 0` turns retries off. Every `PUT` and `PATCH` is retried only after a `429`, or when it never connected. If one of these requests receives no response, check whether it succeeded before running it again. `--timeout` bounds each attempt, one minute by default. ## Page through lists [#page-through-lists] `--all` reads every page and prints the items as one JSON array, for cursor lists and [page lists](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) alike. `--limit-total` stops after that many items, and `--limit` is the size of each page. ```bash title="Terminal" pay charges list --all --limit 100 --customer-reference-id cust_ext_abc123 pay value-lists list --all --limit-total 50 ``` ## Files [#files] The upload's type comes from the file's extension, or `--content-type`. ```bash title="Terminal" pay documents create --filename receipt.pdf --reference order-6735 --content-type application/pdf --content-length 102400 pay documents upload doc_296645958265997322 --file ./receipt.pdf pay documents retrieve-contents doc_296645958265997322 --output document.pdf ``` `--content-length` must be the file's exact size. See [Upload and download files](/developer-resources/upload-and-download-files). ## Raw requests [#raw-requests] `pay get`, `post`, `put`, `patch`, and `delete` take any path under `/v1`. `-d` builds the query for `get` and the body for the others. A full URL is refused and redirects aren't followed, so your key only goes to the API. To upload a file, use `pay documents upload`. ```bash title="Terminal" pay get /charges -d limit=3 pay post /refunds -d charge=chrg_685125114794084352 -d amount_to_refund=500 pay patch /charges/chrg_685125114794084352 -d description="Order 6735" ``` # Forward webhooks (/developer-resources/cli/forward-webhooks) `pay listen` creates a temporary sandbox webhook endpoint while it runs and forwards incoming events to your local server. ## Start forwarding [#start-forwarding] Run `pay listen` with your local webhook handler URL: ```bash title="Terminal" pay listen --forward-to localhost:3000/webhooks ``` It prints a local signing secret, then a line for each event with your server's status. Press Ctrl+C to stop, which deletes the endpoint. ## Verify forwarded events [#verify-forwarded-events] `pay listen` signs each event it forwards with the local secret and the current time. It never changes the body, so your handler [verifies it](/developer-resources/webhooks#verify-webhook-signatures) as it does for live events. The secret stays the same from run to run: ```bash title="Terminal" export PAY_COM_WEBHOOK_SECRET=$(pay listen --print-secret) ``` ## Choose the events [#choose-the-events] Without `--events`, it subscribes to every event an endpoint can have, and the key needs Read on all their resources. With a restricted key, name the events: ```bash title="Terminal" pay listen --forward-to localhost:3000/webhooks --events charge.succeeded,refund.succeeded ``` An event the key can't read is refused with `403 event_type_not_allowed`. The key also needs Write on **Webhook endpoints**. ## One listener at a time [#one-listener-at-a-time] Run one `pay listen` for each machine and profile. A second one deletes the first one's endpoint. If a session exits without cleaning up, the next run deletes the leftover endpoint. # Install and log in (/developer-resources/cli/install-and-log-in) `pay` operates in the sandbox environment only and rejects live API keys. ## Install [#install] Install `pay` with Homebrew or Scoop, or run it in Docker. ```bash brew install pay-com/tap/pay ``` ```bash scoop bucket add pay-com https://github.com/pay-com/scoop-bucket scoop install pay ``` ```bash docker run --rm -e PAY_COM_API_KEY ghcr.io/pay-com/pay charges list ``` Check that it works: ```bash title="Terminal" pay version ``` ## Log in [#log-in] Make a sandbox key under **Developers** → **API keys**, then run: ```bash title="Terminal" pay login ``` `pay` asks for the key without showing it, checks it, and keeps it in your operating system's keychain. There's no flag for the key itself, so it stays out of your shell's history. To remove it, run `pay logout`. A key that works but can't read webhook endpoints is kept, with a warning. A key the API refuses isn't kept. When the key can't be checked, for example without a connection, `--no-verify` keeps it anyway. In a script, pass the key on standard input: ```bash title="Terminal" printf '%s' "$PAY_COM_API_KEY" | pay login --api-key-stdin ``` ## Permissions [#permissions] Give the key the [permissions](/developer-resources/authentication/scoped-api-keys#permissions) of what you'll call with it. For [`pay listen`](/developer-resources/cli/forward-webhooks), that's Write on **Webhook endpoints**, and Read on the resources whose events you forward. ## Use several keys [#use-several-keys] A profile keeps a key and a workspace of its own: ```bash title="Terminal" pay login --profile shop --merchant-id "$MERCHANT_ID" pay charges list --profile shop ``` Use `--merchant-id` with multi-workspace API keys. Without `--profile`, commands use the `default` profile. ## Use it in CI [#use-it-in-ci] Commands use `PAY_COM_API_KEY` when it's set, ahead of any stored key, and store nothing: ```bash title="Terminal" pay charges list --limit 3 ``` `pay login` and `pay listen` keep a secret. Where there's no keychain, set `PAY_COM_CLI_KEYRING=file` to keep it in a file only your user can read. # CLI reference (/developer-resources/cli/reference) Run `pay --help` for a resource's commands, and `pay --help` for one command's arguments and fields. ## Global flags [#global-flags] Every command takes these flags. ## Environment variables [#environment-variables] `pay` reads these variables from the environment. ## Exit codes [#exit-codes] `pay` exits with one of these codes. # Simulate events (/developer-resources/cli/simulate-events) In the live environment, these events come from banks, card networks, and processors. In the sandbox, `pay simulate` triggers these events on demand. ## Charges [#charges] Simulate charge clearing, disputes, fraud warnings, and collaborations by charge ID: ```bash title="Terminal" pay simulate charge clear chrg_685125114794084352 pay simulate charge dispute chrg_685125114794084352 --status lost pay simulate charge fraud-warning chrg_685125114794084352 --type made_with_stolen_card --actionable pay simulate charge collaboration chrg_685125114794084352 --source ethoca ``` Without `--status`, a dispute is `open`. Each command's `--help` lists the values it takes. ## Payouts and subscriptions [#payouts-and-subscriptions] A payout must have succeeded, and a subscription must be active: ```bash title="Terminal" pay simulate payout return po_296645958265997315 pay simulate subscription charge sub_296645958265997340 ``` The webhooks follow as they would in the live environment. Run [`pay listen`](/developer-resources/cli/forward-webhooks) first to see them. [Test your integration](/get-started/test-your-integration#simulate-events-after-a-payment) says what each one does. # .NET (/developer-resources/server-sdks/dotnet) The .NET SDK has a typed async method for each API operation, named after its resource: `pay.Charges.CreateAsync()`, `pay.Holds.CaptureAsync()`, and `pay.ValueLists.Items.CreateAsync()`. Properties are PascalCase, and keep the API's own names for JSON. ## Requirements and install [#requirements-and-install] You need .NET 8 or later. The SDK needs nothing but the framework. ```bash title="Terminal" dotnet add package PayCom ``` Everything is in the `PayCom` namespace. A client is safe to share between threads. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or exceptions. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```csharp title="Program.cs" using PayCom; var pay = new Pay(); var charge = await pay.Charges.CreateAsync(new ChargesCreateParams { Amount = 2000, Currency = "usd", Source = "pm_card_685125127054035968", Reference = "order-6735", }); Console.WriteLine($"{charge?.Id} {charge?.Status}"); ``` A property you never set isn't sent. Every property of a response is nullable, since the API can leave a field out. The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, pass it after the parameters: `pay.Charges.CreateAsync(parameters, new RequestOptions { IdempotencyKey = key })`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `421`, `429`, `502`, `503`, or `504`. To decide yourself, set `MaxRetries = 0`, and set a `Reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `WebhookEndpoints.CreateAsync()`, and `NetworkTokens.RetrieveCryptogramAsync()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `PaymentLinks.UpdateAsync()`, pass every field you want to keep, `Amount` and `Currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] `ListAsync` returns one page. `ListAutoPagingAsync` goes through every item on every page, and fetches each page as you reach it: ```csharp title="Program.cs" using PayCom; var pay = new Pay(); var page = await pay.Charges.ListAsync(new ChargesListParams { Limit = 10 }); Console.WriteLine($"{page?.Data?.Count} {page?.HasMore}"); await foreach (var charge in pay.Charges.ListAutoPagingAsync(new ChargesListParams { CreatedGreaterThan = DateTimeOffset.Parse("2026-11-01T00:00:00Z") })) { Console.WriteLine(charge.Id); } ``` Break out of the loop to stop. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline throws `PaymentMethodException`: ```csharp title="Program.cs" using PayCom; var pay = new Pay(); try { await pay.Charges.CreateAsync(new ChargesCreateParams { Amount = 2000, Currency = "usd", Source = "pm_card_685125127054035968", }); } catch (PaymentMethodException e) { Console.WriteLine($"Declined: {e.DeclineCode}"); } catch (InvalidRequestException e) { Console.WriteLine($"Fix the request: {e.Code} {e.Message}"); } ``` Every exception the SDK throws is a `PayException`, with `Type`, `Code`, `StatusCode`, and the API's body as `Body`. Include `RequestId` when contacting Pay.com support. It is empty when the API didn't get or couldn't read the request. After retries, `InnerException` holds an earlier attempt's error. The exception's class tells you what happened: | Error class | Cause | | :------------------------ | :------------------------------------------------------------------------ | | `PaymentMethodException` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `InvalidRequestException` | `400` or `422`. `NotFoundException`, for `404`, is one too | | `AuthenticationException` | `401` | | `PermissionException` | `403` | | `IdempotencyException` | An idempotency key in use, or used for another request | | `ConflictException` | Any other `409` | | `RateLimitException` | `429` | | `ApiException` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `ApiConnectionException` | No complete response. `ApiTimeoutException` is one too | When you cancel, the method throws `OperationCanceledException`, as .NET methods do. See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Cap the body, since anyone can send to your URL. Return HTTP `400` only when `SignatureVerificationException` is thrown. Let other errors return `500` so Pay.com retries delivery: ```csharp title="Program.cs" using PayCom; var builder = WebApplication.CreateBuilder(args); builder.WebHost.ConfigureKestrel(options => options.Limits.MaxRequestBodySize = 5 * 1024 * 1024); var app = builder.Build(); var webhooks = new Webhooks(); app.MapPost("/webhooks", async (HttpRequest request) => { using var reader = new StreamReader(request.Body); var body = await reader.ReadToEndAsync(); PayEvent payEvent; try { payEvent = webhooks.ConstructEvent(body, request.Headers["Pay-Signature"], Environment.GetEnvironmentVariable("PAY_COM_WEBHOOK_SECRET")!); } catch (SignatureVerificationException) { return Results.BadRequest("Invalid signature"); } if (payEvent is ChargeSucceededEvent succeeded) { Console.WriteLine($"Paid: {succeeded.Data?.Id}"); } return Results.Ok(); }); app.Run(); ``` Skip events whose `Id` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). Each event type has a class, such as `ChargeSucceededEvent`, whose `Data` is typed. In your tests, `pay.Webhooks.GenerateTestHeader(payload, secret)` makes a valid header. ## Options [#options] Set these on a `PayOptions`, and pass it to `new Pay()`. `RequestOptions` sets `IdempotencyKey`, `MerchantId`, `Timeout`, `MaxRetries`, and `Headers` for one request. Every method also takes a `CancellationToken`, last. The sandbox's simulate endpoints are under `pay.TestHelpers`. `pay.Documents.UploadAsync()` takes an `Upload` with the file and its content type. See [Upload and download files](/developer-resources/upload-and-download-files). # Go (/developer-resources/server-sdks/go) The Go SDK has a typed method for each API operation, named after its resource: `client.Charges.Create()`, `client.Holds.Capture()`, and `client.ValueLists.Items.Create()`. Every method takes a `context.Context` first. Fields have Go names, such as `TransactionID`, with JSON tags for the API's own. ## Requirements and install [#requirements-and-install] You need Go 1.23 or later. The SDK uses the standard library only. ```bash title="Terminal" go get github.com/pay-com/pay-com-sdks/go ``` Import `github.com/pay-com/pay-com-sdks/go/pay`. Create one client and reuse it across requests. It is safe for concurrent use. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or errors. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```go title="main.go" package main import ( "context" "fmt" "log" "github.com/pay-com/pay-com-sdks/go/pay" ) func main() { ctx := context.Background() client, err := pay.NewClient() if err != nil { log.Fatal(err) } charge, err := client.Charges.Create(ctx, &pay.ChargesCreateParams{ Amount: pay.Int(2000), Currency: pay.String("usd"), Source: pay.String("pm_card_685125127054035968"), Reference: pay.String("order-6735"), }) if err != nil { log.Fatal(err) } fmt.Println(charge.ID, charge.Status) } ``` A field you leave nil isn't sent. `pay.String`, `pay.Int`, `pay.Bool`, and `pay.Ptr` make the pointers. The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, pass it after the parameters: `client.Charges.Create(ctx, params, pay.WithIdempotencyKey(key))`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `421`, `429`, `502`, `503`, or `504`. To decide yourself, pass `pay.WithMaxRetries(0)`, and set a `Reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `WebhookEndpoints.Create()`, and `NetworkTokens.RetrieveCryptogram()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `PaymentLinks.Update()`, pass every field you want to keep, `Amount` and `Currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] A list method returns an iterator over every item on every page, and fetches each page as you reach it. The same method with `Page` added to its name, such as `ListPage`, gets one page: ```go title="main.go" package main import ( "context" "fmt" "log" "github.com/pay-com/pay-com-sdks/go/pay" ) func main() { ctx := context.Background() client, err := pay.NewClient() if err != nil { log.Fatal(err) } page, err := client.Charges.ListPage(ctx, &pay.ChargesListParams{Limit: pay.Int(10)}) if err != nil { log.Fatal(err) } fmt.Println(len(page.Data), page.HasMore) for charge, err := range client.Charges.List(ctx, &pay.ChargesListParams{CreatedGreaterThan: pay.String("2026-11-01T00:00:00Z")}) { if err != nil { log.Fatal(err) } fmt.Println(charge.ID) } } ``` Breaking out of the loop stops fetching additional pages. If an error occurs, the iterator yields it as the final item and stops. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline is an error of kind `pay.ErrPaymentMethod`: ```go title="main.go" package main import ( "context" "errors" "fmt" "log" "github.com/pay-com/pay-com-sdks/go/pay" ) func main() { ctx := context.Background() client, err := pay.NewClient() if err != nil { log.Fatal(err) } _, err = client.Charges.Create(ctx, &pay.ChargesCreateParams{ Amount: pay.Int(2000), Currency: pay.String("usd"), Source: pay.String("pm_card_685125127054035968"), }) var perr *pay.Error switch { case errors.Is(err, pay.ErrPaymentMethod) && errors.As(err, &perr): fmt.Println("Declined:", perr.DeclineCode) case errors.Is(err, pay.ErrInvalidRequest) && errors.As(err, &perr): fmt.Println("Fix the request:", perr.Code, perr.Message) case err != nil: log.Fatal(err) } } ``` Every error is a `*pay.Error`, with `Kind`, `Type`, `Code`, `StatusCode`, and the API's response as `Body`. Include `RequestID` when contacting Pay.com support. It is empty when the API didn't get or couldn't read the request. After retries, `Earlier` holds an earlier attempt's error. Test the kind with `errors.Is`: | Error kind | Cause | | :------------------ | :------------------------------------------------------------------------------------------------------- | | `ErrPaymentMethod` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `ErrInvalidRequest` | `400` or `422`. `ErrNotFound`, for `404`, is one too | | `ErrAuthentication` | `401` | | `ErrPermission` | `403` | | `ErrIdempotency` | An idempotency key in use, or used for another request | | `ErrConflict` | Any other `409` | | `ErrRateLimit` | `429` | | `ErrAPI` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `ErrConnection` | No complete response. `ErrTimeout` is one too | | `ErrUsage` | Client-side configuration or usage error detected before sending the request (such as a missing API key) | If the context cancels a request or its deadline expires, check the error with `errors.Is(err, context.Canceled)` or `errors.Is(err, context.DeadlineExceeded)`. See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Cap the body, since anyone can send to your URL. Return HTTP `400` only when `ErrSignature` is returned. Let other errors return `500` so Pay.com retries delivery: ```go title="main.go" package main import ( "errors" "fmt" "io" "log" "net/http" "os" "github.com/pay-com/pay-com-sdks/go/pay" ) func main() { http.HandleFunc("POST /webhooks", handleWebhook) log.Fatal(http.ListenAndServe(":3000", nil)) } func handleWebhook(w http.ResponseWriter, r *http.Request) { body, err := io.ReadAll(http.MaxBytesReader(w, r.Body, 5<<20)) if err != nil { http.Error(w, "Can't read the body", http.StatusBadRequest) return } event, err := pay.ConstructEvent(body, r.Header.Get(pay.SignatureHeader), os.Getenv("PAY_COM_WEBHOOK_SECRET")) if errors.Is(err, pay.ErrSignature) { http.Error(w, "Invalid signature", http.StatusBadRequest) return } if err != nil { http.Error(w, "Can't check webhooks", http.StatusInternalServerError) return } if event.Type == pay.EventChargeSucceeded { fmt.Println("Paid:", event.Data.(*pay.Charge).ID) } w.WriteHeader(http.StatusOK) } ``` Skip events whose `ID` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). `event.Data` is decoded by the event's type: a `*pay.Charge` for `charge.*` events, and so on. `event.RawData` is the data as received. In your tests, `pay.GenerateTestHeader(body, secret, time.Time{})` makes a valid header. ## Options [#options] Pass these to `pay.NewClient()`. `pay.WithMerchantID`, `pay.WithTimeout`, `pay.WithMaxRetries`, `pay.WithHeader`, and `pay.WithIdempotencyKey` can also be set for one request, after the method's parameters. The context's deadline bounds the whole call, retries included. The sandbox's simulate endpoints are under `client.TestHelpers`. `client.Documents.Upload()` takes a `pay.Upload` with the file and its content type. See [Upload and download files](/developer-resources/upload-and-download-files). # Server SDKs (/developer-resources/server-sdks) Each library names its methods after the API's resources, sends an idempotency key with each `POST` and `DELETE`, reads lists page by page, and checks webhook signatures. ## Libraries [#libraries] Choose the library for your server's language. ## Web and mobile SDKs [#web-and-mobile-sdks] Use a client SDK for the customer's side of checkout. ## Plugins [#plugins] Connect an e-commerce platform to Pay.com with a ready-made plugin. Compare all supported platforms in [E-commerce plugins](/payments/plugins). # Java (/developer-resources/server-sdks/java) `pay-com-java` has a typed method for each API operation, named after its resource: `pay.charges().create()`, `pay.holds().capture()`, and `pay.valueLists().items().create()`. Parameters are builders, and responses have a getter for each field, in camelCase. For example, `receipt_email` is `receiptEmail(...)` and `getReceiptEmail()`. ## Requirements and install [#requirements-and-install] You need Java 11 or later. The library has no dependencies. With Maven: ```xml title="pom.xml" com.pay pay-com-java 0.1.0 ``` With Gradle: ```kotlin title="build.gradle.kts" implementation("com.pay:pay-com-java:0.1.0") ``` `Pay` is thread-safe. Create one instance and reuse it across requests. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or errors. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```java title="CreateCharge.java" import com.pay.Pay; import com.pay.model.Charge; import com.pay.model.ChargesCreateParams; public class CreateCharge { public static void main(String[] args) { Pay pay = new Pay(); Charge charge = pay.charges().create(ChargesCreateParams.builder() .amount(2000) .currency("usd") .source("pm_card_685125127054035968") .reference("order-6735") .build()); System.out.println(charge.getId() + " " + charge.getStatus()); } } ``` A field you never set isn't sent. A getter returns `null` for a field the response leaves out. The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, pass it after the parameters: `pay.charges().create(params, RequestOptions.builder().idempotencyKey(key).build())`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `421`, `429`, `502`, `503`, or `504`. To decide yourself, set `maxRetries` to `0`, and set a `reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `webhookEndpoints().create()`, and `networkTokens().retrieveCryptogram()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `paymentLinks().update()`, pass every field you want to keep, `amount` and `currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] A list method returns its first page, which is also an `Iterable` over every item on every page: ```java title="ListCharges.java" import com.pay.Pay; import com.pay.model.Charge; import com.pay.model.ChargesListParams; public class ListCharges { public static void main(String[] args) { Pay pay = new Pay(); System.out.println(pay.charges().list(ChargesListParams.builder().limit(10).build()).getData().size()); for (Charge charge : pay.charges().list(ChargesListParams.builder().createdGreaterThan("2026-11-01T00:00:00Z").build())) { System.out.println(charge.getId()); } } } ``` To collect them, with a limit, use `pay.charges().list().stream().limit(500).collect(Collectors.toList())`. `nextPage()` fetches one more page. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline throws `PaymentMethodException`: ```java title="Decline.java" import com.pay.InvalidRequestException; import com.pay.Pay; import com.pay.PaymentMethodException; import com.pay.model.ChargesCreateParams; public class Decline { public static void main(String[] args) { Pay pay = new Pay(); try { pay.charges().create(ChargesCreateParams.builder() .amount(2000) .currency("usd") .source("pm_card_685125127054035968") .build()); } catch (PaymentMethodException e) { System.out.println("Declined: " + e.getDeclineCode()); } catch (InvalidRequestException e) { System.out.println("Fix the request: " + e.getCode() + " " + e.getMessage()); } } } ``` Every exception is a `PayException`, which is unchecked, with `getType()`, `getCode()`, `getStatusCode()`, and the API's body as `getRaw()`. Include `getRequestId()` when contacting Pay.com support. It is empty when the API didn't get or couldn't read the request. After retries, `getCause()` holds an earlier attempt's error. The exception's class tells you what happened: | Error class | Cause | | :------------------------ | :------------------------------------------------------------------------ | | `PaymentMethodException` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `InvalidRequestException` | `400` or `422`. `NotFoundException`, for `404`, is one too | | `AuthenticationException` | `401` | | `PermissionException` | `403` | | `IdempotencyException` | An idempotency key in use, or used for another request | | `ConflictException` | Any other `409` | | `RateLimitException` | `429` | | `ApiException` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `ApiConnectionException` | No complete response. `ApiTimeoutException` is one too | See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Cap the body, since anyone can send to your URL. An event can be over 1 MB, so take up to 5 MB. Return HTTP `400` only when `SignatureVerificationException` is thrown. Let other errors return `500` so Pay.com retries delivery: ```java title="WebhookHandler.java" import com.pay.SignatureVerificationException; import com.pay.Webhooks; import com.pay.event.ChargeSucceededEvent; import com.pay.event.Event; public class WebhookHandler { /** Takes the raw body and its Pay-Signature header, and returns the HTTP status code to send. */ public static int handle(byte[] body, String signatureHeader) { Event event; try { event = Webhooks.constructEvent(body, signatureHeader, System.getenv("PAY_COM_WEBHOOK_SECRET")); } catch (SignatureVerificationException e) { return 400; } if (event instanceof ChargeSucceededEvent) { System.out.println("Paid: " + ((ChargeSucceededEvent) event).getData().getId()); } return 200; } } ``` Any other exception is a `500` from your server, and Pay.com sends the event again. Skip events whose `id` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). Each event type has its class, such as `ChargeSucceededEvent`, whose `getData()` is a `Charge`. In your tests, `Webhooks.generateTestHeaderString(payload, secret)` makes a valid header. ## Options [#options] Pass these to `new Pay(PayOptions.builder()...build())`. `merchantId`, `timeout`, `maxRetries`, and `idempotencyKey` can also be set for one request, in a `RequestOptions` after the parameters. The sandbox's simulate endpoints are under `pay.testHelpers()`. `pay.documents().upload()` takes an `Upload` with the file and its content type. See [Upload and download files](/developer-resources/upload-and-download-files). # Node.js (/developer-resources/server-sdks/node) `@pay-com/node` has a typed method for each API operation, named after its resource: `pay.charges.create()`, `pay.holds.capture()`, and `pay.valueLists.items.create()`. Parameters and fields keep the API's own names, in snake\_case. ## Requirements and install [#requirements-and-install] You need Node.js 20.19 or later. The package is for servers. It won't start in a browser, where anyone could read your secret key. ```bash title="Terminal" npm install @pay-com/node ``` It works with `import` and `require`. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or errors. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```js title="charge.mjs" import { Pay } from '@pay-com/node'; const pay = new Pay(); const charge = await pay.charges.create({ amount: 2000, currency: 'usd', source: 'pm_card_685125127054035968', reference: 'order-6735', }); console.log(charge.id, charge.status); ``` The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, pass it after the parameters: `pay.charges.create(params, { idempotencyKey })`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `429`, `502`, `503`, or `504`. To decide yourself, pass `{ maxRetries: 0 }`, and set a `reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `webhookEndpoints.create()`, and `networkTokens.retrieveCryptogram()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `paymentLinks.update()`, pass every field you want to keep, `amount` and `currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] A list method returns one page when you await it, and every item on every page when you loop over it: ```js title="list.mjs" import { Pay } from '@pay-com/node'; const pay = new Pay(); const page = await pay.charges.list({ limit: 10 }); console.log(page.data?.length, page.has_more); for await (const charge of pay.charges.list({ 'created.greater_than': '2026-11-01T00:00:00Z' })) { console.log(charge.id); } ``` To collect them, with a limit, use `await pay.charges.list().toArray({ limit: 500 })`. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline throws `PaymentMethodError`: ```js title="decline.mjs" import { InvalidRequestError, Pay, PaymentMethodError } from '@pay-com/node'; const pay = new Pay(); try { await pay.charges.create({ amount: 2000, currency: 'usd', source: 'pm_card_685125127054035968' }); } catch (error) { if (error instanceof PaymentMethodError) { console.log('Declined:', error.declineCode); } else if (error instanceof InvalidRequestError) { console.log('Fix the request:', error.code, error.message); } else { throw error; } } ``` Every error is a `PayError`, with `type`, `code`, `statusCode`, and the API's body as `raw`. Include `requestId` when contacting Pay.com support. It is empty when the API didn't get or couldn't read the request. After retries, `cause` holds an earlier attempt's error. The error's class tells you what happened: | Error class | Cause | | :-------------------- | :------------------------------------------------------------------------ | | `PaymentMethodError` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `InvalidRequestError` | `400` or `422`. `NotFoundError`, for `404`, is one too | | `AuthenticationError` | `401` | | `PermissionError` | `403` | | `IdempotencyError` | An idempotency key in use, or used for another request | | `ConflictError` | Any other `409` | | `RateLimitError` | `429` | | `APIError` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `APIConnectionError` | No complete response. `APITimeoutError` is one too | See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Cap the body, since anyone can send to your URL. Return HTTP `400` only when `SignatureVerificationError` is thrown. Let other errors return `500` so Pay.com retries delivery: ```js title="webhooks.mjs" import { createServer } from 'node:http'; import { Pay, SignatureVerificationError } from '@pay-com/node'; const secret = process.env.PAY_COM_WEBHOOK_SECRET; if (!secret?.trim()) throw new Error('Set PAY_COM_WEBHOOK_SECRET'); const maxBytes = 5 * 1024 * 1024; createServer(async (request, response) => { const chunks = []; let size = 0; try { for await (const chunk of request) { size += chunk.length; if (size > maxBytes) { response.writeHead(413).end(); return; } chunks.push(chunk); } } catch { return; // The sender hung up. } let event; try { event = Pay.webhooks.constructEvent(Buffer.concat(chunks), request.headers['pay-signature'], secret); } catch (error) { if (error instanceof SignatureVerificationError) { response.writeHead(400).end(); } else { console.error(error); response.writeHead(500).end(); } return; } if (event.type === 'charge.succeeded') console.log('Paid:', event.data.id); response.writeHead(200).end(); }).listen(3000); ``` Skip events whose `id` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). In a runtime without `node:crypto`, use `constructEventAsync()`. In your tests, `pay.webhooks.generateTestHeaderString({ payload, secret })` makes a valid header. ## Options [#options] Pass these to `new Pay()`. `merchantId`, `timeout`, `maxRetries`, and `idempotencyKey` can also be set for one request, in the method's last argument. The sandbox's simulate endpoints are under `pay.testHelpers`. `pay.documents.upload()` takes a `Blob` with the file's type. See [Upload and download files](/developer-resources/upload-and-download-files). # PHP (/developer-resources/server-sdks/php) `pay-com/pay-com-php` has a method for each API operation, named after its resource: `$pay->charges->create()`, `$pay->holds->capture()`, and `$pay->valueLists->items->create()`. Parameters are arrays with the API's own field names, in snake\_case, and responses are typed objects. ## Requirements and install [#requirements-and-install] You need PHP 7.4 or later, with `ext-json`, and `ext-curl` for the built-in transport. ```bash title="Terminal" composer require pay-com/pay-com-php ``` Each operation's parameters are an array shape that PHPStan and Psalm check, such as `PayCom\Types\ChargesCreateParams`. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or errors. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```php title="charge.php" charges->create([ 'amount' => 2000, 'currency' => 'usd', 'source' => 'pm_card_685125127054035968', 'reference' => 'order-6735', ]); echo $charge->id, ' ', $charge->status, "\n"; ``` A field you leave out isn't sent. A response has a property for each field, `null` when the response leaves it out, and is also a read-only array: `$charge['amount']`. The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, pass it after the parameters: `$pay->charges->create($params, ['idempotency_key' => $key])`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `421`, `429`, `502`, `503`, or `504`. To decide yourself, pass `'max_retries' => 0`, and set a `reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `webhookEndpoints->create()`, and `networkTokens->retrieveCryptogram()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `paymentLinks->update()`, pass every field you want to keep, `amount` and `currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] A list method returns its first page, which is also every item on every page, fetched as you reach them: ```php title="list.php" charges->list(['limit' => 10]); echo count($page->data ?? []), "\n"; foreach ($pay->charges->list(['created.greater_than' => new DateTimeImmutable('2026-11-01')]) as $charge) { echo $charge->id, "\n"; } ``` To collect them, with a limit, use `$pay->charges->list()->take(500)`. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline throws `PaymentMethodException`: ```php title="decline.php" charges->create(['amount' => 2000, 'currency' => 'usd', 'source' => 'pm_card_685125127054035968']); } catch (PaymentMethodException $e) { echo 'Declined: ', $e->getDeclineCode(), "\n"; } catch (InvalidRequestException $e) { echo 'Fix the request: ', $e->getErrorCode(), ' ', $e->getMessage(), "\n"; } ``` A declined charge, hold, refund, or payout is still created, and its ID is in `getError()`, under its type. Every exception is a `PayCom\Exception\PayException`, with `getErrorType()`, `getErrorCode()`, `getHttpStatus()`, and the API's body as `getRaw()`. Include `getRequestId()` when contacting Pay.com support. It is `null` when the API didn't get or couldn't read the request. After retries, `getPrevious()` holds an earlier attempt's error. The exception's class tells you what happened: | Error class | Cause | | :------------------------ | :------------------------------------------------------------------------ | | `PaymentMethodException` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `InvalidRequestException` | `400` or `422`. `NotFoundException`, for `404`, is one too | | `AuthenticationException` | `401` | | `PermissionException` | `403` | | `IdempotencyException` | An idempotency key in use, or used for another request | | `ConflictException` | Any other `409` | | `RateLimitException` | `429` | | `ApiException` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `ApiConnectionException` | No complete response. `ApiTimeoutException` is one too | `ApiConnectionException::mayHaveReachedApi()` is `false` only when the request surely never left your server. See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Return HTTP `400` only when `SignatureVerificationException` is thrown. Let other errors return `500` so Pay.com retries delivery: ```php title="webhooks.php" constructEvent($payload, $_SERVER['HTTP_PAY_SIGNATURE'] ?? null, (string) getenv('PAY_COM_WEBHOOK_SECRET')); } catch (SignatureVerificationException $e) { http_response_code(400); exit; } if ($event instanceof ChargeSucceededEvent) { error_log('Paid: ' . $event->data->id); } http_response_code(200); ``` Any other exception is a `500`, and Pay.com sends the event again. While you replace a secret, pass both, `[$new, $old]`, and either one verifies. Skip events whose `id` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). Each event type has a class, such as `ChargeSucceededEvent`, whose `data` is the typed object. In your tests, `$pay->webhooks->generateTestHeader($payload, $secret)` makes a valid header. ## Options [#options] Pass these to `new Pay([...])`. `idempotency_key`, `merchant_id`, `timeout_ms`, `max_retries`, and `headers` can also be set for one request, in the method's last argument. Passing an unrecognized option throws an exception. The sandbox's simulate endpoints are under `$pay->testHelpers`. `$pay->documents->upload()` takes the file's bytes, a stream, or an `SplFileInfo`, with its `content_type`. See [Upload and download files](/developer-resources/upload-and-download-files). In a WordPress or other plugin, prefix the SDK's namespace with Strauss or PHP-Scoper, since two plugins on one site may bundle different versions. # Python (/developer-resources/server-sdks/python) `pay-com` has a typed method for each API operation, named after its resource: `pay.charges.create()`, `pay.holds.capture()`, and `pay.value_lists.items.create()`. Parameters and fields keep the API's own names, in snake\_case. `Pay` is the client, and `AsyncPay` has the same methods for asyncio and trio. ## Requirements and install [#requirements-and-install] You need Python 3.9 or later. ```bash title="Terminal" pip install pay-com ``` Import it as `pay_com`. Parameters are dicts with the API's field names. Each operation's parameters are a `TypedDict` in `pay_com.types`, such as `ChargesCreateParams`, so mypy and your editor check them. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or errors. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```python title="charge.py" from pay_com import Pay pay = Pay() charge = pay.charges.create({ "amount": 2000, "currency": "usd", "source": "pm_card_685125127054035968", "reference": "order-6735", }) print(charge.id, charge.status) ``` A response is a typed object, such as a `Charge`, and also a dict of what the API sent. A field the response leaves out reads as `None`. The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, pass it to the method: `pay.charges.create(params, idempotency_key=key)`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `421`, `429`, `502`, `503`, or `504`. To decide yourself, pass `max_retries=0`, and set a `reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `webhook_endpoints.create()`, and `network_tokens.retrieve_cryptogram()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `payment_links.update()`, pass every field you want to keep, `amount` and `currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] A list method returns its first page. Looping over the page goes through every item on it and on every page after: ```python title="list.py" from pay_com import Pay pay = Pay() page = pay.charges.list({"limit": 10}) print(len(page.data or []), page.has_more) for charge in pay.charges.list({"created.greater_than": "2026-11-01T00:00:00Z"}): print(charge.id) ``` To collect them, with a limit, use `list(itertools.islice(pay.charges.list(), 500))`. With `AsyncPay`, await the call for its first page, or loop over it with `async for`. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline raises `PaymentMethodError`: ```python title="decline.py" from pay_com import InvalidRequestError, Pay, PaymentMethodError pay = Pay() try: pay.charges.create({"amount": 2000, "currency": "usd", "source": "pm_card_685125127054035968"}) except PaymentMethodError as err: print("Declined:", err.decline_code) except InvalidRequestError as err: print("Fix the request:", err.code, err.message) ``` Every error is a `PayError`, with `type`, `code`, `status_code`, and the API's body as `raw`. Include `request_id` when contacting Pay.com support. It is `None` when the API didn't get or couldn't read the request. After retries, `__cause__` holds an earlier attempt's error. The error's class tells you what happened: | Error class | Cause | | :---------------------- | :------------------------------------------------------------------------ | | `PaymentMethodError` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `InvalidRequestError` | `400` or `422`. `NotFoundError`, for `404`, is one too | | `AuthenticationError` | `401` | | `PermissionDeniedError` | `403` | | `IdempotencyError` | An idempotency key in use, or used for another request | | `ConflictError` | Any other `409` | | `RateLimitError` | `429` | | `APIError` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `APIConnectionError` | No complete response. `APITimeoutError` is one too | See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Cap the body, since anyone can send to your URL. Return HTTP `400` only when `SignatureVerificationError` is raised. Let other errors return `500` so Pay.com retries delivery: ```python title="webhooks.py" import os from flask import Flask, request from pay_com import Pay, SignatureVerificationError app = Flask(__name__) app.config["MAX_CONTENT_LENGTH"] = 5 * 1024 * 1024 @app.post("/webhooks") def webhooks(): try: event = Pay.webhooks.construct_event(request.get_data(), request.headers.get("Pay-Signature"), os.environ["PAY_COM_WEBHOOK_SECRET"]) except SignatureVerificationError: return "Invalid signature", 400 if event.type == "charge.succeeded": print("Paid:", event.data.id) return "", 200 ``` The raw body is `request.body` in Django, and `await request.body()` in FastAPI. An event can be over 1 MB, and Django refuses bodies over 2.5 MB unless you raise `DATA_UPLOAD_MAX_MEMORY_SIZE`. Skip events whose `id` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). `construct_event()` returns the event's class, such as `ChargeSucceededEvent`, whose `data` is a `Charge`. In your tests, `Pay.webhooks.generate_test_header(payload, secret)` makes a valid header. ## Options [#options] Pass these to `Pay()` or `AsyncPay()`. `idempotency_key`, `merchant_id`, `timeout`, `max_retries`, and `headers` can also be set for one request, as keyword arguments of the method. The sandbox's simulate endpoints are under `pay.test_helpers`. `pay.documents.upload()` takes bytes, a path, or a file opened in binary mode. See [Upload and download files](/developer-resources/upload-and-download-files). Close the client when you're done, with `pay.close()` or `with Pay() as pay:`, or keep one for your app's life. Logs go to the `pay_com` logger, without keys or bodies. Set `PAY_COM_LOG=debug` to see them. # Rust (/developer-resources/server-sdks/rust) The `pay-com` crate has a typed async method for each API operation, named after its resource: `pay.charges().create()`, `pay.holds().capture()`, and `pay.value_lists().items().create()`. Types are in `pay_com::types`, and fields keep the API's own names, in snake\_case. ## Requirements and install [#requirements-and-install] You need Rust 1.85 or later, on Tokio. The SDK uses HTTP/1.1 over rustls, so there's no OpenSSL to install. ```toml title="Cargo.toml" [dependencies] pay-com = "0.1" tokio = { version = "1", features = ["macros", "rt-multi-thread"] } ``` The crate is `pay-com`, used as `pay_com`. ## Set your key [#set-your-key] Keep the key out of your code. The SDK reads it from `PAY_COM_API_KEY`: ```bash title="Terminal" export PAY_COM_API_KEY='sk-pay-com-sandbox-…' ``` The SDK selects the sandbox or live environment automatically from the key prefix (`sk-pay-com-sandbox-` or `sk-pay-com-live-`). The key is never written to the SDK's logs or errors. ## Create your first charge [#create-your-first-charge] Charge a saved payment method. Amounts are integers in minor units (for example, `2000` is $20.00 USD): ```rust title="src/main.rs" use pay_com::Pay; use pay_com::types::ChargesCreateParams; #[tokio::main] async fn main() -> pay_com::Result<()> { let pay = Pay::new()?; let charge = pay .charges() .create( ChargesCreateParams::new(2000, "usd") .source("pm_card_685125127054035968") .reference("order-6735"), ) .await?; println!("{:?} {:?}", charge.id, charge.status); Ok(()) } ``` `new()` takes the required fields, and each optional one has a setter. Every field of a response is an `Option`, since the API can leave one out. A request does nothing until it's awaited. The SDK sends a new idempotency key with each `POST` and `DELETE`, and the same one when it retries. To use your own, set it on the request: `pay.charges().create(params).idempotency_key(key).await`. It retries twice by default after a network error, a timeout, `409 request_in_progress`, `421`, `429`, `502`, `503`, or `504`. To decide yourself, call `.max_retries(0)`, and set a `reference` on payments to help you [find out what was created](/developer-resources/idempotency-and-retries#find-out-what-was-created). The SDK retries these only after a `429`, or when they never left your server: every `PUT` and `PATCH`, `webhook_endpoints().create()`, and `network_tokens().retrieve_cryptogram()`. If one of these requests receives no response, check whether it succeeded before sending it again. When you call `payment_links().update()`, pass every field you want to keep, `amount` and `currency` included. An update without `amount` sets the link's amount to `0`. ## List every item [#list-every-item] A list method's request gives its first page when you await it, and every item on every page with `.stream()`: ```rust title="src/main.rs" use pay_com::Pay; use pay_com::types::ChargesListParams; #[tokio::main] async fn main() -> pay_com::Result<()> { let pay = Pay::new()?; let page = pay.charges().list(ChargesListParams::new().limit(10)).await?; println!("{} on the first page", page.data.unwrap_or_default().len()); let mut charges = pay.charges().list(ChargesListParams::new().created_greater_than("2026-11-01T00:00:00Z")).stream(); while let Some(charge) = charges.next().await { println!("{:?}", charge?.id); } Ok(()) } ``` To collect them, with a limit, use `pay.charges().list(ChargesListParams::new()).collect(500).await?`. The stream ends after an error. Lists that [use page numbers](/developer-resources/pagination-and-filtering#lists-that-use-page-numbers) work the same way. ## Catch a decline [#catch-a-decline] A decline is an error of kind `ErrorKind::PaymentMethod`: ```rust title="src/main.rs" use pay_com::types::ChargesCreateParams; use pay_com::{ErrorKind, Pay}; #[tokio::main] async fn main() -> pay_com::Result<()> { let pay = Pay::new()?; match pay.charges().create(ChargesCreateParams::new(2000, "usd").source("pm_card_685125127054035968")).await { Ok(charge) => println!("{:?}", charge.id), Err(e) if e.kind() == ErrorKind::PaymentMethod => println!("Declined: {:?}", e.decline_code()), Err(e) if e.is_invalid_request() => println!("Fix the request: {:?} {}", e.code(), e.message()), Err(e) => return Err(e), } Ok(()) } ``` Every error is a `pay_com::Error`, with `kind()`, `error_type()`, `code()`, `status()`, and the API's body as `raw()`. Include `request_id()` when contacting Pay.com support. It is `None` when the API didn't get or couldn't read the request. After retries, `earlier()` holds an earlier attempt's error. The error's kind tells you what happened: | Error kind | Cause | | :--------------- | :------------------------------------------------------------------------------------------------------- | | `PaymentMethod` | Payment declined by the issuer or blocked by a risk rule (`400`) | | `InvalidRequest` | `400` or `422`. `is_invalid_request()` is true for `NotFound`, for `404`, too | | `Authentication` | `401` | | `Permission` | `403` | | `Idempotency` | An idempotency key in use, or used for another request | | `Conflict` | Any other `409` | | `RateLimit` | `429` | | `Api` | `5xx`, a redirect (none is followed), or a response the SDK didn't expect | | `Connection` | No complete response. `is_connection()` is true for `Timeout` too | | `Usage` | Client-side configuration or usage error detected before sending the request (such as a missing API key) | See [Handle errors](/developer-resources/handle-errors) for what to do with each. ## Verify a webhook [#verify-a-webhook] Pass the raw body, the `Pay-Signature` header, and the endpoint's whole signing secret. Cap the body, since anyone can send to your URL. An event can be over 1 MB, so take up to 5 MB, where axum's default limit is 2 MB. Return HTTP `400` only when `ErrorKind::Signature` is returned. Let other errors return `500` so Pay.com retries delivery: ```rust title="src/webhooks.rs" use pay_com::{ErrorKind, EventData, Webhooks}; // The raw body, the Pay-Signature header, and the endpoint's whole signing secret. Returns the HTTP status code to send. fn handle(body: &[u8], signature: Option<&str>, secret: &str) -> u16 { let event = match Webhooks.construct_event(body, signature, secret) { Ok(event) => event, Err(e) if e.kind() == ErrorKind::Signature => return 400, Err(_) => return 500, // no secret configured, or a signed body that isn't an event }; if let EventData::ChargeSucceeded(charge) = &event.data { println!("Paid: {:?}", charge.id); } 200 } ``` With axum, take the body as `Bytes`, and the header from the `HeaderMap`. Skip events whose `id` you've [already handled](/developer-resources/webhooks#skip-events-youve-already-handled). `event.data` is an `EventData`, with a variant for each event type that holds its object. For example, `charge.*` events carry a `Charge`. In your tests, `Webhooks.test_header(payload, secret)` makes a valid header. ## Options [#options] Pass these to `Pay::builder()`, then call `.build()?`. Per-request `.merchant_id()`, `.timeout()`, `.max_retries()`, `.idempotency_key()`, and `.header()` settings override the client defaults. The sandbox's simulate endpoints are under `pay.test_helpers()`. `pay.documents().upload()` takes an `Upload`, such as `Upload::from_path("receipt.pdf")?`. See [Upload and download files](/developer-resources/upload-and-download-files). Logs go through the `log` crate, with the target `pay_com`, without keys or bodies. Turn them on as your logger does, such as `RUST_LOG=pay_com=debug`. # How Pay.com works (/get-started/how-pay-com-works) Pay.com combines a payment gateway, processor, and multi-acquirer orchestration layer in a single integration. Whether you embed Pay.com.js in your checkout or call the REST API from your server, Pay.com routes each transaction to an acquiring bank, handles 3D Secure authentication when required, and returns a normalized response. ## Smart routing and orchestration [#smart-routing-and-orchestration] Pay.com connects your workspace to multiple acquiring banks. For each transaction, routing rules select an acquirer based on card type, geography, amount, and approval history. If an acquirer is unavailable or returns a retryable decline code (marked as fallbackable in [error codes](/api-reference/get-started/errors#error-codes)), Pay.com can retry with the next acquirer when retries are configured for your account. You get a single final outcome. Contact your Pay.com account team to configure routing rules, retries, and traffic splits. To route individual transactions from your code, see [Settlement accounts](/payments/routing/settlement-accounts). ## Payment methods [#payment-methods] Pay.com supports three categories of payment methods. Enable or disable methods in the Pay.com dashboard without changing your integration code. * **Cards:** Visa, Mastercard, American Express, and other major networks globally, with 3DS2 authentication and optional network tokenization. * **Digital wallets:** Apple Pay, Google Pay, PayPal, and regional wallets. Apple Pay and Google Pay complete in-page with no redirect. * **Alternative payment methods:** Regional and local methods, including bank transfers, prepaid vouchers, and pay by mobile. Pay.com also supports outbound [payouts](/payouts) to cards, bank accounts, and supported wallets. Payout availability varies by method and market. Browse all supported methods in the [payment methods catalog](/payment-methods). ## Transaction lifecycle [#transaction-lifecycle] Every payment moves through three core stages: * **Authorization:** The acquirer confirms with the card network and issuing bank that funds are available. * **Capture:** Funds move from the customer's account (immediately by default, or later with a hold-and-capture flow). * **Settlement:** Cleared funds transfer to your bank account on your settlement schedule. For a full state diagram covering holds, refunds, and disputes, see [Payment lifecycle](/payments/concepts/payment-lifecycle). ## Core concepts [#core-concepts] Explore the core objects and platform concepts behind a Pay.com integration. ### Payment flow [#payment-flow] Start with how sessions, transactions, and payment states fit together. ### Payment methods and recurring [#payment-methods-and-recurring] Store payment credentials and bill customers on a schedule. ### Security and compliance [#security-and-compliance] Authenticate customers, handle declines, and control fraud. ### Platform and reporting [#platform-and-reporting] Handle currencies, structure your accounts, and report on your funds. # Workspaces and settlement accounts (/get-started/how-pay-com-works/workspaces) Pay.com organizes your payment operations using **workspaces** and **settlement accounts**. Workspaces separate your transactions, routing rules, and dashboard reporting. Settlement accounts represent your individual connections to acquiring banks and payment providers. ## Workspaces [#workspaces] A workspace is an operational environment in Pay.com where you manage transactions, payment rules, routing configuration, and analytics. Every Pay.com merchant has at least one workspace, and you can have as many as you need at no extra cost. Pay.com sets them up with you during onboarding. Each workspace has its own merchant ID. You pass it to Pay.com.js as `identifier`, and a request made with a live API key for several workspaces names its workspace with it. See [Live keys for several workspaces](/developer-resources/authentication#live-keys-for-several-workspaces). Common workspace layouts: * **Single workspace:** One workspace for all brands, regions, and providers. * **Per country or region:** Separate workspaces (for example, US, UK, and EU) to isolate reporting and team permissions by geography. * **Per brand or storefront:** One workspace per brand or product line. Each workspace provides dashboard analytics, activity logs for sessions and transactions, payment rules, and filtering by date range, country, currency, provider, payment method, and card brand. ## Settlement accounts [#settlement-accounts] A settlement account (`sa_…`) is a configured connection to a payment provider or acquirer in a single settlement currency. When Pay.com sets up a provider such as Stripe or Adyen for you, a settlement account is created for that connection. Financial reporting (balances, cash flow, and settlements) is scoped to a settlement account. If you work with multiple acquirers or hold multiple accounts with the same acquirer, each connection has its own settlement account. For example, a single workspace can connect to four regional Stripe settlement accounts, one Adyen settlement account, and one Pay.com settlement account. ## How they connect [#how-they-connect] Workspaces and settlement accounts have a **many-to-many relationship**. One settlement account can be shared across multiple workspaces, and one workspace can route transactions to multiple settlement accounts without reconfiguring provider credentials. In this setup, **Stripe EU** serves all three workspaces, **Stripe US** serves Workspace A, and **Adyen UK** is shared by Workspaces B and C. ## Next steps [#next-steps] See how payments flow through your workspaces and settlement accounts. * [Payment lifecycle](/payments/concepts/payment-lifecycle): How transactions move from authorization to settlement. * [Sessions and transactions](/payments/concepts/sessions-and-transactions): How Pay.com.js sessions relate to API transactions. * [Settlement account routing](/payments/routing/settlement-accounts): Route individual transactions to a specific settlement account. # Test your integration (/get-started/test-your-integration) Use the sandbox to validate every part of your integration before you [go live](/get-started/go-live). Objects created in the sandbox include `"test_mode": true`, and transactions never reach real banking networks. ## Use your sandbox key and host [#use-your-sandbox-key-and-host] Send test requests to `https://api.sandbox.pay.com/v1` with a sandbox key (`sk-pay-com-sandbox-`). Sending a sandbox key to the live URL returns `401 Unauthorized`. In the browser, Pay.com.js (the `https://js.pay.com/v1` script, or `@pay-com/js`) works in the sandbox with a session you create there. See [Environments](/get-started/environments) and [API keys](/get-started/api-keys). For an end-to-end walkthrough, start with [Create your first payment](/get-started/create-your-first-payment). ## Test payment outcomes [#test-payment-outcomes] Use [test cards](/get-started/test-your-integration/test-cards) to simulate approvals, declines, and 3D Secure challenges. Supply any future expiration date and any 3-digit CVV (4 digits for American Express) except `777` and `999`. CVV `777` declines the charge with `decline_code: do_not_honour`, and `999` with `invalid_cvc`. If duplicate card checking is enabled on your sandbox account, reusing a test card returns `decline_code: duplicate_card`. Pass `duplicate_card_check: false` in `payment_method_options.card` on sandbox charges, holds, or payment sessions, and remove it before going live. Other flows use dedicated test values: | To test | Use | See | | :-------------------------------------- | :--------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- | | A 3DS challenge on a charge | Card `5200000000001096`, then challenge code `1234` (passes) or `3333` (fails) | [Create a charge with 3DS](/payments/3d-secure/charge-with-3ds#test-your-integration) | | Standalone 3DS authentication | Dedicated test card, challenge codes, and frictionless failure | [Standalone 3DS authentication](/payments/3d-secure/standalone-authentication#test-your-integration) | | Partial approvals | Cards approved for 80% of the requested amount | [Partial approvals](/payments/partial-approvals#testing) | | Payouts | Amounts `505` (fails immediately), `202` (succeeds later), and `303` (fails later) | [Test and go live](/payouts/test-and-go-live#test-outcomes) | | Risk rules | Test charges matching the rule condition | [Test your risk rules](/risk/rules/test-rules) | | Wallets and alternative payment methods | Method-specific sandbox values and test scenarios | The method's guide under [Payment methods](/payment-methods) | ## Simulate events after a payment [#simulate-events-after-a-payment] In live, clearing, disputes, collaborations, fraud warnings, and payout returns arrive from banks, card networks, and processors, and subscriptions bill on a schedule. In the sandbox, use simulate endpoints to trigger these events on demand. Most simulate endpoints return `204 No Content` without the object they create, and all of them work only in the sandbox. In live, they return `403`. | To test | Call | What happens | | :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Clearing a charge | [`POST /v1/charges/{transaction_id}/simulate/clear`](/api-reference/endpoints/cashflow/simulate-clear) | Books simulated fees, clears the charge, creates a `cashflow_transaction`, and sends `cashflow_transaction.created`. See [Simulate transaction clearing](/data/reconciliation/simulate-clearing). | | A dispute | [`POST /v1/charges/{transaction_id}/simulate/dispute`](/api-reference/endpoints/disputes/simulate-dispute) or [`/simulate/dispute/{dispute_status}`](/api-reference/endpoints/disputes/simulate-dispute-with-status) | Creates a dispute (`open` by default) or updates an existing dispute's status and sends the dispute webhook. See [Simulate a dispute](/risk/test-risk-events#simulate-a-dispute). | | A collaboration | [`POST /v1/charges/{transaction_id}/simulate/collaboration`](/api-reference/endpoints/collaborations/simulate-collaboration) | Creates an `open` collaboration from Mastercard Collaboration, Ethoca, or CDRN and sends `collaboration.open`. See [Simulate a collaboration](/risk/test-risk-events#simulate-a-collaboration). | | A fraud warning | [`POST /v1/charges/{transaction_id}/simulate/fraud_warning`](/api-reference/endpoints/fraudwarnings/simulate-fraud-warning) | Marks the charge as fraudulent and sends `fraud_warning.created`. See [Simulate a fraud warning](/risk/test-risk-events#simulate-a-fraud-warning). | | A payout return | [`POST /v1/payouts/{id}/simulate/return`](/api-reference/endpoints/payouts/simulate-payout-return) | Moves a succeeded payout to `returned` with code `R01` and sends `payout.returned`. Can be called once per payout. | | A subscription's next renewal | [`POST /v1/subscriptions/{subscription_id}/simulate/charge`](/api-reference/commerce/subscriptions/simulate-charge) | Runs the next renewal immediately without waiting for the scheduled billing date, returns the subscription after it, and sends the renewal's events, such as `subscription.charged`. | ## Test your webhooks [#test-your-webhooks] Register a sandbox webhook endpoint under **Developers** → **Webhooks** with a public URL on your server and subscribe to the events you want to test. Verify each event's `Pay-Signature` header with the endpoint's sandbox signing secret (`whsec-pay-com-sandbox-`). See [Webhooks](/developer-resources/webhooks) and [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). Inspect delivery attempts, payloads, and responses in the delivery log under **Developers** → **Webhooks**, and resend missed events from there (see [Monitor webhook deliveries](/developer-resources/webhooks#monitor-webhook-deliveries)). Pay.com retries failed deliveries every 15 minutes for up to 24 hours and can deliver an event more than once, so verify that your handler deduplicates by event `id`. ## Next steps [#next-steps] Once your integration handles each test scenario, follow the [Go live](/get-started/go-live) checklist. # Test cards (/get-started/test-your-integration/test-cards) Use these card numbers to simulate payment outcomes in the [sandbox](/get-started/environments). Test cards behave like live cards in the API without moving real funds. Test cards work only in the sandbox. In live, they're declined. If duplicate card checking is enabled on your sandbox account, reusing a test card number that was already tokenized returns `decline_code: duplicate_card`. Pass `"duplicate_card_check": false` inside `payment_method_options.card` in your sandbox charge, hold, or payment session requests to allow reuse. For any test card, supply: * **Expiration date:** any future date (for example, `12/2028`) * **CVV:** any 3-digit number (for example, `123`) except `777` and `999`, or 4 digits for American Express * **Billing address:** any valid address, except the line 1 and postal code below These values decline a card that would otherwise be approved, so you can test a failed CVV or address check. The two address values decline only in a billing address whose `country` is `US`. | Value | Result / reason code | `decline_code` | | :----------------------------------------------- | :------------------------------------ | :-------------- | | CVV `777` | Declined, bad CVV / 05 | `do_not_honour` | | CVV `999` | Declined, CVV2 failure / N7 | `invalid_cvc` | | `billing_details.address.line1` `714 E Cocoa St` | Declined, invalid address line 1 / 05 | `do_not_honour` | | `billing_details.address.postal_code` `90221` | Declined, invalid ZIP code / 05 | `do_not_honour` | ## Approved cards [#approved-cards] Use these cards to simulate a successful authorization without a 3D Secure challenge. | Card number | Brand | Funding type | | :----------------- | :--------------- | :------------ | | `4242424242424242` | Visa | Not specified | | `4111111111111111` | Visa | Credit | | `5555555555554444` | Mastercard | Credit | | `5555444433331111` | Mastercard | Not specified | | `2223003122003222` | Mastercard | Not specified | | `378282246310005` | American Express | Credit | | `371449635398431` | American Express | Credit | | `6011111111111117` | Discover | Not specified | | `6011000990139424` | Discover | Not specified | ## Declined cards [#declined-cards] Use these cards to trigger specific issuer decline reasons. | Card number | Decline reason | | :----------------- | :----------------- | | `4000007818415900` | Do not honor | | `4000005357086322` | Insufficient funds | | `4000004452879855` | Stolen card | ## Partial approval cards [#partial-approval-cards] These cards are approved for 80% of the amount, for example `800` of a `1000` charge. Use them to test [partial approvals](/payments/partial-approvals), which you turn on in the charge or payment session request. | Card number | Brand | | :----------------- | :--------- | | `4050453601459870` | Visa | | `5200828282828210` | Mastercard | ## 3DS challenge and result cards [#3ds-challenge-and-result-cards] Use these cards to test 3D Secure authentication outcomes, including interactive challenges and post-challenge declines. The cards marked "3DS challenge" go through the challenge. To pass or fail a challenge with a test code, see [Create a charge with 3DS](/payments/3d-secure/charge-with-3ds#test-your-integration). | Card number | Result | | :----------------- | :------------------------------------------- | | `4000000000001000` | Approved | | `5200000000001096` | 3DS challenge, approved | | `4000000000001091` | 3DS challenge, declined (insufficient funds) | | `4000000000001109` | 3DS challenge failure | ## Additional 3DS and decline code cards [#additional-3ds-and-decline-code-cards] Use these cards to test specific combinations of 3D Secure authentication and issuer response codes. | Card number | Result / reason code | | :----------------- | :----------------------- | | `4001888587298851` | Expired card / 54 | | `4001882420575674` | Stolen card / 43 | | `4001882758168944` | 3DS + insufficient funds | | `4001886514955924` | Approved (no 3DS) | | `4001889458981666` | Approved (3DS) | | `4444499122901754` | Do not honor / 05 | | `4444491578116623` | Insufficient funds / 51 | | `4444499523287118` | 3DS + insufficient funds | | `4444492185088577` | Approved (no 3DS) | | `4444491766949009` | Approved (3DS) | | `5333303384453218` | Policy / 82 | | `5333306819994367` | 3DS failure | | `5333301408867512` | 3DS + insufficient funds | | `5333307639217468` | Approved (no 3DS) | | `5333306665631428` | Approved (3DS) | # Approve or stop a payment (/sdks/pay-com-js/before-pay) `beforePay` is a [`pay.checkout()`](/sdks/pay-com-js/pay-checkout) option that runs once per payment attempt, immediately before the SDK submits the payment. It applies to every payment method, including card forms (Universal checkout, `checkout.fields()`, and client-side encryption with `checkout.cse()`), saved payment methods, Click to Pay, wallets, alternative payment methods, `checkout.headless()`, and express checkout. On PayPal's own button, from `checkout.paypal()`, it runs before PayPal creates the order. Use it to create or reserve an order, or to stop the payment. See [Express checkout](/payments/express-checkout#use-beforepay) for express checkout usage. ```ts const checkout = pay.checkout({ clientSecret, beforePay }) ``` ## Parameters [#parameters] `beforePay` receives the same fields as [`onValidateSession`](/sdks/pay-com-js/on-validate-session), plus two express checkout fields: | Parameter | Type | Description | | ------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `paymentMethodType` | `string` | Payment method identifier (for example, `card`, `click_to_pay`, `applepay`, or `paypal`). | | `fundingType` | `string \| null` | Card funding type when available. In Universal checkout, included only when you listen for `card_funding_type_update`. | | `walletResponse` | `object` | Raw payment response from Apple Pay or Google Pay. | | `express` | `true` | Present when the payment originates from [`checkout.express()`](/sdks/pay-com-js/checkout-express). | | `payer` | `ExpressPayer` | Customer details from the wallet sheet (`name`, `email`, `phone`, `billingAddress`, `shippingAddress`, and `shippingOption`), present for express checkout only. | ## Returns [#returns] Return or resolve with: * `true` or `{ proceed: true }` to let the payment go ahead. * `false` or `{ proceed: false, message }` to stop the payment before the SDK submits it. Express checkout sheets show `message` to the customer. Any other value, including `undefined` when a callback doesn't return a value, stops the payment. A callback that throws stops the payment too, and if it throws an `Error`, the error's message is passed on. While a wallet sheet waits on it, `beforePay` has 15 seconds. The limit applies to every Apple Pay sheet, in Universal checkout, Headless checkout, and express checkout, and to Google Pay in express checkout. Google Pay elsewhere has no limit, because its sheet has closed by the time `beforePay` runs. If `beforePay` takes longer than 15 seconds, Pay.com.js stops the payment as if `beforePay` returned `false`. Nothing is charged, `onFailure` isn't called, and the sheet asks the customer to try again. A call such as `checkout.headless('applepay')` rejects with an error whose `data.stoppedBy` is `'beforePay'`. Make `beforePay` idempotent, so it's safe to run twice for the same order. See [How a payment runs](/payments/express-checkout#how-a-payment-runs). ## Errors [#errors] Stopping a payment in `beforePay` doesn't decline it. Pay.com.js doesn't emit `payment_failure` or call `onFailure`. `checkout.headless()` and `checkout.pay({ source })` reject with an error whose `data.stoppedBy` is `'beforePay'`. `checkout.submit()` and `checkout.pay({ method: 'card' })` resolve with `undefined` instead, with secure card fields and with the Universal checkout form, whatever `throwOnSubmitFailure` is. Approval applies only to the session `beforePay` was asked about. If `pay.checkout()` moves to another session while `beforePay` runs, or after it and before the request that pays, nothing is paid. `checkout.headless()` and `checkout.pay()` then reject with the message "The transaction was replaced by a new checkout session". A refreshed client secret for the same session still pays. If the customer closes the Apple Pay sheet in Universal checkout while `beforePay` runs, nothing is paid, even if `beforePay` then lets the payment go ahead. A sheet closed after the payment started reports the payment's real outcome. With `beforePay` set, `checkout.pay()` and `checkout.headless()` for cards, alternative payment methods, and Click to Pay emit [`payment_processing`](/sdks/pay-com-js/checkout-on) only after `beforePay` approves the payment. `checkout.headless('applepay')` and `checkout.headless('googlepay')` are the exceptions. They emit it before the wallet sheet opens. ## With `onValidateSession` [#with-onvalidatesession] In Universal checkout, an element's own `onValidateSession` runs first, and `beforePay` runs after it. Both must approve for the payment to go ahead. `onValidateSession` approves by returning `true`, and `beforePay` by returning `true` or `{ proceed: true }`. ## Example [#example] ```ts const checkout = pay.checkout({ clientSecret, beforePay: async (data) => { const ok = await reserveStock(data.paymentMethodType) return ok ? true : { proceed: false, message: 'Some items are no longer available.' } }, }) ``` # Detect wallet availability (/sdks/pay-com-js/checkout-can-make-payments) The `checkout.canMakePayments()` method detects whether Apple Pay or Google Pay are available in the customer's current browser and device. Call it before you render wallet buttons in a Headless checkout integration. ```ts const result = await checkout.canMakePayments() ``` ## Parameters [#parameters] None. ## Returns [#returns] | Field | Type | Description | | ----------- | --------- | --------------------------------------------------------- | | `applepay` | `boolean` | `true` if Apple Pay is available in the current browser. | | `googlepay` | `boolean` | `true` if Google Pay is available in the current browser. | The result only ever contains `applepay` and `googlepay`. To check whether another payment method is available for the session, use [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods): ```js const methods = await checkout.getPaymentMethods() const paypalAvailable = methods.some((m) => m.paymentMethodType === 'paypal') ``` ## Example [#example] ```js const canPay = await checkout.canMakePayments() if (canPay.applepay) { // render Apple Pay button } if (canPay.googlepay) { // render Google Pay button } ``` # Render express checkout buttons (/sdks/pay-com-js/checkout-express) The `checkout.express()` method renders Apple Pay and Google Pay buttons in a container on your page, such as a product page or the cart, outside Universal checkout. [Express checkout](/payments/express-checkout) explains how to add the buttons and how a payment runs from the tap to the charge. ```ts const buttons = checkout.express(options) ``` Express checkout amounts are decimal strings in major units, such as `'18.00'`, because that's what the wallet sheets show. Pay.com API amounts are in minor units (`1800` for the same $18.00). ## Parameters [#parameters] `checkout.express()` takes one options object. Only `container` is required. | Parameter | Type | Required | Description | | ------------------------- | ----------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `container` | `string` | Yes | A CSS selector for the element the buttons go into, one per wallet, stacked. | | `wallets` | `('applepay' \| 'googlepay')[]` | No | Which wallets to offer, in this order. Defaults to both. | | `request` | `{ shipping?, email?, phone? }` | No | What the sheet asks the customer for. Each one defaults to the Apple Pay or Google Pay collection settings of your Pay.com account. | | `total` | `{ amount, label? }` | No | What the sheet opens with. Defaults to the session amount, labeled with your merchant name. | | `lineItems` | `ExpressLineItem[]` | No | Items to show (`{ label, amount, kind? }`). `kind` is `item` (default), `subtotal`, `tax`, `discount`, or `shipping`. Google Pay shows it, and Apple Pay ignores it. | | `shippingOptions` | `ExpressShippingOption[]` | No | Shipping options to open with before the customer picks an address (`{ id, label, amount, detail? }`). `detail` is, for example, the delivery estimate. | | `onClick` | `(context) => void \| boolean \| update` | No | Runs synchronously on the tap. Return `false` to keep the sheet closed, or return `{ total?, lineItems?, shippingOptions? }` to set what the sheet opens with. Make network requests in the handlers below or in [`beforePay`](/sdks/pay-com-js/before-pay), not here. | | `onShippingAddressChange` | `(address, context) => ExpressShippingUpdate \| Promise<…>` | No | Return `{ shippingOptions, total, lineItems? }`, or return `{ error: { reason?, message? } }`, where `reason` is `address_unserviceable` or `address_invalid`. The first option is preselected, so `total` must include its price. | | `onShippingOptionChange` | `(option, context) => ExpressUpdate \| void \| Promise<…>` | No | Return `{ total, lineItems? }`. If the handler returns nothing, the total stays the same. | | `onCancel` | `(context) => void` | No | Called when the customer closes the sheet without paying. | | `style` | `object` | No | See [Button style](#button-style). | `context` is `{ wallet }`, the wallet the customer is using. An address has `name`, `line1`, `line2`, `city`, `state`, `postalCode`, and `country` (ISO 3166-1 alpha-2, uppercase), all optional. ### Button style [#button-style] Set `style` to change the buttons' height and corner radius, and each wallet's button style and type. | Option | Type | Default | | ----------------------------- | ----------------------------------------------------------------------------------------- | ----------- | | `style.height` | `number` | `48` (px) | | `style.borderRadius` | `number` | `4` (px) | | `style.applepay.buttonStyle` | `'black' \| 'white' \| 'white-outline'` | `'black'` | | `style.applepay.type` | `'plain' \| 'buy' \| 'check-out' \| 'continue' \| 'order' \| 'pay' \| 'book' \| 'donate'` | `'plain'` | | `style.googlepay.buttonColor` | `'default' \| 'black' \| 'white'` | `'default'` | | `style.googlepay.buttonType` | `'plain' \| 'buy' \| 'checkout' \| 'order' \| 'pay' \| 'book' \| 'donate'` | `'plain'` | ## Returns [#returns] | Member | Type | Description | | ---------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ready` | `Promise<('applepay' \| 'googlepay')[]>` | Resolves with the wallets that rendered. Empty when the browser or the session supports neither. Rejects when `container` matches nothing or the session can't load. The SDK only logs a console warning, so handle the rejection. | | `update(update)` | `(update) => void` | Sets the total, line items, and shipping options for the next sheet, for example after a quantity change. | | `destroy()` | `() => void` | Removes the buttons. | For the reasons a wallet's button might not render, see [When buttons don't show](/payments/express-checkout#when-buttons-dont-show). ## Errors [#errors] A payment from an express checkout button reports its result the same way as any other payment method. When it's paid, the SDK calls `onSuccess` (or `onPending`) and emits [`payment_success`](/sdks/pay-com-js/checkout-on) (or `payment_pending`). When it fails, the SDK calls `onFailure`. Two failures are specific to express checkout. Both call `onFailure` and emit `payment_failure`, with `data.code` set to: | `data.code` | When | | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `'amount_changed'` | The session's currency or amount differs from the total the customer approved, so the SDK doesn't start the payment. The sheet shows "The amount to pay changed. Please review your order and try again". | | `'timed_out'` | An Apple Pay payment didn't start within 20 seconds of the customer's approval. Nothing is charged, and the sheet tells the customer to try again. | If the checkout moves to another session before the charge, for example because your page called `pay.checkout()` again, nothing is paid and `onFailure` is called. When the amount check catches the change, `onFailure` gets `data.prevSessionId` and `data.newSessionId`. When the change comes after the check, it gets the message "The transaction was replaced by a new checkout session". A payment that `beforePay` stops isn't a declined payment. The SDK emits no `payment_failure` event and doesn't call `onFailure`. See [`beforePay`](/sdks/pay-com-js/before-pay). ## Example [#example] ```ts const buttons = checkout.express({ container: '#express-checkout', request: { shipping: true, email: true }, lineItems: [{ label: 'Coffee beans', amount: '18.00' }], total: { amount: '18.00' }, }) const wallets = await buttons.ready // ['applepay', 'googlepay'], or [] when neither can show ``` # Mount secure card fields (/sdks/pay-com-js/checkout-fields) The `checkout.fields()` method mounts the card inputs as secure fields. Each input is a Pay.com iframe in a container you choose, so the card never exists on your page. Calling `fields()` again replaces the fields already mounted. For how to lay out, style, and listen to the fields, see [Secure card fields](/payments/secure-card-fields). ```ts const fields = checkout.fields(options) ``` ## Parameters [#parameters] `checkout.fields()` takes these parameters: | Parameter | Type | Required | Description | | ------------------ | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | `mode` | `'secure'` | Yes | Mounts the card inputs in Pay.com-hosted iframes. | | `inputs.number` | `SecureFieldInputOpts` | Yes | The card number input. | | `inputs.expiry` | `SecureFieldInputOpts` | Yes | The expiration input. | | `inputs.cvv` | `SecureFieldInputOpts` | No | The security code input. | | `inputs.name` | `SecureFieldInputOpts` | No | The cardholder name input. | | `style` | `SecureFieldStyle` | No | Styles for every input. See [Style the fields](/payments/secure-card-fields#style-the-fields). | | `fonts` | `{ cssSrc: string }[]` | No | Web fonts for the inputs. Only `https://fonts.googleapis.com` URLs are accepted. | | `inheritStyleFrom` | `string \| HTMLElement` | No | One of your own inputs, by selector or element. Its computed values for the allowlisted properties become the `base` style, under `style`. | Each input (`SecureFieldInputOpts`) takes: | Parameter | Type | Required | Description | | ------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ | | `container` | `string \| HTMLElement` | Yes | A CSS selector or element. The iframe fills it, and you draw everything around it, such as the label and the error text. | | `style` | `SecureFieldStyle` | No | Layered over the top-level `style`, with the same allowlist. | | `placeholder` | `string` | No | The input's placeholder. | | `ariaLabel` | `string` | No | The input's accessible name. Defaults to a name such as "Card number". | ## Returns [#returns] A handle with these methods: | Method | Description | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `update(options)` | Updates field appearance (`style`, `fonts`, `inheritStyleFrom`, and each input's `style`, `placeholder`, and `ariaLabel`). Containers are fixed when the fields mount. | | `focus(field)` | Moves focus to `'number'`, `'expiry'`, `'cvv'`, or `'name'`. | | `clear()` | Empties the fields. | | `setDisabled(disabled)` | Disables or enables every input. | ## Pay [#pay] To pay with the card in the fields, call [`checkout.submit()`](/sdks/pay-com-js/checkout-submit) or [`checkout.pay({ method: 'card' })`](/sdks/pay-com-js/checkout-pay). Both resolve with the payment, and reject when it fails, as `checkout.submit()` does for Universal checkout. Without a `name` input, pass the cardholder name your page collects as `checkout.submit({ cardholderName })`. ```ts const payment = await checkout.submit({ cardholderName: 'Jane Smith' }) ``` ## Events [#events] The fields emit `fields_ready`, `field_change`, `field_focus`, `field_blur`, and `form_validation_update`, which you listen for with [`checkout.on()`](/sdks/pay-com-js/checkout-on). Their payloads carry the field's name and state, never what was typed. See [Listen for events](/payments/secure-card-fields#listen-for-events) for each payload. ## Errors [#errors] Setup errors don't throw. If `inputs.number` or `inputs.expiry` is missing, or a container matches nothing, `fields()` returns a handle that does nothing. ## Example [#example] ```ts const fields = checkout.fields({ mode: 'secure', inputs: { number: { container: '#card-number' }, expiry: { container: '#card-expiry' }, cvv: { container: '#card-cvv', placeholder: 'CVV' }, }, style: { base: { fontSize: 16, padding: '10px 12px' }, invalid: { color: '#c62828' }, }, }) fields.focus('number') ``` # Retrieve saved payment methods (/sdks/pay-com-js/checkout-get-existing-sources) The `checkout.getExistingSources()` method retrieves the customer's previously saved payment methods. Use it in a **Headless checkout** integration to let returning customers select a saved payment method and pay without re-entering their details. This method also works for **payouts**. When the checkout is initialized with a `clientSecret` from a [payout setup session](/payouts/payout-method-selection) (a setup session created with `payout: true`), `getExistingSources()` returns only payout-capable sources, the saved methods the customer can receive money to. **Headless checkout only.** Universal checkout displays saved payment methods (or payout sources) automatically. You need this method only when you build your own checkout UI with Headless checkout. ```ts const existingSources = await checkout.getExistingSources() ``` ## Returns [#returns] The method returns an array of saved payment source objects. The sources returned depend on the session type: * **Payment session.** Returns all saved payment methods the customer can pay with. * **Payout setup session (`payout: true`).** Returns only payout-capable sources the customer can receive funds to. Each source object has these fields: | Field | Type | Description | | ------- | -------- | ----------------------------------------------------------------------------------------------------------- | | `id` | `string` | Unique identifier. Pass this as the `source` argument to [`checkout.pay()`](/sdks/pay-com-js/checkout-pay). | | `type` | `string` | Payment method type (for example, `"card"`). | | `token` | `string` | Token identifier associated with this source. | | `card` | `object` | Present when `type` is `"card"`. See [Card object](#card-object). | Other source types carry their own details object instead of `card`, for example `bankAccount` for bank accounts or `paypal` for PayPal. ### Card object [#card-object] When the saved source is a card, the `card` object includes these fields: | Field | Type | Description | | -------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | `bin` | `string` | Bank identification number, the leading digits of the card number. | | `brand` | `string` | Card brand (for example, `"visa"` or `"mastercard"`). | | `cardholderCurrency` | `string` | Currency associated with the cardholder. | | `country` | `string` | Card issuing country code. | | `issuerName` | `string` | Name of the issuing bank. | | `cvvExists` | `boolean` | Whether the CVV can be skipped for this source. When `true`, you can omit `cvv` in `checkout.pay()`. When `false`, collect the CVV and pass it. | | `expMonth` | `string` | Two-digit expiration month. | | `expYear` | `string` | Four-digit expiration year. | | `last4` | `string` | Last four digits of the card number. | | `fingerprint` | `string` | Unique fingerprint identifying this card. | | `funding` | `string` | Card funding type (for example, `"credit"` or `"debit"`). | | `network` | `string` | Card network (for example, `"visa"`). | | `payout` | `string` | Payout capability indicator. | ## Example [#example] Use the same method in a payment session and in a payout setup session. ### Payment example [#payment-example] When used with a payment session, retrieve saved cards and pay with one using [`checkout.pay()`](/sdks/pay-com-js/checkout-pay): ```js const existingSources = await checkout.getExistingSources() // Example response // [ // { // type: 'card', // id: 'pm_card_742346737426893824', // token: 'tok_card_685104577720095744', // card: { // bin: '424242', // brand: 'visa', // cardholderCurrency: 'usd', // country: 'US', // issuerName: 'Pay.com', // cvvExists: false, // expMonth: '12', // expYear: '2028', // last4: '4242', // fingerprint: 'bb29cee2a1d6...', // funding: 'debit', // network: 'visa', // payout: 'not_available' // } // } // ] // Display saved cards to the customer existingSources.forEach(source => { if (source.card) { console.log(`${source.card.brand} ending in ${source.card.last4}`) } }) // Pay with a saved card. Pass the CVV when cvvExists is false. const result = await checkout.pay({ source: existingSources[0].id, cvv: '123', }) ``` ### Payout example [#payout-example] When used with a payout setup session (`payout: true`), the same method returns only payout-capable sources. After the customer selects a saved source, call [`checkout.pay()`](/sdks/pay-com-js/checkout-pay) to register the selection. In payout mode, `checkout.pay()` doesn't move money. It resolves with the result, whose `paymentMethod` is the selected payment method ID. It doesn't call `onSuccess` or `onFailure`. You then send that ID to your server and use it as the `destination` when calling the [Create a payout](/api-reference/endpoints/payouts/create-payout) API. ```js // Checkout initialized with a payout setup session clientSecret const checkout = pay.checkout({ clientSecret }) // Only payout-capable sources are returned const existingSources = await checkout.getExistingSources() existingSources.forEach(source => { if (source.card) { console.log(`${source.card.brand} ending in ${source.card.last4}`) } }) // Customer selects a source: register the selection try { const result = await checkout.pay({ source: existingSources[0].id }) // Send result.paymentMethod to your server and create the payout // (amount in minor units: 10000 is $100.00): // POST /v1/payouts // { // "amount": 10000, // "currency": "usd", // "customer_reference_id": "user_10", // "destination": result.paymentMethod // } await sendToServer(result.paymentMethod) } catch (error) { console.error('Selection failed:', error.message) } ``` Saved sources are available only for customers who have previously saved a payment method. The session must include a `customer_reference_id` that matches an existing customer with saved methods. ## Next steps [#next-steps] * [Pay with a saved card](/payments/saved-cards/pay-with-a-saved-card): Step-by-step guide for building a saved card checkout flow. * [checkout.pay()](/sdks/pay-com-js/checkout-pay): Submit a payment using a saved source. * [Let recipients choose a payout method](/payouts/payout-method-selection): Full guide for the payout method selection flow. * [Save a payment method](/payments/set-up-a-card/save-a-payment-method): Store a customer's card for future use. # List payment methods (/sdks/pay-com-js/checkout-get-payment-methods) The `checkout.getPaymentMethods()` method returns an ordered list of payment methods available for the current checkout session. Use it in a **Headless checkout** integration to build your own payment method selector. **Headless checkout only.** Universal checkout displays payment methods automatically. You need this method only when you build your own checkout UI with Headless checkout. ```ts const paymentMethods = await checkout.getPaymentMethods() ``` ## Returns [#returns] The method returns an ordered array of payment method objects. The order reflects your merchant configuration. | Field | Type | Description | | --------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------- | | `paymentMethodType` | `string` | Unique identifier for the payment method. Pass this value to [`checkout.headless()`](/sdks/pay-com-js/checkout-headless). | | `name` | `string` | Optional. User-friendly display label (for example, "Card" or "ApplePay"). | | `supportedCardBrands` | `string[]` | Present when `paymentMethodType` is `"card"`. Lists accepted card brands (for example, `["visa", "mastercard", "amex", "discover"]`). | | `redirect` | `boolean` | Present and `true` when the method redirects the customer to the provider to complete the payment on every device. | | `fields` | `array` | Optional. Additional fields the customer must fill before submitting. See [Field object](#field-object). | ### Field object [#field-object] When a payment method needs additional input (for example, a bank identifier for iDEAL), the `fields` array describes each form field. Supply the collected values as the second argument to `checkout.headless()`. | Field | Type | Description | | ------------- | -------- | ------------------------------------------------------------------------------------------------------- | | `id` | `string` | Field name. Use this as the key when passing values to `checkout.headless()`. | | `label` | `string` | User-friendly label for the field. | | `type` | `string` | One of `"input"`, `"date"`, `"checkbox"`, `"radio"`, or `"select"`. Defaults to `"input"` when omitted. | | `validation` | `object` | Optional. Constraints on the field value. See [Validation](#validation). | | `placeholder` | `string` | Optional. Placeholder text for the field. | | `inputType` | `string` | Optional. HTML input `type` attribute (for example, `"email"` or `"tel"`). | | `options` | `array` | Optional. Choices for `select` and `radio` fields. Each item has `{ label: string, value: string }`. | | `description` | `string` | Optional. Hint text to guide the customer, typically rendered below the field or in a tooltip. | ### Validation [#validation] When present, the `validation` object can include any combination of these constraints: ```ts { required?: boolean max?: number min?: number maxLength?: number minLength?: number pattern?: string } ``` ## Example [#example] ```js const paymentMethods = await checkout.getPaymentMethods() // Example response // [ // { // paymentMethodType: 'card', // name: 'Card', // supportedCardBrands: ['amex', 'discover', 'mastercard', 'visa'] // }, // { paymentMethodType: 'applepay', name: 'ApplePay' }, // { paymentMethodType: 'googlepay', name: 'GooglePay' } // ] // Render each method in your UI paymentMethods.forEach(method => { console.log(method.paymentMethodType, method.name) }) // When the customer selects a method, submit with checkout.headless() await checkout.headless(selectedMethod.paymentMethodType, fieldValues) ``` The checkout session must be initialized before you call this method. `getPaymentMethods()` returns a promise, so `await` it or use `.then()`. ## Next steps [#next-steps] * [Display available payment methods](/payments/alternative-payment-methods/headless-checkout): Step-by-step guide for building a payment method selector. * [checkout.headless()](/sdks/pay-com-js/checkout-headless): Submit a payment using the selected payment method. * [checkout.canMakePayments()](/sdks/pay-com-js/checkout-can-make-payments): Detect Apple Pay and Google Pay availability before rendering wallet buttons. # Submit a headless payment (/sdks/pay-com-js/checkout-headless) The `checkout.headless()` method submits a payment using card data or a wallet trigger collected from your own UI. This method doesn't render a form. ```ts const result = await checkout.headless(type, data?, billingDetails?, options?) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | ---------------- | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `type` | `string` | Yes | The payment method type. See the supported values below. | | `data` | `object` | Conditional | Required for `card` and `ideal`. Not required for wallet and redirect methods. Pass `undefined` when you only need a later argument. | | `billingDetails` | `object` | No | Billing address sent with card payments (`{ line1, line2?, city, state?, country, postalCode }`), where `country` is a two-letter country code. | | `options` | `object` | No | `saveSourceForFutureUse` (`boolean`, for card payments), `forceRedirect` (`boolean`, for APM redirects, navigates the whole page to the provider instead of opening it in a modal or a new tab), and `onValidateSession` (Apple Pay and Google Pay only, described in [Validate a session](/sdks/pay-com-js/on-validate-session)). | Supported `type` values: | Value | Description | `data` required | | ------------- | --------------------- | ----------------------- | | `'card'` | Credit or debit card | Yes | | `'applepay'` | Apple Pay | No | | `'googlepay'` | Google Pay | No | | `'ideal'` | iDEAL bank redirect | Yes (`{ bic: string }`) | | `'giropay'` | giropay bank redirect | No | Other enabled payment methods use the `paymentMethodType` value that [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods) returns, with any `fields` it lists passed as `data`. When `type` is `'card'`, the `data` object accepts: | Field | Type | Required | Description | | ----------------- | -------- | -------- | ---------------------------------------------------- | | `number` | `string` | Yes | Card number, no spaces or dashes. | | `cvv` | `string` | Yes | Card security code. Not required in payout sessions. | | `expirationMonth` | `string` | Yes | Two-digit month, for example `'12'`. | | `expirationYear` | `string` | Yes | Two-digit year, for example `'28'`. | | `name` | `string` | No | Cardholder name as it appears on the card. | ## Returns [#returns] A promise that resolves with the result. For a **payment session**, the result is the payment, the same `PaymentResult` object described on [`pay.checkout()`](/sdks/pay-com-js/pay-checkout). The SDK also calls `onSuccess`, or `onPending` when the payment is pending. For a **tokenization session** with `type: 'card'`, the result is a token object: ```json { "token": { "id": "tok_card_685104577720095744" }, "type": "token" } ``` If the payment fails, the SDK calls `onFailure` and the promise rejects with a `{ message, data }` object. Always wrap the call in `try`/`catch`. ## Example [#example] ```js // Card payment try { const payment = await checkout.headless('card', { number: '4111111111111111', cvv: '123', expirationMonth: '12', expirationYear: '28', name: 'Jane Smith', }) } catch (error) { console.log('Payment failed:', error.message) } // Card payment with a billing address, saving the card for future use await checkout.headless( 'card', { number: '4111111111111111', cvv: '123', expirationMonth: '12', expirationYear: '28' }, { line1: '1 Main St', city: 'New York', state: 'NY', country: 'US', postalCode: '10001' }, { saveSourceForFutureUse: true } ) // Apple Pay await checkout.headless('applepay') // iDEAL await checkout.headless('ideal', { bic: 'SNSBNL2A' }) ``` # Listen for checkout events (/sdks/pay-com-js/checkout-on) The `checkout.on()` method registers a callback for an event the checkout emits, such as the form becoming ready or a payment succeeding. Use it to update your page as the checkout changes. ```ts checkout.on(checkout.EVENT_TYPES.PAYMENT_SUCCESS, (payment) => { console.log('Paid:', payment.transaction) }) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | ----------- | ---------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `eventName` | `checkout.EVENT_TYPES` value | Yes | The event to listen for. Each value is the event's name. For example, `checkout.EVENT_TYPES.PAYMENT_SUCCESS` is `'payment_success'`. In TypeScript, pass the `EVENT_TYPES` value. | | `callback` | `(payload) => void` | Yes | Called each time the event is emitted, with the event's payload when it has one. | `checkout.once()` takes the same parameters and calls the callback only the first time. `checkout.removeListener(eventName, callback)` removes a callback. Listeners stay registered for the page, across `pay.checkout()` calls, until you remove them. ## Events [#events] The checkout emits events for payments, setup sessions, the session, and the form. ### Payments [#payments] Payment events follow each payment attempt, from its start to its result. | `EVENT_TYPES` | Event | Payload | When | | -------------------------- | -------------------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `PAYMENT_PROCESSING` | `payment_processing` | None | A payment starts. The customer submits the form or taps a wallet or payment method button, or you call `checkout.headless()` or `checkout.pay()`. | | `PAYMENT_SUCCESS` | `payment_success` | The `PaymentResult` object, matching what `onSuccess` receives. | A payment succeeds. | | `PAYMENT_PENDING` | `payment_pending` | The payment, as for `payment_success`. | A payment was accepted but isn't final yet. Confirm its status with webhooks. | | `PAYMENT_FAILURE` | `payment_failure` | The `PaymentError` object (`{ message, data }`), matching what `onFailure` receives. | A payment attempt fails. | | `PAYMENT_PENDING_APPROVAL` | `payment_pending_approval` | The payment, as the API returned it. | In Universal checkout, a payment came back `pending`, and the form keeps checking until its status is final. | [`pay.checkout()`](/sdks/pay-com-js/pay-checkout) describes `PaymentResult` and `PaymentError`. [`checkout.pay()`](/sdks/pay-com-js/checkout-pay) doesn't call `onSuccess`, `onPending`, or `onFailure`, but it emits these events. ### Setup sessions [#setup-sessions] A setup session saves a payment method without charging it. These events mark its progress. | `EVENT_TYPES` | Event | Payload | When | | ------------------ | ------------------ | ----------------------------------------------------- | --------------------------------------------------------------------- | | `SETUP_PROCESSING` | `setup_processing` | None | In a Universal checkout setup session, the customer submits the form. | | `SETUP_SUCCESS` | `setup_success` | The setup result, matching what `onSuccess` receives. | In a Universal checkout setup session, the payment method is saved. | ### The session [#the-session] Both session events mean the session can't take another payment. | `EVENT_TYPES` | Event | Payload | When | | ---------------------- | ---------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `SESSION_EXPIRED` | `session_expired` | None | In Universal checkout, the session's `client_secret` expired, so the form can't take a payment anymore. | | `MAX_ATTEMPTS_REACHED` | `max_attempts_reached` | The error of the last attempt. | In Universal checkout, the session's last attempt failed, so the session can't be paid again. This event comes before that attempt's `payment_failure`. | ### The form [#the-form] Form events report when the checkout loads, and when the form's validity, card funding type, or enabled state changes. | `EVENT_TYPES` | Event | Payload | When | | -------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CONTENT_READY` | `content_ready` | None | The Universal checkout form has loaded. Call [`checkout.updateMetadata()`](/sdks/pay-com-js/checkout-update-metadata) after it. | | `HEADLESS_READY` | `headless_ready` | None | Headless checkout has loaded the session. | | `FORM_VALIDATION_UPDATED` | `form_validation_update` | `{ validationResult }`, where `validationResult` is `true` when every field is valid. | The Universal checkout form becomes valid or invalid. | | `CARD_FUNDING_TYPE_UPDATE` | `card_funding_type_update` | `{ fundingType }`, for example `'debit'`, or `null` when unknown. | In Universal checkout, the funding type of the card being entered or selected changes. The SDK looks it up only while you listen for this event, and then passes it to [`onValidateSession`](/sdks/pay-com-js/on-validate-session) as `fundingType`. | | `SET_DISABLE_UI` | `set_disable_ui` | `{ data }`, where `data` is `true` when the form was disabled and `false` when it was enabled. | The Universal checkout form was disabled or enabled, for example by `setDisabled()` on the object [`checkout.universal()`](/sdks/pay-com-js/checkout-universal) returns. | Events are browser-side, like `onSuccess`. Always confirm payments server-side using webhooks before you fulfill an order. ## Example [#example] ```js checkout.on(checkout.EVENT_TYPES.PAYMENT_PROCESSING, () => { showSpinner() }) checkout.on(checkout.EVENT_TYPES.PAYMENT_SUCCESS, (payment) => { hideSpinner() console.log('Paid:', payment.transaction) }) checkout.on(checkout.EVENT_TYPES.PAYMENT_FAILURE, (error) => { hideSpinner() console.log('Payment failed:', error.message) }) ``` # Pay with a saved payment method (/sdks/pay-com-js/checkout-pay) The `checkout.pay()` method submits a payment using a saved payment method. Use it in a **Headless checkout** integration with [`checkout.getExistingSources()`](/sdks/pay-com-js/checkout-get-existing-sources) to let returning customers pay with a payment method they've saved from a previous purchase. For **payouts**, `checkout.pay()` doesn't send money. It registers the payout source the customer selected from `checkout.getExistingSources()` through the setup session. Your server confirms the choice on the session, then uses it as the `destination` when calling the [Create a payout](/api-reference/endpoints/payouts/create-payout) API. See [Payout flow](#payout-flow). **Headless checkout only.** Universal checkout handles saved payment methods through its built-in UI. You need this method only when you build your own checkout UI with Headless checkout. ```ts const result = await checkout.pay({ source, cvv }) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | --------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------- | | `source` | `string` | Yes | The `id` from a saved source returned by `checkout.getExistingSources()`. | | `cvv` | `string` | No | Card security code. Required when the source's `cvvExists` is `false`. Can be omitted when `cvvExists` is `true`. | ## Returns [#returns] `checkout.pay()` returns a promise that resolves with the payment result. Unlike [`checkout.headless()`](/sdks/pay-com-js/checkout-headless), it does **not** call the `onSuccess`, `onPending`, or `onFailure` callbacks registered on `pay.checkout()`. Use the resolved value, or listen for `checkout.EVENT_TYPES.PAYMENT_SUCCESS` and `checkout.EVENT_TYPES.PAYMENT_PENDING` with [`checkout.on()`](/sdks/pay-com-js/checkout-on). If the payment fails, the promise rejects with a `{ message, data }` object, so wrap the call in `try`/`catch`. | Field | Type | Description | | --------------- | -------- | ------------------------------------------------------------------------------------------- | | `transaction` | `string` | The charge ID (for example, `"chrg_742353659387446272"`). | | `customer` | `string` | The Pay.com customer ID. | | `status` | `string` | Payment status, for example `"succeeded"`, or `"pending"` when the payment isn't final yet. | | `paymentMethod` | `string` | The stored payment method ID used for this charge. | | `amount` | `number` | The charged amount in minor units. | `checkout.pay()` returns the result in the browser. Always confirm payments server-side using webhooks. Don't rely on client-side results for order fulfillment. ## Example [#example] Pay with a card the customer saved earlier. ### Payment example [#payment-example] ```js // 1. Retrieve saved payment methods const existingSources = await checkout.getExistingSources() // 2. Customer selects a saved card (your UI logic) const selected = existingSources[0] // 3. Pay with the saved card. Pass the CVV when selected.card.cvvExists is false. try { const result = await checkout.pay({ source: selected.id, cvv: '123', }) console.log(result.status) // 'succeeded' console.log(result.transaction) // 'chrg_742353659387446272' } catch (error) { console.log('Payment failed:', error.message) } // Or listen for the result as an event checkout.on(checkout.EVENT_TYPES.PAYMENT_SUCCESS, (payment) => { console.log('Paid:', payment.transaction) }) ``` ## Payout flow [#payout-flow] When the checkout is initialized with a payout setup session (`payout: true`), [`checkout.getExistingSources()`](/sdks/pay-com-js/checkout-get-existing-sources) returns only payout-capable sources. In this case, `checkout.pay()` does **not** send money. It registers the customer's selection and resolves with the result, whose `paymentMethod` is the selected payment method ID. It doesn't call `onSuccess`. Tell your server the recipient is done. Your server confirms the choice on the setup session, then uses that method as the `destination` when calling the [Create a payout](/api-reference/endpoints/payouts/create-payout) API. For the full flow, including creating a payout setup session and handling webhooks, see [Let recipients choose a payout method](/payouts/payout-method-selection). ### Payout example [#payout-example] ```js // 1. Start checkout with the payout setup session's client secret const checkout = pay.checkout({ clientSecret }) // 2. Retrieve saved payout-capable sources const existingSources = await checkout.getExistingSources() // 3. Customer selects a saved source: register the selection const selected = existingSources[0] try { const result = await checkout.pay({ source: selected.id }) // 4. Tell your server the recipient is done. It retrieves the setup // session, checks that it's completed for this recipient, and pays out // to its payment_method (amount in minor units: 10000 is $100.00): // POST /v1/payouts // { // "amount": 10000, // "currency": "usd", // "customer_reference_id": "user_10", // "destination": "" // } await tellServerRecipientIsDone() } catch (error) { console.error('Selection failed:', error.message) } ``` ## Next steps [#next-steps] * [Pay with a saved card](/payments/saved-cards/pay-with-a-saved-card): Full guide for building a saved card checkout flow. * [Let recipients choose a payout method](/payouts/payout-method-selection): Full guide for the payout method selection flow. * [checkout.getExistingSources()](/sdks/pay-com-js/checkout-get-existing-sources): Retrieve the customer's saved payment methods or payout sources. * [Save a payment method](/payments/set-up-a-card/save-a-payment-method): Store a customer's card for future use. # Submit the form (/sdks/pay-com-js/checkout-submit) The `checkout.submit()` method programmatically submits the Universal checkout form. Call it after a successful `checkout.validate()` when you use a custom submit button with `toggles: { submitButton: false }`. ```ts const payment = await checkout.submit() ``` This method applies only to Universal checkout. For Headless checkout, use `checkout.headless()` to submit payments directly. ## Parameters [#parameters] None. ## Returns [#returns] A promise that resolves with the payment result, the same `PaymentResult` object that [`onSuccess`](/sdks/pay-com-js/pay-checkout) receives. If the payment fails and `throwOnSubmitFailure` on `pay.checkout()` is `true` (the default), the promise rejects with a `{ message, data }` object (not an `Error` instance). With `throwOnSubmitFailure: false`, it doesn't reject. Handle the failure in `onFailure`. ## Example [#example] ```js try { const payment = await checkout.submit() console.log('Submitted:', payment?.transaction) } catch (error) { console.log('Payment failed:', error.message) } ``` # Render the checkout form (/sdks/pay-com-js/checkout-universal) The `checkout.universal()` method renders the hosted Pay.com checkout form inside a container element on your page. The form includes card fields, wallet buttons, saved payment methods, APM buttons, and a submit button. ```ts const universal = checkout.universal(options) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | ----------------------------------------- | ------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `container` | `string` | Yes | CSS selector for the DOM element the form renders in, for example `'#pay-com-checkout'`. | | `style` | `object` | No | Style override object for the form's visual appearance. See the [customization guide](/payments/customize-the-checkout) and the [style object reference](/sdks/pay-com-js/style-reference). | | `toggles` | `object` | No | Checkout-level display toggles. See [Configuration](/sdks/pay-com-js/configuration). | | `toggles.submitButton` | `boolean` | No | Set to `false` to hide the built-in submit button. Default: `true`. | | `toggles.title` | `string` | No | A title string to display above the checkout form. | | `toggles.savedCardsBins` | `boolean \| number` | No | Show the card BIN on saved cards. `true` for the default number of digits, or a number from `2` to `6`. Default: `false`. | | `toggles.savedPaymentMethodInlineCvv` | `boolean` | No | Render the CVV field inline on a saved payment method. Default: `false`. | | `toggles.allowOnlyExistingPaymentMethods` | `boolean` | No | Show only saved payment sources. Default: `false`. | | `toggles.disablePaymentMethodDeletion` | `boolean` | No | Prevent the customer from removing saved sources. Default: `false`. | | `cardForm` | `object` | No | Card form configuration, including toggles and field configuration. | | `cardForm.toggles` | `object` | No | Card-form-specific toggles. See [Card form toggles](/payments/customize-the-checkout/card-form#configure-card-form-toggles). | | `cardForm.formConfig` | `object` | No | Field labels, placeholders, and error message styles. See [Card form](/payments/customize-the-checkout/card-form#customize-field-labels-placeholders-and-error-messages). | | `paymentMethods` | `string[]` | No | Restrict the payment methods shown to the types you list, for example `['card', 'applepay', 'googlepay']`. | | `selectedPaymentMethod` | `string` | No | Preselect a payment method when the form renders. | | `alternatives` | `'button' \| 'radio'` | No | Layout style for alternative payment methods. `'button'` renders each APM as a clickable button. `'radio'` renders a radio button list. Some payment methods (for example, iDEAL) appear only when it's `'radio'`. Default: `'button'`. | | `onValidateSession` | `(data: ValidateSessionData) => Promise` | No | Runs when the customer starts a payment with any method. Return `false` to block it. See [Validate a session](/sdks/pay-com-js/on-validate-session). Replaces the deprecated `apmsOnClickValidation`. | | `localizations` | `object` | No | Multi-language string overrides. See [Localization](/payments/customize-the-checkout/localization). | With `alternatives: 'radio'`, the form lists the payment methods as radio options: ## Returns [#returns] An object with `setDisabled(disabled: boolean)`, which disables or enables the rendered form. The form renders inside the specified container. ## Example [#example] ```js // Basic render checkout.universal({ container: '#pay-com-checkout' }) // With a custom submit button checkout.universal({ container: '#pay-com-checkout', toggles: { submitButton: false } }) // Restrict to specific payment methods with a pre-selection checkout.universal({ container: '#pay-com-checkout', paymentMethods: ['card', 'applepay', 'googlepay'], selectedPaymentMethod: 'card', }) // Show APMs as radio buttons (required for iDEAL in Universal checkout) checkout.universal({ container: '#pay-com-checkout', alternatives: 'radio', }) // Saved-cards-only checkout for returning customers checkout.universal({ container: '#pay-com-checkout', toggles: { allowOnlyExistingPaymentMethods: true, disablePaymentMethodDeletion: true, savedCardsBins: 4, } }) ``` # Update metadata (/sdks/pay-com-js/checkout-update-metadata) `checkout.updateMetadata()` attaches key-value pairs to an active payment session from the browser so your routing rules can react to customer choices (such as a promotion toggle or shipping tier) without recreating the session. ```ts checkout.updateMetadata( metadata: Record ): Promise ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | ---------- | --------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------- | | `metadata` | `Record` | Yes | Key-value pairs to attach to the session (at least one). Nested objects and arrays are not supported. | ## Returns [#returns] `Promise`. Resolves when metadata is saved and rejects if the call fails. ## Behavior [#behavior] Every call follows these rules. | Property | Behavior | | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Timing** | Call it after the `content_ready` (Universal checkout) or `headless_ready` (Headless checkout) event fires. Listen for them with [`checkout.on()`](/sdks/pay-com-js/checkout-on). Calling it before rendering rejects with `Unable to perform checkout actions before rendering`. | | **Repeat calls** | Allowed. Call it as many times as you need before payment is submitted. | | **Merge semantics** | Each call is a partial update. Keys you send are added or overwritten, and keys you don't send are left unchanged. | | **Values** | Stored as text. For example, `true` becomes `"true"`, and `3` becomes `"3"`. | | **Scope** | The current checkout session only. A new `pay.checkout(...)` call starts a fresh session with its own metadata. | | **UI effect** | None. Metadata doesn't change what the customer sees, the amount, or the available payment methods. | ## Key naming [#key-naming] Each key you send is stored on the session with a `checkout_` prefix. A key named `customer_tier` becomes `metadata.checkout_customer_tier` in routing rule conditions. Send the plain key. The prefix is added automatically. The prefix separates metadata set from the browser from metadata set on the server when the session was created, so your routing rules can distinguish between the two sources. Values arrive as text, so compare against `"true"`, not `true`. ## Errors [#errors] The promise rejects with the standard Pay.com error shape: ```js try { await checkout.updateMetadata({ customer_tier: 'gold' }) } catch (error) { // error.message → 'Failed to update metadata' // error.data → the metadata object you passed } ``` Always `await` the call or attach a `.catch()` handler. Otherwise, a failed call surfaces as an unhandled promise rejection on your page. ## Example [#example] ```js const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID' }) const checkout = pay.checkout({ clientSecret: CLIENT_SECRET, onSuccess: (payment) => console.log('Payment succeeded:', payment), onFailure: (error) => console.log('Payment failed:', error), }) checkout.universal({ container: '#payment-element' }) // Wait for the SDK to render, then update metadata when the customer acts checkout.on(checkout.EVENT_TYPES.CONTENT_READY, () => { // A customer opts into a draw. Update metadata so routing rules can // send this payment to the correct processor document.querySelector('#enter-draw').addEventListener('change', async (e) => { await checkout.updateMetadata({ enter_draw: e.target.checked }) }) }) ``` A routing rule referencing `metadata.checkout_enter_draw` can then direct the payment to a different acquirer when the value is `"true"`. You create routing rules in the Pay.com dashboard. See [Routing rules](/payments/routing/routing-rules). Don't put cardholder data, PII you don't need, or secrets in metadata. It's stored on the transaction and visible wherever the transaction is visible. ## Next steps [#next-steps] * [Pass custom data to routing rules](/payments/routing/custom-data): Step-by-step integration guide with full context. # Validate form fields (/sdks/pay-com-js/checkout-validate) The `checkout.validate()` method checks the current state of the Universal checkout form fields without submitting the form. Call it before `checkout.submit()` when you submit the form with your own button. ```ts const result = await checkout.validate() ``` ## Parameters [#parameters] None. ## Returns [#returns] | Field | Type | Description | | --------------- | ---------- | --------------------------------------------------------------------- | | `valid` | `boolean` | `true` if all required fields pass validation. | | `invalidFields` | `string[]` | Names of fields that failed validation. Empty when `valid` is `true`. | ## Example [#example] ```js const { valid, invalidFields } = await checkout.validate() if (valid) { await checkout.submit() } else { console.log('Fix these fields:', invalidFields) } ``` # Configuration (/sdks/pay-com-js/configuration) Universal checkout accepts several top-level options on `checkout.universal()` that go beyond visual styling. Use these to control what the checkout displays, how payment method selection works, and which methods are available to the customer. ## Checkout-level toggles [#checkout-level-toggles] Pass a `toggles` object at the top level of `checkout.universal()` to control form-wide display options. These are separate from the card-form-specific toggles described on the [Card form](/payments/customize-the-checkout/card-form#configure-card-form-toggles) page. | Key | Default | Description | | --------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `submitButton` | `true` | Set to `false` to hide the built-in submit button. | | `title` | None | A title string to display above the entire checkout form. | | `savedCardsBins` | `false` | Show the card BIN alongside the last 4 digits on saved cards. Set to `true` to show the default number of digits, or a number between `2` and `6` to control how many BIN digits appear. | | `savedPaymentMethodInlineCvv` | `false` | Render the CVV field inline on a saved payment method row. | | `allowOnlyExistingPaymentMethods` | `false` | Show only the customer's saved payment sources. New card entry and other payment methods are hidden. | | `disablePaymentMethodDeletion` | `false` | Prevent the customer from removing saved payment sources. | ```js checkout.universal({ container: '#pay-com-checkout', toggles: { title: 'Complete your purchase', savedCardsBins: 4, disablePaymentMethodDeletion: true, } }) ``` To restrict the checkout to saved payment methods only (for example, for returning subscribers), set `allowOnlyExistingPaymentMethods` to `true`. The customer won't see the new card form or any APM buttons. ## Payment method options [#payment-method-options] These top-level options on `checkout.universal()` control which payment methods appear and how the customer selects them. | Key | Type | Default | Description | | ----------------------- | ---------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `paymentMethods` | `string[]` | None | Restrict the payment methods shown in the form. Only the payment method types you list appear, for example `['card', 'applepay', 'googlepay']`. | | `selectedPaymentMethod` | `string` | None | Preselect a payment method when the form renders. The customer can still switch to another method. | | `alternatives` | `'button'` \| `'radio'` | `'button'` | Layout style for alternative payment method options. `'button'` renders each as a clickable button. `'radio'` renders radio inputs. | | `onValidateSession` | `(data) => Promise` | None | An async function called when the customer starts a payment with any method. Return `true` to let the payment proceed, or `false` to block it. Replaces the deprecated `apmsOnClickValidation`. | ```js checkout.universal({ container: '#pay-com-checkout', paymentMethods: ['card', 'applepay', 'googlepay'], selectedPaymentMethod: 'card', alternatives: 'radio', }) ``` ### Validate before a payment starts [#validate-before-a-payment-starts] Use `onValidateSession` to run custom checks when the customer starts a payment, for example to make sure a shipping address is filled in. ```js checkout.universal({ container: '#pay-com-checkout', onValidateSession: async ({ paymentMethodType }) => { const addressComplete = await validateShippingAddress() return addressComplete }, }) ``` If the function returns `false`, the payment doesn't proceed. See [Validate a session](/sdks/pay-com-js/on-validate-session) for the data it receives and when it runs. `apmsOnClickValidation` is deprecated. It runs only when an alternative payment method payment starts, and only if `onValidateSession` isn't set. Use `onValidateSession` instead. ## Next steps [#next-steps] * [Card form](/payments/customize-the-checkout/card-form): Card form toggles, field styling, and custom submit buttons. * [Localization](/payments/customize-the-checkout/localization): Override display text for multiple languages. * [Style object reference](/sdks/pay-com-js/style-reference): Full list of every accepted style key and CSS property. # Install and initialize (/sdks/pay-com-js) Install Pay.com.js and initialize it with your merchant ID before rendering Universal checkout, Headless checkout, or secure card fields. Before you begin, retrieve these credentials from the **Developers** tab of the [Pay.com dashboard](https://dashboard.pay.com): * **API key:** Used on your server to create sessions. Never expose it in browser code. * **Merchant ID:** Passed to `Pay.com({ identifier })` in the browser. ## Set up Pay.com.js [#set-up-paycomjs] Install the package or load the script, then initialize it with your merchant ID. ### Install Pay.com.js [#install-paycomjs] Install `@pay-com/js` with npm or yarn, or load it from the CDN. Both provide the full SDK. Install the package with npm or yarn: ```bash npm install --save @pay-com/js # or yarn add @pay-com/js ``` Import Pay.com.js in your module: ```ts import Pay from '@pay-com/js' ``` The package includes TypeScript definitions, so you can import types directly from `@pay-com/js` without a separate `@types` package: ```ts import type { UniversalOpts } from '@pay-com/js' const style: UniversalOpts['style'] = { base: { fontFamily: "'Inter', sans-serif" } } ``` `UniversalOpts` is the type of the options object you pass to `checkout.universal()`. Typing your `style` overrides as `UniversalOpts['style']` gives you editor autocomplete before you pass them to `checkout.universal()`. See [Customize the checkout](/payments/customize-the-checkout) for usage. Load the script as early as possible in the `` of your checkout page. Pay.com.js then preloads checkout assets, and [device fingerprinting](/risk/device-fingerprinting) has more time to collect device signals. ```html ``` The script exposes `window.Pay` globally without an import statement. ### Initialize Pay.com.js [#initialize-paycomjs] Initialize Pay.com.js with your merchant ID (`identifier`) to obtain a `pay` instance. The payment session is attached later via `clientSecret` in `pay.checkout()`. With `@pay-com/js`, `Pay.com()` returns a promise and defaults to the sandbox. Pass `live: true` in live. ```ts import Pay from '@pay-com/js' const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID', // live: true, // Uncomment for live payments }) ``` With the CDN script, `window.Pay.com()` returns the `pay` instance synchronously. The script is the same in the sandbox and live, and Pay.com.js works in the environment of the session you give it. ```js const pay = window.Pay.com({ identifier: 'YOUR_MERCHANT_ID', }) ``` With the npm package, match `live` to your sessions. Pass `live: true` with sessions you create on `https://api.pay.com/v1`, and leave it out with sessions you create on `https://api.sandbox.pay.com/v1`. ## SDK architecture [#sdk-architecture] Pay.com.js is organized around three objects (the top-level `Pay` module, a `pay` instance returned by [`Pay.com()`](/sdks/pay-com-js/pay-com), and a `checkout` instance returned by [`pay.checkout()`](/sdks/pay-com-js/pay-checkout)). ## Choose your integration mode [#choose-your-integration-mode] Continue with the guide for your checkout architecture: Pre-built hosted checkout form with card fields, wallets, and a submit button. Custom checkout UI backed by Pay.com.js submission methods. Collect a card token without charging immediately. Combine hosted wallet buttons with a custom card form on one page. # Validate a session (/sdks/pay-com-js/on-validate-session) `onValidateSession` is an async callback that runs before a payment attempt starts. Return `true` to continue or `false` to block the payment. * **Universal checkout (`checkout.universal()`):** Runs for every payment method when the customer submits the form or selects a wallet or alternative payment method. * **Headless checkout (`checkout.headless()`):** Runs only for `applepay` and `googlepay`. For cards and APMs, run validation before calling `checkout.headless()`. ## Callback signature [#callback-signature] The callback receives a `ValidateSessionData` object and returns a promise that resolves to a boolean. ```ts type ValidateSessionData = { paymentMethodType: string fundingType?: 'prepaid' | 'debit' | 'credit' | null walletResponse?: ApplePayPayment | GooglePayPaymentData } type OnValidateSession = (data: ValidateSessionData) => Promise ``` ## Parameters [#parameters] The `ValidateSessionData` object has these fields: | Parameter | Type | Description | | ------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `paymentMethodType` | `string` | Payment method being validated (`card`, `click_to_pay`, `googlepay`, `applepay`, `paypal`, or an APM identifier such as `paysafecard` or `skrill`). | | `fundingType` | `'prepaid' \| 'debit' \| 'credit' \| null` | Card funding type when available. In Universal checkout, included only if you registered a `checkout.EVENT_TYPES.CARD_FUNDING_TYPE_UPDATE` listener with [`checkout.on()`](/sdks/pay-com-js/checkout-on). In Headless checkout, included for Apple Pay and Google Pay. | | `walletResponse` | `ApplePayPayment \| GooglePayPaymentData` | Raw native wallet response for Apple Pay and Google Pay only. | ## Returns [#returns] `Promise`. Return `true` to allow the payment or `false` to block it. In Universal checkout, throwing an error also blocks the payment. In Headless checkout, returning `false` calls `onFailure` and rejects `checkout.headless()`. ## Example [#example] Pass `onValidateSession` in `checkout.universal()` options or as the 4th argument of `checkout.headless()`. `Pay.com()` doesn't accept it. ```js checkout.universal({ container: '#pay-com-checkout', onValidateSession: async ({ paymentMethodType, fundingType, walletResponse }) => { if (paymentMethodType === 'card') { return validateCardFundingType(fundingType) } if (paymentMethodType === 'applepay' || paymentMethodType === 'googlepay') { return validateWalletPayment(walletResponse) } return isPaymentMethodAllowed(paymentMethodType) } }) ``` `onValidateSession` replaces the deprecated `apmsOnClickValidation` option. If both are passed, only `onValidateSession` runs. ```js checkout.headless('applepay', undefined, undefined, { onValidateSession: async ({ walletResponse }) => { return validateWalletPayment(walletResponse) } }) ``` Keep `onValidateSession` fast, because it blocks the customer's checkout flow. Perform authoritative order, eligibility, and risk checks on your server. ## Next steps [#next-steps] * [`checkout.universal()`](/sdks/pay-com-js/checkout-universal): All Universal checkout options. * [`checkout.headless()`](/sdks/pay-com-js/checkout-headless): Submit payments from a custom UI. * [Configuration](/sdks/pay-com-js/configuration): Checkout display toggles and payment method selection. # Authenticate with 3DS (/sdks/pay-com-js/pay-authentication) This method is in beta. The `pay.authentication()` method renders the 3DS bank challenge in a modal overlay when a charge, hold, or payment method returns `requires_authentication`. The customer completes verification without leaving your page. ```ts pay.authentication(options) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | -------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `clientSecret` | `string` | Yes | The `client_secret` from the [linked authentication session](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) created on your server. | ## Returns [#returns] Nothing. The method returns immediately after it opens the challenge overlay. To learn the outcome, wait for the `authentication_session.authenticated` or `authentication_session.failed` [webhook event](/api-reference/webhooks/webhook-events), or poll [`GET /v1/sessions/authentication/{id}`](/api-reference/endpoints/authenticationsessions/get-sca-by-id) from your server. What happens next depends on the `confirm` field of the linked authentication session: * **`confirm: true`** (the default): Pay.com confirms the original transaction after successful authentication. Don't call a confirm endpoint. Wait for the transaction's webhook event. * **`confirm: false`**: After the session is authenticated, confirm the original transaction from your server with the matching endpoint ([confirm a charge](/api-reference/endpoints/charges/confirm-charge), [confirm a hold](/api-reference/endpoints/holds/hold-confirm), or [confirm a payment method](/api-reference/endpoints/paymentmethods/confirm-payment-method)). ## Example [#example] ```js // After receiving requires_authentication from a charge, hold, or payment method: const authSession = await createLinkedAuthSession(resourceId) // Opens the challenge and returns immediately pay.authentication({ clientSecret: authSession.client_secret }) // On your server: wait for the authentication_session.authenticated // webhook (or poll the session). If the linked session was created with // confirm: false, then confirm the original charge, hold, or payment method. ``` # Create a checkout (/sdks/pay-com-js/pay-checkout) The `pay.checkout()` method binds a checkout to an authorized session and registers the callbacks that receive the result of the payment flow. Call this before rendering a form or submitting a payment. ```ts const checkout = pay.checkout(options) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | -------------------------------------------- | ---------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `clientSecret` | `string \| () => Promise` | Yes | The `client_secret` returned from creating a session on your server, or an async function that returns it. Authorizes the checkout on the client. | | `onSuccess` | `(payment: PaymentResult) => void` | No | Callback fired when the checkout flow completes successfully in the browser. | | `onFailure` | `(error: PaymentError) => void` | No | Callback fired when the checkout flow encounters an error. | | `onPending` | `(payment: PaymentResult) => void` | No | Callback fired instead of `onSuccess` when the payment is accepted but not final yet (for example, some alternative payment methods). Confirm the final status with webhooks. | | `locale` | `string` | No | Checkout language, for example `'de-DE'`. See [Localization](/payments/customize-the-checkout/localization). | | `throwOnSubmitFailure` | `boolean` | No | When `true`, [`checkout.submit()`](/sdks/pay-com-js/checkout-submit) rejects if the payment fails. Default: `true`. | | `mode` | `'integrated' \| 'modal'` | No | Controls whether the form renders inline in the container passed to [`checkout.universal()`](/sdks/pay-com-js/checkout-universal) (`'integrated'`) or opens in a modal from a placed button (`'modal'`). Default: `'integrated'`. | | `toggles` | `object` | No | Checkout-wide display options. These are separate from the `toggles` of `checkout.universal()`. | | `toggles.displayFailureMessages` | `boolean` | No | Show a failed attempt's message in the form. The customer closes it to try again. Default: `false`. | | `toggles.displayEndOfSessionFailureMessages` | `boolean` | No | Show a message in the form when the session expires or has no attempts left. Default: `true`. | The `onSuccess` and `onPending` callbacks receive a `PaymentResult` object: | Field | Type | Description | | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | | `amount` | `number` | The charged amount in minor units. `0` for setup sessions. | | `customer` | `string` | The Pay.com customer ID. | | `paymentMethod` | `string` | Stored payment method ID (`pm_card_xxx`). Present when `setup_future_usage` was set on the session. | | `status` | `string` | Transaction status, for example `succeeded` for a charge, `requires_capture` for a hold, or `pending` (passed to `onPending`). | | `transaction` | `string` | The charge (`chrg_…`), hold (`hld_…`), or setup session (`ss_…`) ID. | The `onFailure` callback receives a `PaymentError` object: | Field | Type | Description | | --------- | -------- | --------------------------------------------------- | | `message` | `string` | A human-readable description of the failure reason. | | `data` | `object` | Additional failure details, when available. | `onSuccess`, `onFailure`, and `onPending` are browser-only callbacks. Always confirm payments server-side using webhooks. Never rely on client-side callbacks for order fulfillment. ## Returns [#returns] A `checkout` instance used to render the form, validate fields, and submit payments. ## Example [#example] ```ts const checkout = pay.checkout({ clientSecret: CLIENT_SECRET, onSuccess: (payment) => { console.log('Payment succeeded:', payment.transaction) }, onFailure: (error) => { console.log('Payment failed:', error.message) }, }) ``` # Initialize the SDK (/sdks/pay-com-js/pay-com) The `Pay.com()` function initializes the SDK for your merchant account and returns a `pay` instance. This is always the first call in any integration. ```ts const pay = await Pay.com(options) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | ------------ | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `identifier` | `string` | Yes | Your Pay.com merchant ID, from the **Developers** tab of the [Pay.com dashboard](https://dashboard.pay.com). This isn't the session ID. Pay.com.js identifies the session by the `client_secret` you pass to [`pay.checkout()`](/sdks/pay-com-js/pay-checkout). | | `live` | `boolean` | No | npm package only. Set to `true` in live, with a live session. Default: `false`. With the script tag, this option has no effect. | ## Returns [#returns] A `pay` instance used to call [`pay.checkout()`](/sdks/pay-com-js/pay-checkout) and [`pay.authentication()`](/sdks/pay-com-js/pay-authentication). With the npm package, `Pay.com()` returns a promise that resolves with the instance. With the script tag, `window.Pay.com()` returns the instance directly. ## Example [#example] ```ts import Pay from '@pay-com/js' const pay = await Pay.com({ identifier: 'YOUR_MERCHANT_ID', live: true // omit for the sandbox }) ``` # Style reference (/sdks/pay-com-js/style-reference) The `style` parameter in `checkout.universal()` accepts a plain JavaScript object. Each key targets a specific region of the checkout form. All CSS property names must be in camelCase (for example, `borderRadius`, not `border-radius`). Values that aren't valid CSS properties are silently ignored. For examples of how to apply these styles, see [Customize the checkout](/payments/customize-the-checkout). ## Top-level keys [#top-level-keys] The `style` object accepts these keys at its top level. Simple keys accept CSS properties directly. Object keys have their own sub-keys, listed in [Sub-key reference](#sub-key-reference). | Key | Type | Description | | --------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `base` | CSS properties | Outermost wrapper of the entire form. Styles cascade into child regions unless a more specific key overrides them. | | `submit` | CSS properties | Main submit button at the bottom of the checkout form (the "Pay" button). | | `savedPaymentMethods` | CSS properties | Container wrapping the saved payment methods section. Only visible when the customer has saved cards. | | `expressCheckout` | CSS properties | Container wrapping the alternative payment method buttons (for example, Neosurf and paysafecard), the "Pay with" and "Pay with card" dividers, and the card form. | | `apmButtons` | CSS properties | Container wrapping wallet buttons (Google Pay and Apple Pay). | | `cardForm` | Object | Card input fields, checkboxes, and related elements. Nested inside `expressCheckout`. | | `dividers` | Object | Horizontal divider lines with text labels that separate form sections. | | `existingSource` | Object | Saved card rows, radio buttons, CVV re-entry field, and deletion UI. | | `paymentMethodFields` | Object | Input fields that APMs render in the radio layout (`alternatives: 'radio'`), for example the iDEAL bank selector. | ## Sub-key reference [#sub-key-reference] Each object key takes the sub-keys in its section. ### Card form fields (`cardForm`) [#card-form-fields-cardform] Controls the card input fields and checkboxes. Styles applied to `base` affect all four card fields as a group. Use individual field keys to target each field separately. The `color` property on `number`, `cvv`, `expiry`, and `name` targets input text only. To style field labels, use `cardForm.formConfig`, which is a separate top-level parameter on `checkout.universal()` and not part of the `style` object. | Key | Type | Description | | ----------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `base` | CSS properties | Shared container around all four card fields. | | `number` | CSS properties | Card number input field (input text and background only). | | `cvv` | CSS properties | CVV input field (input text and background only). | | `expiry` | CSS properties | Expiration date input field (input text and background only). | | `name` | CSS properties | Cardholder name input field (input text and background only). | | `number[':focus']` | `{ borderColor: string }` | Focus state for the card number field. Sets the focus border color and tints the focus ring to match. Only `borderColor` is read. Error and warning states take priority. | | `expiry[':focus']` | `{ borderColor: string }` | Focus state for the expiration field. Same behavior as `number[':focus']`. | | `cvv[':focus']` | `{ borderColor: string }` | Focus state for the CVV field. Same behavior as `number[':focus']`. | | `name[':focus']` | `{ borderColor: string }` | Focus state for the cardholder name field. Same behavior as `number[':focus']`. | | `submit` | CSS properties | Reserved for the submit button inside the card form. | | `checkboxes.buttonBackground` | `string` | Background color of checkbox buttons, for example "Save card for future use". | | `checkboxes.labelColor` | `string` | Text color of checkbox labels. | ### Card form configuration (`cardForm.formConfig`) [#card-form-configuration-cardformformconfig] `formConfig` is passed directly inside `cardForm` on `checkout.universal()`. It isn't part of the `style` object. Use it to control labels, placeholders, error message styles, and input sizes for each card field. ```js checkout.universal({ container: '#payment_container', cardForm: { formConfig: { ... } } }) ``` **formConfig.base** accepts these keys: | Key | Type | Description | | -------------- | -------------- | ------------------------------------------------------ | | `formTitle` | `string` | Title displayed at the top of the card form section. | | `titleStyles` | CSS properties | Style for the form title text. | | `inputSpacing` | `string` | Vertical spacing between fields, for example `'16px'`. | To style the wrapper around the card fields, use `style.cardForm.base`. **formConfig.number, formConfig.expiry, formConfig.cvv, formConfig.name** each accept: | Key | Type | Description | | ------------------- | ------------------------------------ | --------------------------------------------------------- | | `label` | `string` | Label text shown above the input. | | `labelStyle` | CSS properties | Color, font size, weight, and other styles for the label. | | `placeholder` | `string` | Placeholder text shown inside the input when empty. | | `errorMessageStyle` | CSS properties | Style for the inline validation error message. | | `inputSize` | `'small'` \| `'medium'` \| `'large'` | Controls the height of the input field. | | `style` | CSS properties | Additional styles applied to the input element itself. | ### Section dividers (`dividers`) [#section-dividers-dividers] Controls the horizontal lines with text labels that separate sections of the checkout form. | Key | Description | | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | `dividers.payWith` | "Pay with" divider between the wallet button and the alternative payment method buttons. | | `dividers.payWithCard` | "Pay with card" divider between the alternative payment method buttons and the card form. | | `dividers.savedPaymentMethods` | "Saved payment methods" divider above the saved payment methods list. Only visible when the customer has saved cards. | | `dividers.showOtherWaysToPay` | "Show other ways to pay" divider that appears when a customer has saved cards. Clicking it expands the full form with APMs and the card form. | Each divider accepts these sub-keys: | Sub-key | Type | Description | | --------- | -------------- | ---------------------------------------------------- | | `text` | CSS properties | Text label displayed on the divider. | | `divider` | CSS properties | The horizontal line, including `color` and `height`. | ### Saved card rows (`existingSource`) [#saved-card-rows-existingsource] Controls how saved card rows and their related UI appear when a returning customer has stored payment methods. `':selected'` and `':disabled'` are plain object keys, not CSS pseudo-classes. Write them as strings including the quotes, as in `':selected'`. | Key | Type | Description | | -------------------------------- | -------------- | --------------------------------------------------------------- | | `base` | CSS properties | Default appearance of each saved card row. | | `base[':selected']` | CSS properties | Appearance of the currently selected saved card row. | | `radioButton.color` | `string` | Default color of the radio button. | | `radioButton[':selected'].color` | `string` | Color of the radio button when that card row is selected. | | `cvv.style` | CSS properties | CVV re-entry input field shown when a saved card is selected. | | `cvv.errorMessageStyle` | CSS properties | Validation error text below the CVV field. | | `icons.delete` | CSS properties | Delete icon in its default state. | | `icons.confirmDeletion` | CSS properties | Confirm icon shown when the customer starts a deletion. | | `icons.cancelDeletion` | CSS properties | Cancel icon shown when the customer starts a deletion. | | `deleteText` | CSS properties | Confirmation message shown when the customer starts a deletion. | To style the label of the CVV re-entry field, use `cardForm.formConfig.cvv.labelStyle`, which is outside the `style` object. ### APM input styles (`paymentMethodFields`) [#apm-input-styles-paymentmethodfields] Styles the input fields that APMs render in the radio layout (`alternatives: 'radio'` on `checkout.universal()`). It has no effect in the default button layout. | Key | Type | Description | | ------------- | -------------------- | --------------------------------- | | `label` | CSS properties | Labels above APM input fields. | | `input` | CSS properties | Text input fields. | | `date` | CSS properties | Date input fields. | | `radio.color` | `string` | Color of radio button indicators. | | `radio.label` | CSS properties | Labels next to radio buttons. | | `select` | CSS-in-JS properties | Select (dropdown) elements. | | `checkbox` | Object | Checkbox elements. | ## Next steps [#next-steps] * [Customize the checkout](/payments/customize-the-checkout): See worked examples of every style key applied to a real checkout form. * [Render the checkout form](/sdks/pay-com-js/checkout-universal): Every option of `checkout.universal()`, including `style`. # Defend disputes in bulk (/risk/disputes/bulk-defend) Send [`POST /v1/disputes/bulk_defend`](/api-reference/endpoints/disputes/bulk-defend-disputes) to submit the same documents and text as evidence for several disputes in one request. Use it when one set of files answers many disputes, for example a delivery report that covers a batch of orders, or the terms of service your customers accepted. ## Requirements [#requirements] Before you send the request, check each dispute and each document: * Every dispute has the status `open` or `pre_arbitration`. * Every document is a dispute evidence document with the status `active`. See [Upload a document](/risk/disputes/evidence#upload-a-document). * Every document is within the limits of every dispute's processor. The request applies the strictest limit among the disputes you send. See [Limits](/risk/disputes/evidence#limits). ## Defend the disputes [#defend-the-disputes] Upload the files once, then send their IDs with the disputes they answer. ### Upload the documents [#upload-the-documents] Create a document for each file with [`POST /v1/documents`](/api-reference/endpoints/documents/create-document), upload the file, and wait for the `document.active` event. A document can be used in any number of bulk requests. ### Send the bulk defend request [#send-the-bulk-defend-request] Send `disputes` (the `dspt_` IDs), `documents` (1 to 10 `doc_` IDs), and an optional `text`. The same documents and text are submitted for every dispute. ```bash curl -X POST https://api.sandbox.pay.com/v1/disputes/bulk_defend \ -u ':sk-pay-com-sandbox-…' \ --header 'Content-Type: application/json' \ --header 'idempotency-key: 4f6c2a1e-8d3b-4b8e-9a51-0c2f7d9e6b13' \ --data '{ "disputes": [ "dspt_692434889303132160", "dspt_692434901147842560" ], "documents": ["doc_692435112204787712"], "text": "Signed delivery confirmations for both orders." }' ``` ```http HTTP/1.1 204 No Content ``` A `204` means Pay.com accepted the whole request and is submitting the evidence in the background. ### Follow each dispute [#follow-each-dispute] Pay.com submits the evidence for each dispute on its own. Each dispute moves to `evidence_under_review` when its evidence is processed, and Pay.com sends a `dispute.evidence_under_review` event for it. One dispute can fail while the others succeed, so check each dispute's status. To check one, retrieve it with [`GET /v1/disputes/{dispute_id}`](/api-reference/endpoints/disputes/get-dispute-by-id). ## How the request is checked [#how-the-request-is-checked] The API checks the whole request before it submits anything. If any check fails, it returns an error and submits no evidence for any dispute. | Problem | Response | | :-------------------------------------------------------------------- | :------- | | A dispute doesn't exist | `400` | | A document doesn't exist | `404` | | A dispute isn't `open` or `pre_arbitration` | `400` | | A document isn't an `active` dispute evidence document | `400` | | A document is over the strictest limit among the disputes' processors | `400` | | More than 10 documents, or no documents | `400` | | A request with the same `idempotency-key` is still running | `409` | Fix the problem and send the request again. Because nothing was submitted, you can resend the same disputes. There's no limit on the number of disputes in one request. ## Bulk and single submissions compared [#bulk-and-single-submissions-compared] A bulk request submits the same evidence as [`POST /v1/disputes/{dispute_id}/evidences`](/api-reference/endpoints/disputes/submit-dispute-evidence), with a few differences: | | Single dispute | Bulk | | :------------------- | :------------------------------------------ | :-------------------------------------------- | | Disputes per request | 1 | 1 or more | | Documents | `document`, or up to 10 in `documents` | 1 to 10 in `documents` | | `text` | Required, and can be empty | Optional | | `type` | Optional, defaults to `additional_evidence` | Not accepted. Stored as `additional_evidence` | | Response | `201` with the dispute object | `204` with no body | ## Next steps [#next-steps] * [Dispute evidence](/risk/disputes/evidence): Evidence types, file limits, and how to upload documents. * [Dispute lifecycle and statuses](/risk/disputes/lifecycle): What happens after the evidence is submitted. * [Bulk defend disputes API](/api-reference/endpoints/disputes/bulk-defend-disputes): The full endpoint reference. # Dispute events and testing (/risk/disputes/events-and-testing) Pay.com tells you about disputes in three ways: `dispute.*` webhook events, the **Fraud & Disputes** → **Disputes** page in the Pay.com dashboard, and an optional daily disputes file. In the sandbox, simulate disputes on your test charges to check that your integration handles every status. ## Webhook events [#webhook-events] Pay.com sends a `dispute.` event when a dispute is created or its status changes, plus `dispute.evidence_rejected` when Pay.com rejects your evidence. See [Events](/risk/disputes/lifecycle#events) for what each one means. To receive them, register a webhook endpoint and subscribe to the dispute events. See [Webhooks](/developer-resources/webhooks). Verify the `Pay-Signature` header before you process an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). Each event's `data` is the dispute object. Amounts are in the currency's smallest unit, so `5000` is $50.00 USD: ```json { "id": "evt_692434889852583936", "resource": "event", "type": "dispute.open", "created": "2026-03-26T18:09:02.560Z", "data": { "id": "dspt_692434889303132160", "resource": "dispute", "amount": 5000, "amount_human_readable": "50.00", "arn": "80597117747", "charge": "chrg_692434850019280896", "created": "2026-03-26T18:09:02.414Z", "currency": "usd", "evidence_required_by": "2026-04-02T00:00:00.000Z", "reason": "consumer_disputes", "reason_code": "13.1", "status": "open", "test_mode": true } } ``` When you handle an event: * Update your records from `data.status`, not from the event type, because events can arrive out of order. See [Act on the status, not the event](/risk/disputes/lifecycle#act-on-the-status-not-the-event). * Handle the same event more than once safely, using `id` to skip events you already processed. * For the dispute's full details, retrieve it with [`GET /v1/disputes/{dispute_id}`](/api-reference/endpoints/disputes/get-dispute-by-id). [`GET /v1/disputes`](/api-reference/endpoints/disputes/list-disputes) returns a shorter object. It leaves out `chargeback_type`, returns `reason_code`, `arn`, and `processor_dispute_id` as `null`, and has no evidence. ## Daily disputes reports [#daily-disputes-reports] Pay.com generates two disputes reports each day, as CSV files on its SFTP server. It can also push them to your Amazon S3 bucket or email them. Pay.com sends a `report.uploaded` event for each file. * `mrchnt___disputes_daily.csv` lists the disputes that changed that day, and the disputes whose chargeback cleared the day before. * `mrchnt___disputes.csv` lists every dispute that's still open, and the closed disputes that changed that day. To turn the reports on or off, or change how they're delivered, contact Pay.com support. For every column, see [Disputes reports](/data/reporting/disputes-reports). ## Simulate a dispute in the sandbox [#simulate-a-dispute-in-the-sandbox] Create a test dispute on a sandbox charge with [`POST /v1/charges/{charge_id}/simulate/dispute`](/api-reference/endpoints/disputes/simulate-dispute), which creates an `open` dispute. To create it in another status, put the status in the path with [`POST /v1/charges/{charge_id}/simulate/dispute/{dispute_status}`](/api-reference/endpoints/disputes/simulate-dispute-with-status). The request has no body, and Pay.com ignores one if you send it. ```bash curl -X POST https://api.sandbox.pay.com/v1/charges/chrg_692434850019280896/simulate/dispute/pre_arbitration \ -u ':sk-pay-com-sandbox-…' ``` ```http HTTP/1.1 204 No Content ``` `dispute_status` can be any of the 15 statuses: `new`, `open`, `evidence_under_review`, `evidence_under_review_auto_defend`, `pre_arbitration`, `arbitration_under_review`, `won`, `lost`, `arbitration_won`, `arbitration_lost`, `chargeback_accepted`, `chargeback_canceled`, `expired`, `resolved`, and `resolved_rapid_dispute_resolution`. How the simulation behaves: * **No dispute yet:** Pay.com creates one with `reason: consumer_disputes`, a reason code for the card's network (`13.1` for Visa, `4841` for Mastercard, `4515` for American Express, and `4755` for Discover), and a chargeback on the charge. For `won` and `arbitration_won`, it also books a representment. * **A dispute already exists:** Pay.com changes that dispute's status. It doesn't create another one. Simulating the status the dispute already has sends no event. * **Payment methods:** the charge must be paid by card, Apple Pay, Google Pay, Kakao Pay, or Naver Pay. Other charges return `422`. * **Live:** the endpoints work only in the sandbox. In live, they return `403` with `code: permission_denied`. An invalid status returns `400` first. The simulate endpoints need an API key with access to charges. The response is always `204` with no body, so take the dispute's ID from the webhook, or list your disputes. ## Test a dispute's lifecycle [#test-a-disputes-lifecycle] Run a dispute through the statuses your integration handles: ### Create a test charge [#create-a-test-charge] Create a charge in the sandbox, as in [Create a charge](/payments/create-a-charge). ### Open a dispute [#open-a-dispute] Call `POST /v1/charges/{charge_id}/simulate/dispute`. Check that you receive `dispute.open`, and store the dispute's ID from `data.id`. ### Defend it [#defend-it] Upload a document and submit it as evidence, as in [Dispute evidence](/risk/disputes/evidence). Check that the dispute moves to `evidence_under_review`. ### Simulate the outcome [#simulate-the-outcome] Call `POST /v1/charges/{charge_id}/simulate/dispute/won`, or `lost`, or `pre_arbitration` to test a second round. Check that your records follow each `data.status`. To simulate collaborations and fraud warnings too, see [Test risk events](/risk/test-risk-events). ## Next steps [#next-steps] * [Dispute lifecycle and statuses](/risk/disputes/lifecycle): Every status and event. * [Webhooks](/developer-resources/webhooks): Register endpoints and verify signatures. * [Test risk events](/risk/test-risk-events): Simulate collaborations and fraud warnings. # Dispute evidence (/risk/disputes/evidence) To defend a dispute, upload each file as a document, then submit it as evidence with [`POST /v1/disputes/{dispute_id}/evidences`](/api-reference/endpoints/disputes/submit-dispute-evidence). Pay.com reviews the evidence and sends it to the acquirer, which presents it to the card network and the issuer. ## Requirements [#requirements] You can submit evidence while both of these are true: * The dispute's status is `open`, or `pre_arbitration` with `evidence_required_by` set. * The `evidence_required_by` time hasn't passed. ## Evidence types [#evidence-types] Set `type` to the kind of evidence you're submitting. If you leave it out, the evidence is stored as `additional_evidence`. | Type | Use for | | :-------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | | `proof_of_delivery_or_service` | Tracking numbers, carrier confirmations, signed delivery receipts, or logs showing the customer used the service | | `proof_of_delivery_or_service_date` | The date the goods were delivered or the service was provided | | `invoice_or_receipt` | The invoice or receipt for the disputed charge | | `invoice_showing_distinct_transactions` | Invoices showing that two similar charges are separate purchases | | `customer_communication` | Emails or chat logs with the customer about the purchase | | `recurring_transaction_agreement` | The agreement the customer accepted for recurring billing | | `refund_or_cancellation_policy` | The refund or cancellation policy the customer accepted, and where they saw it | | `additional_evidence` | Anything else that supports your case | | `pre_arbitration_evidence` | Set by Pay.com for all evidence submitted while the dispute is in `pre_arbitration` | | `cardholder_evidence` | Evidence from the cardholder's side, recorded on the dispute. Don't use it for your own evidence | | `issuer_winning_evidence` | Evidence the issuer sent with a decision in its favor. Don't use it for your own evidence | Which evidence wins depends on the dispute's reason code. See [Reason codes](/risk/disputes/reason-codes) for what each network's codes claim. ## Limits [#limits] Acquirers limit the files they accept, and Pay.com checks the limits of the dispute's acquirer when you submit evidence: * **Size:** 10 MB per document by default. Some acquirers accept less, as little as 2 MB. * **Pages:** 50 pages per document by default. Some acquirers accept less, as few as 18. Pages are counted for PDF files only. * **Documents:** up to 10 documents per submission. A document over its acquirer's limit is rejected with `400` when you submit it as evidence, not when you upload it. The upload itself accepts files up to 50 MB. A [bulk defend](/risk/disputes/bulk-defend) request applies the strictest limit among its disputes' acquirers. A few acquirers accept only PDF files, or only one file for each dispute, and Pay.com applies those rules when it sends the evidence, after the API has accepted it. One PDF of up to 2 MB and 18 pages meets every acquirer's limits. The Pay.com dashboard accepts PDF files only. ## Prepare the files [#prepare-the-files] The card networks set rules for what evidence can contain. Evidence that breaks them can be rejected, and any fine for it is charged to you. * Don't include full card numbers, even partially masked. * Don't include full copies of passports, ID cards, or driver's licenses. Mask ID numbers, signatures, and other personal data. Include an ID copy only when the network asks for one, for example for an order collected in person. * For disputes that aren't about fraud, leave out ID documents. Send what shows the transaction was valid, such as the order confirmation, proof of delivery, and your messages with the customer. * For Mastercard disputes, keep images at 300 × 300 DPI or less and 30,000,000 pixels or fewer, and avoid heavy graphics and color. ## Upload a document [#upload-a-document] Each file you submit is a document (`doc_`). Create the document record, upload the file, and wait for Pay.com to accept it. ### Create the document [#create-the-document] Send [`POST /v1/documents`](/api-reference/endpoints/documents/create-document) with the file's details. `content_length` is the file size in bytes. If you leave out `title`, it defaults to `filename`. ```json title="POST /v1/documents" { "filename": "delivery-confirmation.pdf", "reference": "order_48213", "content_type": "application/pdf", "content_length": 182044, "title": "Signed delivery confirmation" } ``` ```json { "id": "doc_692435112204787712", "resource": "document", "created": "2026-03-27T09:12:40.118Z", "filename": "delivery-confirmation.pdf", "reference": "order_48213", "status": "created", "content_type": "application/pdf", "content_length": 182044, "category": "dispute_evidence", "title": "Signed delivery confirmation" } ``` ### Upload the file [#upload-the-file] Send the file to [`POST /v1/documents/{document_id}/upload`](/api-reference/endpoints/documents/upload-document). The body must be exactly the `content_length` bytes you declared, and the `Content-Type` header replaces the document's `content_type`. ```bash curl -X POST https://api.sandbox.pay.com/v1/documents/doc_692435112204787712/upload \ -u ':sk-pay-com-sandbox-…' \ --header 'Content-Type: application/pdf' \ --data-binary @delivery-confirmation.pdf ``` A `204` confirms the upload, and the document moves to `pending` while Pay.com scans it for malware. ### Wait for the document to be active [#wait-for-the-document-to-be-active] The document becomes `active` (`document.active` event), or `rejected` (`document.rejected`) if the scan fails. You can submit only `active` documents. If a document is rejected, create a new one and upload a corrected file. To check a document, retrieve it with [`GET /v1/documents/{id}`](/api-reference/endpoints/documents/get-document-by-id). ## Submit the evidence [#submit-the-evidence] Send [`POST /v1/disputes/{dispute_id}/evidences`](/api-reference/endpoints/disputes/submit-dispute-evidence) with the document IDs, the evidence `type`, and a `text` explanation. `text` is required, but it can be an empty string. Pass one ID in `document`, or up to 10 in `documents`. If you send both, Pay.com uses `documents`. ```json title="POST /v1/disputes/dspt_692434889303132160/evidences" { "type": "proof_of_delivery_or_service", "documents": ["doc_692435112204787712"], "text": "The order was delivered on March 4, 2026 and signed for by the customer." } ``` ```json { "id": "dspt_692434889303132160", "resource": "dispute", "amount": 5000, "currency": "usd", "charge": "chrg_692434850019280896", "reason": "consumer_disputes", "reason_code": "13.1", "status": "open", "evidence_required_by": "2026-04-02T00:00:00.000Z", "evidences": { "data": [], "url": "/v1/disputes/dspt_692434889303132160/evidences" } } ``` The response (`201`) is the dispute as it was before Pay.com processed the evidence, so `evidences.data` doesn't include it yet. Within seconds the evidence appears on the dispute, the status moves to `evidence_under_review`, and Pay.com sends a `dispute.evidence_under_review` event. Amounts are in the currency's smallest unit, so `5000` is $50.00. Each request adds a new evidence record. To send the same files for several disputes, use [bulk defend](/risk/disputes/bulk-defend). ## After you submit [#after-you-submit] The status moves to `evidence_under_review` as soon as Pay.com stores the evidence. Pay.com then checks it and sends it to the acquirer. If Pay.com rejects the evidence, for example because it breaks a card network rule, the dispute goes back to `open`, or to `pre_arbitration`, with the same deadline. Pay.com sends a `dispute.evidence_rejected` event, and you can submit new evidence. ## Update evidence [#update-evidence] [`PATCH /v1/disputes/{dispute_id}/evidences/{evidence_id}`](/api-reference/endpoints/disputes/update-dispute-evidence) changes a stored evidence record, with a new `text`, a new `document`, or both. A `document` replaces all the files on the evidence with that one document. You can update evidence only while the dispute is `open` or `pre_arbitration`, and you can't change its `type`. Updating evidence doesn't send anything to the acquirer again. To answer a rejection, or to add to your defense, submit new evidence instead. ## Read the evidence on a dispute [#read-the-evidence-on-a-dispute] The dispute's `evidences.data` lists its evidence. To read it on its own, list it with [`GET /v1/disputes/{dispute_id}/evidences`](/api-reference/endpoints/disputes/get-evidences-by-dispute-id), or retrieve one with [`GET /v1/disputes/{dispute_id}/evidences/{evidence_id}`](/api-reference/endpoints/disputes/get-evidence-by-id). Each evidence object has its `type`, its `text`, and the document IDs in `files`. ## Submit evidence in the dashboard [#submit-evidence-in-the-dashboard] In the Pay.com dashboard, go to **Fraud & Disputes** → **Disputes**, open the dispute, and describe the case in **Describe the case**. Upload your evidence as a PDF, confirm you've read the **Guidelines for Submitting Dispute Evidence**, and submit. The dashboard stores the evidence as `additional_evidence`, or as `pre_arbitration_evidence` during pre-arbitration. The dashboard also answers requests for information on disputes in `new`, which the API can't. ## Next steps [#next-steps] * [Respond to a dispute](/risk/disputes/respond): Decide whether to accept or defend, and the deadlines that apply. * [Defend disputes in bulk](/risk/disputes/bulk-defend): Submit the same files for several disputes. * [Reason codes](/risk/disputes/reason-codes): What each network reason code claims, so you can choose the right evidence. # Disputes (/risk/disputes) A dispute, also called a chargeback, starts when a cardholder asks their bank to reverse a payment. The bank raises it through the card network, the acquirer reports it, and Pay.com creates a dispute object (`dspt_…`), sends a `dispute.*` webhook event, and lists it in **Fraud & Disputes** → **Disputes** in the Pay.com dashboard. You can accept the dispute, or defend it with evidence, until its `evidence_required_by` deadline. ## How a dispute works [#how-a-dispute-works] Most disputes follow the same path. The issuer files a chargeback, you defend it or accept it, and the issuer or the card network decides the outcome: Some disputes start in another status, for example as `resolved_rapid_dispute_resolution` when Visa Rapid Dispute Resolution accepts them for you. See [Dispute lifecycle and statuses](/risk/disputes/lifecycle) for all 15 statuses and the events Pay.com sends. ## Money and refunds [#money-and-refunds] The acquirer debits the disputed amount as a chargeback, usually when the dispute opens. If you win, it credits the amount back as a representment. Pay.com books each of these when the acquirer reports it, so a debit or credit can arrive after the status changes. You can't refund a charge once it has a dispute, regardless of the dispute's status. The refund request returns `422`. ## Before a dispute [#before-a-dispute] Card networks and alert services can warn you before a cardholder files a dispute, so you can refund instead: * [Fraud warnings](/risk/fraud-warnings): Visa and Mastercard reports that a payment was fraudulent. Refund while `actionable` is `true`. * [Collaborations](/risk/collaborations): Pre-dispute alerts from Ethoca, Verifi CDRN, and Mastercard Collaboration, which you resolve with a refund. An alert you resolve with a refund doesn't become a dispute, so it doesn't count as one in Visa's VAMP ratio. Fraud warnings still count as fraud reports. See [Monitoring programs](/risk/disputes/monitoring-programs). ## In this section [#in-this-section] Each page covers one part of handling disputes: ## Next steps [#next-steps] * [Respond to a dispute](/risk/disputes/respond): Accept or defend before the deadline. * [Test risk events](/risk/test-risk-events): Simulate disputes, collaborations, and fraud warnings in the sandbox. * [Disputes API](/api-reference/endpoints/disputes/list-disputes): The full endpoint reference. # Dispute lifecycle and statuses (/risk/disputes/lifecycle) A dispute's `status` changes as the issuer, the acquirer, the card network, and you act on it. Each change sends a `dispute.*` webhook event whose `data.status` is the new status. This page explains every status, what you can do in it, and when money moves. ## Statuses [#statuses] A dispute has one of these 15 statuses. You can accept or defend a dispute only in `open`, and in `pre_arbitration` while `evidence_required_by` is set. | Status | What happened | What you can do | | :---------------------------------- | :----------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- | | `new` | The issuer asked for information about the payment, such as a retrieval request or an inquiry. No money has moved. | Answer it in the Pay.com dashboard. The API can't accept or defend it. | | `open` | The issuer filed a chargeback. Also the status after Pay.com rejects your evidence. | Accept or defend with evidence by `evidence_required_by`. | | `evidence_under_review` | Your evidence was submitted, and the issuer is reviewing it. | Wait for the outcome. | | `evidence_under_review_auto_defend` | The acquirer defended the dispute for you, and the issuer is reviewing it. | Wait for the outcome. | | `pre_arbitration` | The issuer disputed again after your defense, also called a second chargeback. | If `evidence_required_by` is set, accept or defend again. | | `arbitration_under_review` | The card network is deciding the case. | Wait for the outcome. | | `won` | The issuer accepted your defense. | Nothing. The acquirer credits the amount back. | | `lost` | The issuer rejected your defense. | Nothing. The amount stays debited. | | `arbitration_won` | The card network decided for you. | Nothing. The acquirer credits the amount back. | | `arbitration_lost` | The card network decided for the cardholder. | Nothing. | | `chargeback_accepted` | You, or the acquirer for you, accepted the dispute. | Nothing. | | `chargeback_canceled` | The cardholder or issuer withdrew the chargeback. | Nothing. The amount is credited back. | | `expired` | `evidence_required_by` passed without a response, and the dispute closed for the cardholder. | Nothing. | | `resolved` | The case closed without a chargeback debit, for example an inquiry that was answered. | Nothing. | | `resolved_rapid_dispute_resolution` | Visa Rapid Dispute Resolution accepted the dispute for you. | Nothing. The amount stays debited. | The last nine statuses are final, but an acquirer's later report can still change them, for example when an issuer files again on a dispute you won. Treat `status` as the dispute's latest state. See [Reissued disputes](/risk/disputes/respond#reissued-disputes). Not every dispute starts in `new` or `open`. Pay.com creates a dispute in the status the acquirer reports, so the first event can be, for example, `dispute.pre_arbitration`, `dispute.lost`, or `dispute.resolved_rapid_dispute_resolution`. ## Events [#events] Pay.com sends `dispute.` when a dispute is created or its status changes, so there's one event type for each status. It also sends `dispute.evidence_rejected` when Pay.com rejects the evidence you submitted. The dispute then goes back to `open`, or to `pre_arbitration`, with the same deadline, and you can submit new evidence. | Event | Sent when | | :---------------------------------------------------- | :----------------------------------------------------------------- | | `dispute.new` | The issuer asked for information. | | `dispute.open` | The issuer filed a chargeback, or the dispute went back to `open`. | | `dispute.evidence_under_review` | Your evidence was submitted. | | `dispute.evidence_under_review_auto_defend` | The acquirer defended the dispute for you. | | `dispute.evidence_rejected` | Pay.com rejected your evidence. | | `dispute.pre_arbitration` | The issuer disputed again. | | `dispute.arbitration_under_review` | The case went to the card network. | | `dispute.won`, `dispute.lost` | The issuer decided. | | `dispute.arbitration_won`, `dispute.arbitration_lost` | The card network decided. | | `dispute.chargeback_accepted` | The dispute was accepted. | | `dispute.chargeback_canceled` | The chargeback was withdrawn. | | `dispute.expired` | The deadline passed without a response. | | `dispute.resolved` | The case closed without a chargeback. | | `dispute.resolved_rapid_dispute_resolution` | Visa RDR accepted the dispute. | ## Act on the status, not the event [#act-on-the-status-not-the-event] Events don't arrive in a fixed order, and Pay.com doesn't send one for every change. For example, there's no event when the acquirer confirms it presented your evidence, and `dispute.pre_arbitration` can repeat while the status stays the same. When you receive any `dispute.*` event: 1. Read `data.status`, or retrieve the dispute with [`GET /v1/disputes/{dispute_id}`](/api-reference/endpoints/disputes/get-dispute-by-id). 2. Update your records to that status, regardless of the event type. 3. If the status is `open` or `pre_arbitration`, act before `evidence_required_by`. `data.created` is when the dispute was received. When the acquirer reports the date it received the dispute, Pay.com uses that date. ## When money moves [#when-money-moves] Money moves separately from the status. The acquirer reports each debit and credit, and Pay.com books them on the charge when the report arrives: * **Chargeback:** the acquirer debits the disputed amount, usually when the dispute opens. * **Representment:** the acquirer credits the amount back, usually when you win, when the card network decides for you, or when the chargeback is canceled. * **Second chargeback** and **second representment:** the same, during pre-arbitration. The dispute's `chargeback_type` shows the latest of these stages: `chargeback`, `representment`, `second_chargeback`, or `second_representment`. It's `null` until the acquirer books the first chargeback, so it can be `null` on a new `open` dispute. List results leave it out, so retrieve the dispute to read it. You can't refund a charge once it has a dispute, in any status. See [Chargebacks after a refund](/risk/disputes/respond#chargebacks-after-a-refund). ## Retrieval requests and inquiries [#retrieval-requests-and-inquiries] A dispute in `new` is a request for information about the payment, such as a retrieval request or an American Express inquiry. No money moves. Answer it in the Pay.com dashboard with the documents the issuer asked for. If you don't answer, the issuer can file a chargeback, and American Express charges back inquiries that get no reply. Visa stopped retrieval requests in October 2020, and Mastercard has allowed them only for US healthcare audits since October 2021, so most `new` disputes come from other networks or from the acquirer. ## Rapid Dispute Resolution [#rapid-dispute-resolution] Visa Rapid Dispute Resolution (RDR) accepts eligible Visa disputes for you, based on rules you set up with Pay.com, before the issuer files a chargeback. The dispute is created as `resolved_rapid_dispute_resolution`, the amount stays debited, and you can't defend it. Don't also refund the charge, or the cardholder is credited twice. Disputes resolved through RDR don't count in Visa's VAMP ratio. To set up RDR, contact Pay.com support. See [Collaborations](/risk/collaborations) for the other pre-dispute alerts. ## Next steps [#next-steps] * [Respond to a dispute](/risk/disputes/respond): Accept or defend, and the deadlines that apply. * [Events and testing](/risk/disputes/events-and-testing): Handle dispute webhooks and simulate every status. * [Reason codes](/risk/disputes/reason-codes): What the cardholder claims. # Card network monitoring programs (/risk/disputes/monitoring-programs) Card networks monitor each merchant's disputes and fraud. A merchant above a program's threshold must cut its ratio under a remediation plan, can be charged fees or fines through its acquirer, and can lose the right to accept the network's cards. This page lists the programs for Visa, Mastercard, American Express, and Australia's AusPayNet, and the date each figure applies from. The networks can change their programs at any time, and some keep parts of them in guides they share only with acquirers. Where a figure isn't public, this page says so. Your acquirer or Pay.com account manager confirms the figures that apply to you. ## Track your ratios [#track-your-ratios] In the Pay.com dashboard, go to **Fraud & Disputes** → **Overview**. For each month, it shows your charges, disputes, and fraud, by card brand and settlement account, and your ratios for these programs: * **Visa VAMP** * **Mastercard ECM**, **Mastercard EFM**, and **Mastercard SMMP** * American Express **Fraud Full Recourse** and **Immediate Chargeback** Switch between ratios by count and by volume, and filter by settlement account, month, and card brand. Months follow UTC. ## Lower your ratios [#lower-your-ratios] Disputes and fraud reports count against you once the network records them. To keep your ratios down: * Respond to [collaborations](/risk/collaborations), the pre-dispute alerts from Ethoca, Verifi CDRN, and Mastercard Collaboration. A refund within the alert's window resolves the claim before it becomes a dispute, and Visa doesn't count disputes resolved this way in its VAMP ratio. * Refund charges with [fraud warnings](/risk/fraud-warnings) while `actionable` is `true`. The fraud report still counts, but the refund usually prevents a dispute on the same payment. * Authenticate risky payments with [3D Secure](/payments/3d-secure), and block or review them with [rules](/risk/rules). ## Visa Acquirer Monitoring Program (VAMP) [#visa-acquirer-monitoring-program-vamp] VAMP replaced the Visa Dispute Monitoring Program (VDMP) and the Visa Fraud Monitoring Program (VFMP). It started on April 1, 2025, with an advisory period without fees that ended on September 30, 2025. Visa monitors acquirers, and the merchants in their portfolios. ### The VAMP ratio [#the-vamp-ratio] The VAMP ratio counts fraud reports and disputes against settled card-not-present transactions in the same month: > VAMP ratio = (TC40 fraud reports + TC15 disputes) ÷ TC05 settled card-not-present transactions * **TC40 fraud reports** are the fraud reports issuers file, which reach you as [fraud warnings](/risk/fraud-warnings). * **TC15 disputes** are all disputes, fraud and non-fraud. * Disputes resolved through pre-dispute services don't count, and neither do fraud reports that qualified for Visa Compelling Evidence 3.0. The ratio is in basis points (bps), where 100 bps is 1%. It covers domestic and cross-border card-not-present transactions, in all regions. ### Merchant thresholds [#merchant-thresholds] A merchant is **Excessive** when it reaches both the ratio and the monthly count for its region: | Region | VAMP ratio | Fraud reports and disputes a month | Applies from | | :--------------------------------------- | :------------- | :--------------------------------- | :------------ | | Asia Pacific, Canada, Europe, and the US | 220 bps (2.2%) | 1,500 | June 1, 2025 | | Asia Pacific, Canada, Europe, and the US | 150 bps (1.5%) | 1,500 | April 1, 2026 | | Latin America and the Caribbean | 150 bps (1.5%) | 1,500 | June 1, 2025 | | Central Europe, Middle East, and Africa | 220 bps (2.2%) | 150, and at least USD 75,000 | June 1, 2025 | Visa said that programs for Brazil, Chile, and India would be announced separately. ### Acquirer thresholds [#acquirer-thresholds] Visa also rates each acquirer's whole portfolio. An acquirer is **Above Standard** at a ratio of 50 bps (0.5%) and **Excessive** at 70 bps (0.7%), from June 1, 2025, with the same monthly minimum counts as merchants. When an acquirer is rated, merchants in its portfolio can be identified at lower ratios, so your acquirer can ask you to act before you reach the merchant threshold. ### Enumeration [#enumeration] Visa identifies card testing separately. A merchant is identified when at least 20% of its authorizations (approved and declined) are enumeration attempts, with at least 300,000 enumerated transactions in the month, from June 1, 2025. To limit card testing, use [payment rules](/risk/rules/payment-rules) with [aggregations](/risk/rules/aggregations), such as the number of cards per IP address. ### What happens when you're identified [#what-happens-when-youre-identified] Visa charges fees per fraud report and dispute above the thresholds, through your acquirer. Visa sets the fee amounts, the grace period, and the exit rules in its VAMP program guide, which it shares with acquirers but doesn't publish. Visa can also require remediation tools. From October 2026, the Visa rules let an issuer dispute a transaction that a Visa monitoring program flagged, within 120 days of the program's report. ### Merchant Elevated Risk Program (MERP) [#merchant-elevated-risk-program-merp] In Asia Pacific, Visa's rules add MERP from April 9, 2026. Visa identifies merchants with signals such as sudden spikes in transactions and rising fraud or dispute ratios, and doesn't publish thresholds. Visa charges the acquirer USD 25,000 for a first identification and USD 50,000 for a repeat. ## Mastercard Excessive Chargeback Program [#mastercard-excessive-chargeback-program] Mastercard's Excessive Chargeback Program identifies merchants with too many chargebacks. Mastercard calculates the ratio for each merchant ID every calendar month: > Chargeback ratio = chargebacks this month ÷ Mastercard transactions last month Mastercard publishes the ratio, but sets the thresholds and fines in a manual it shares only with acquirers. The figures below are the ones acquirers publish, in effect since April 2020: | Level | Chargebacks a month | Chargeback ratio | | :---------------------------------------- | :------------------ | :--------------- | | Excessive Chargeback Merchant (ECM) | 100 to 299 | 1.5% to 2.99% | | High Excessive Chargeback Merchant (HECM) | 300 or more | 3% or more | The merchant must reach both the count and the ratio. Mastercard fines the acquirer for each month the merchant stays in the program, by the level it's at in that month: | Month in the program | ECM | HECM | | :------------------- | :------------------------- | :---------- | | 1 | USD 0 | USD 0 | | 2 | USD 1,000 | USD 1,000 | | 3 | Not consistently published | USD 2,000 | | 4 to 6 | USD 5,000 | USD 10,000 | | 7 to 11 | USD 25,000 | USD 50,000 | | 12 to 18 | USD 50,000 | USD 100,000 | | 19 and later | USD 100,000 | USD 200,000 | From the fourth month, Mastercard also collects issuer recovery fees, which it pays out to the issuers that received the chargebacks. A merchant leaves the program after 3 months in a row below the ECM thresholds. After 6 months in the program, Mastercard can require a risk review of the acquirer. ## Mastercard Excessive Fraud Merchant (EFM) [#mastercard-excessive-fraud-merchant-efm] EFM identifies merchants with high e-commerce fraud and low use of 3D Secure. As with ECM, Mastercard keeps the criteria in the manual it shares with acquirers. Acquirers publish these criteria, all of which must be met in the same month: * At least 1,000 e-commerce transactions in the previous month. * At least USD 50,000 in fraud chargebacks in the month, or USD 15,000 in Australia. * A fraud chargeback ratio of 0.5% or more, or 0.2% in Australia. The ratio is this month's fraud chargebacks over last month's e-commerce transactions. * 3D Secure on few of the transactions: under 10% in countries without strong customer authentication rules, and under 50% in countries with them. The monthly fines are USD 0 in month 1, then USD 500, USD 1,000, USD 5,000 for months 4 to 6, USD 25,000 for months 7 to 11, USD 50,000 for months 12 to 18, and USD 100,000 from month 19. A merchant leaves EFM after 3 months in a row below the criteria. A merchant in both EFM and ECM in the same month is fined under EFM only. ## Mastercard scam merchant monitoring (SMMP) [#mastercard-scam-merchant-monitoring-smmp] From July 2026, Mastercard's Security Rules require acquirers to investigate a card-not-present merchant within 72 hours of any of these signals. The Pay.com dashboard shows the refund and chargeback signal as **Mastercard SMMP**. * For a merchant with 6 months or less of Mastercard acceptance, more than 5% of its purchase transactions refunded, charged back, or both, in a rolling 30 days with at least 500 purchases. * For the same new merchants, scam reports or scam-related chargebacks from at least two issuers. * An approval rate that drops by 50 percentage points or more against the merchant's usual rate, or falls below 30%, over at least 72 hours and 25 purchases. * A Mastercard alert or a merchant monitoring provider's alert about the merchant. There are no fees. If the acquirer confirms the merchant is a scam, it must stop the merchant from accepting Mastercard. The rule applies in every region except Jordan. ## American Express [#american-express] American Express sets these programs in its Merchant Regulations. The figures are from the US regulations of April 2025 and the international regulations of April 2026. ### Fraud Full Recourse [#fraud-full-recourse] Under Fraud Full Recourse, American Express charges back every fraud dispute, and you can't ask for a reversal. It also covers fraud disputes on transactions from up to a year before you're placed in the program, and you lose the SafeKey (3D Secure) fraud liability shift. American Express measures fraud to gross each month, as the value of fraud over your total volume: | Tier | Fraud to gross | Fraud a month | When the program applies | | :--- | :------------- | :----------------- | :----------------------------------------------------------------------------------------- | | Low | 0.9% or more | USD 25,000 or more | If you aren't below the Low tier for 3 months in a row after American Express notifies you | | High | 1.8% or more | USD 50,000 or more | As soon as American Express notifies you | You leave the program after 3 months in a row with fraud to gross below 0.9%, or fraud below USD 25,000. The program has no fees of its own. ### Immediate Chargeback [#immediate-chargeback] Under the Immediate Chargeback Program, a non-fraud dispute becomes a chargeback immediately, without an inquiry you can answer first. The Partial Immediate Chargeback Program does the same for disputes under a set amount. American Express can place a merchant in either program at its discretion, or a merchant can choose it, and it doesn't publish a threshold. You can reverse such a chargeback only by showing you weren't in the program at the time, or that you already refunded the charge. ### Excessive chargeback fee in the US [#excessive-chargeback-fee-in-the-us] In the US, if your monthly ratio of chargebacks to charges is above 1% for 3 months in a row, American Express can charge USD 25 for each chargeback above the 1% ratio, every month after that. ## AusPayNet card-not-present fraud framework [#auspaynet-card-not-present-fraud-framework] In Australia, AusPayNet's card-not-present code sets a fraud threshold for card-not-present payments on Australian-issued cards, acquired in Australia. The framework started on July 1, 2019, and the current code applies from January 1, 2024. It measures fraud by value, each quarter: > Fraud rate = value of fraudulent card-not-present transactions ÷ value of all card-not-present transactions A merchant is above the threshold with a fraud rate of 20 bps (0.2%) or more and at least AUD 50,000 of fraud in the quarter. Transactions sent to the issuer for strong customer authentication don't count as fraud in the rate. For each quarter in a row above the threshold, the merchant must do more: | Quarters in a row | What the merchant must do | | :---------------- | :------------------------------------------------------------------------------------------------------------- | | 1 | Add fraud controls, such as strong customer authentication on risky transactions. | | 2 | Use strong customer authentication on all transactions or on high-risk ones, or add stronger fraud controls. | | 3 | Send every card-not-present transaction, except exempt ones, to the issuer for strong customer authentication. | | 4 | The merchant is in breach of the code, and AusPayNet's sanctions rules apply. | The obligations end after a quarter below the threshold. With Pay.com, you send transactions for authentication with [3D Secure](/payments/3d-secure). ## Discover, JCB, and UnionPay [#discover-jcb-and-unionpay] Discover, JCB, and UnionPay don't publish merchant dispute monitoring programs with thresholds. They and your acquirer can still act on excessive chargebacks, so track your ratios for these brands in **Fraud & Disputes** → **Overview**. ## Next steps [#next-steps] * [Disputes](/risk/disputes): How disputes reach you and how to respond. * [Collaborations](/risk/collaborations): Resolve pre-dispute alerts before they count as disputes. * [Fraud warnings](/risk/fraud-warnings): Act on the TC40 and SAFE fraud reports that count toward VAMP and EFM. # Dispute reason codes (/risk/disputes/reason-codes) Every dispute has a `reason`, Pay.com's category for the cardholder's claim, and a `reason_code`, the card network's own code when the acquirer sends one. Use `reason` to route disputes in your code, and `reason_code` to choose the evidence that answers the claim. ## Reason categories [#reason-categories] Pay.com maps each network code to one of four `reason` values: | `reason` | The cardholder or issuer claims | Evidence that usually answers it | | :------------------ | :------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `fraud` | The cardholder didn't make or allow the payment. | 3D Secure authentication, AVS and CVV results, the customer's device and IP address, earlier undisputed payments by the same customer, and proof of delivery to the customer | | `authorization` | The payment wasn't properly authorized, for example it was declined or had no authorization. | The authorization approval and its date | | `processing_errors` | The payment was processed incorrectly, for example charged twice, for the wrong amount or currency, or presented late. | Records that show each charge is separate, the correct amount, or the dates | | `consumer_disputes` | The cardholder paid, but has a problem with the purchase, for example it never arrived, wasn't as described, or wasn't refunded. | Proof of delivery or service, the terms the customer accepted, your messages with them, and refund records | ## How Pay.com sets the reason [#how-paycom-sets-the-reason] Pay.com looks up the network and the `reason_code` in its mapping, which the tables on this page show. A sub-code that isn't in the table uses its parent code, so Visa `12.6.1` maps like `12.6`. * A code that isn't in Pay.com's mapping maps to `consumer_disputes`. That includes every JCB and UnionPay code. * If the acquirer sends no reason code, `reason_code` is `13.7` and `reason` is `consumer_disputes`. Check the acquirer's records for the real reason. * `reason_code` can also be `null`, or the acquirer's own code for payment methods other than cards. ## Visa [#visa] Visa groups its codes by numeric prefix. Series 10 covers fraud, 11 covers authorization, 12 covers processing errors, and 13 covers consumer disputes. | Code | Visa name | What the cardholder claims | `reason` | | :----- | :------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------ | | 10.1 | EMV Liability Shift Counterfeit Fraud | A counterfeit copy of a chip card was used in person, and the chip wasn't read. | `fraud` | | 10.2 | EMV Liability Shift Non-Counterfeit Fraud | A lost, stolen, or never-received chip-and-PIN card was used in person without chip and PIN. | `fraud` | | 10.3 | Other Fraud, Card-Present Environment | They didn't make an in-person payment that was keyed in. | `fraud` | | 10.4 | Other Fraud, Card-Absent Environment | They didn't make or allow an online, phone, or mail-order payment. | `fraud` | | 10.5 | Visa Monitoring Programs | Visa flagged the payment through one of its monitoring programs. | `fraud` | | 11.1 | Card Recovery Bulletin | A payment under the floor limit used a card on Visa's recovery bulletin. Retired. Visa allowed 11.1 only for disputes processed on or before October 23, 2026. | `authorization` | | 11.2 | Declined Authorization | The payment proceeded after the authorization was declined. | `authorization` | | 11.3 | No Authorization / Late Presentment | The payment had no valid authorization, or was presented too late. | `authorization` | | 12.1 | Late Presentment | Retired. Visa moved late presentment into 11.3 in April 2024. | `processing_errors` | | 12.2 | Incorrect Transaction Code | A refund was processed as a charge, or a charge as a refund. | `processing_errors` | | 12.3 | Incorrect Currency | The payment was in the wrong currency, or converted without their agreement. | `processing_errors` | | 12.4 | Incorrect Account Number | The payment was posted to the wrong card. | `processing_errors` | | 12.5 | Incorrect Amount | The amount is wrong. | `processing_errors` | | 12.6.1 | Duplicate Processing | The same purchase was charged twice. | `processing_errors` | | 12.6.2 | Paid by Other Means | They already paid for the purchase another way. | `processing_errors` | | 12.7 | Invalid Data | The authorization used wrong data, such as a different merchant category code. | `processing_errors` | | 13.1 | Merchandise/Services Not Received | They didn't receive the goods or service. | `consumer_disputes` | | 13.2 | Canceled Recurring Transaction | A recurring charge came after they canceled it. | `consumer_disputes` | | 13.3 | Not as Described or Defective Merchandise/Services | The goods or service didn't match the description, or arrived damaged or defective. | `consumer_disputes` | | 13.4 | Counterfeit Merchandise | The goods are counterfeit. | `consumer_disputes` | | 13.5 | Misrepresentation | The merchant misrepresented the terms of sale. | `consumer_disputes` | | 13.6 | Credit Not Processed | A refund they were promised didn't arrive. | `consumer_disputes` | | 13.7 | Canceled Merchandise/Services | They canceled or returned the purchase but weren't refunded. | `consumer_disputes` | | 13.8 | Original Credit Transaction Not Accepted | A payout to their card was refused, or isn't allowed. | `consumer_disputes` | | 13.9 | Non-Receipt of Cash at an ATM | An ATM didn't give them the cash. | `consumer_disputes` | For 10.4, a payment fully authenticated with 3D Secure, or with a qualifying 3D Secure attempt, can't be disputed. Visa's Compelling Evidence 3.0 also lets you answer a 10.4 dispute with two earlier payments on the same card that weren't reported as fraud, made 120 to 365 days before the dispute. They must share the device ID or fingerprint, or the IP address, with the disputed payment, plus one more element, such as the customer's account ID or delivery address. Since October 24, 2026, the earlier payments can also be at other merchants of the same acquirer. ## Mastercard [#mastercard] Mastercard now uses about ten codes. It folded its older codes into 4808, 4834, and 4853, but issuers can still send them, so Pay.com maps both. | Code | Mastercard name | What the cardholder claims | `reason` | | :--- | :------------------------------------------- | :----------------------------------------------------------------------------------------------- | :------------------ | | 4808 | Authorization-Related Chargeback | The payment had no valid authorization, or it was declined or expired. | `authorization` | | 4834 | Point-of-Interaction Error | The payment was processed incorrectly, for example charged twice, for the wrong amount, or late. | `processing_errors` | | 4837 | No Cardholder Authorization | They didn't make or allow the payment. | `fraud` | | 4849 | Questionable Merchant Activity | Mastercard named the merchant in a fraud program that covers the payment. | `fraud` | | 4850 | Installment Billing Dispute | An installment plan was billed incorrectly. Only in some countries. | `processing_errors` | | 4853 | Cardholder Dispute | The purchase wasn't received, wasn't as described, was canceled, or wasn't refunded. | `consumer_disputes` | | 4854 | Cardholder Dispute, Not Elsewhere Classified | A US cardholder right that no other code covers. US only. | `consumer_disputes` | | 4870 | Chip Liability Shift | A counterfeit chip card was used, and the chip wasn't read. | `fraud` | | 4871 | Chip/PIN Liability Shift | A lost or stolen chip-and-PIN card was used without PIN. | `fraud` | | 4999 | Domestic Chargeback Dispute | A claim under a European country's own dispute rules. Europe only. | `consumer_disputes` | The older codes, and the code that replaced each: | Code | Mastercard name | Now | `reason` | | :--- | :----------------------------------------------- | :--------------------- | :------------------ | | 4807 | Warning Bulletin File | 4808 | `authorization` | | 4812 | Account Number Not on File | 4808 | `authorization` | | 4835 | Card Not Valid or Expired | 4808 | `authorization` | | 4831 | Transaction Amount Differs | 4834 | `processing_errors` | | 4842 | Late Presentment | 4834 | `processing_errors` | | 4846 | Correct Transaction Currency Code Not Provided | 4834 | `processing_errors` | | 4840 | Fraudulent Processing of Transactions | Retired | `fraud` | | 4863 | Cardholder Does Not Recognize, Potential Fraud | 4837 | `fraud` | | 4841 | Canceled Recurring or Digital Goods Transactions | 4853 | `consumer_disputes` | | 4855 | Goods or Services Not Provided | 4853 | `consumer_disputes` | | 4859 | Addendum, No-show, or ATM Dispute | 4853, or 4834 for ATMs | `consumer_disputes` | | 4860 | Credit Not Processed | 4853 | `consumer_disputes` | ## American Express [#american-express] American Express codes are letters and numbers, such as F29. Acquirers outside the US and Canada often send a four-digit equivalent instead, such as 4540. Pay.com maps both where the table shows both. | Code | Numeric | American Express name | What the cardholder claims | `reason` | | :------- | :------ | :----------------------------------------------------- | :----------------------------------------------------------------------- | :------------------ | | F24 | 4534 | No Card Member Authorization | They didn't make the payment, and you can't show they took part. | `fraud` | | F29 | 4540 | Card Not Present | They didn't make a card-not-present payment. | `fraud` | | F30 | 4798 | EMV Counterfeit | A counterfeit chip card was used, and the chip wasn't read. | `fraud` | | F31 | 4799 | EMV Lost/Stolen/Non-Received | A lost or stolen chip-and-PIN card was used without chip and PIN. | `fraud` | | FR2 | 4763 | Fraud Full Recourse Program | A fraud claim while you're in the Fraud Full Recourse program. | `fraud` | | A01 | | Charge Amount Exceeds Authorization Amount | The charge was higher than the amount approved. | `authorization` | | A02 | 4521 | No Valid Authorization | The charge had no valid approval, was declined, or used an expired card. | `authorization` | | A08 | | Authorization Approval Expired | The charge was submitted after its approval expired. | `authorization` | | | 4751 | Expired Authorization | The authorization had expired. | `authorization` | | P01 | 4523 | Unassigned Card Number | The charge used an invalid card number. | `processing_errors` | | P03, P04 | 4752 | Credit Processed as Charge, Charge Processed as Credit | A refund was submitted as a charge, or a charge as a refund. | `processing_errors` | | P05 | 4507 | Incorrect Charge Amount | The amount differs from what they agreed to. | `processing_errors` | | P07 | 4536 | Late Submission | The charge was submitted too late. | `processing_errors` | | P08 | | Duplicate Charge | The same charge was submitted more than once. | `processing_errors` | | | 4512 | Multiple Processing | The same charge was processed more than once. | `processing_errors` | | P23 | 4530 | Currency Discrepancy | The charge was in the wrong currency. | `processing_errors` | | F22 | 4758 | Expired or Not Yet Valid Card | The card was used outside its valid dates. | `processing_errors` | | | 4522 | Authorization Declined | The charge proceeded after a decline. | `processing_errors` | | | 4525 | Transaction Amount Changed | The amount was changed. | `processing_errors` | | | 4755 | No Valid Approval Code | The charge had no valid approval code. | `processing_errors` | | C02 | | Credit Not Processed | A refund they expected didn't arrive, or was for the wrong amount. | `consumer_disputes` | | C04 | | Goods/Services Returned or Refused | They returned or refused the goods but weren't refunded. | `consumer_disputes` | | C05 | | Goods/Services Canceled | They canceled the order but were still charged. | `consumer_disputes` | | C08 | 4554 | Goods/Services Not Received or Only Partially Received | The order didn't arrive, or only part of it did. | `consumer_disputes` | | C14 | 4515 | Paid by Other Means | They paid for the purchase another way. | `consumer_disputes` | | C28 | 4544 | Canceled Recurring Billing | A recurring charge came after they canceled. | `consumer_disputes` | | C31 | 4553 | Goods/Services Not as Described | What arrived differs from the description. | `consumer_disputes` | | C32 | 4532 | Goods/Services Damaged or Defective | The goods or service arrived damaged or defective. | `consumer_disputes` | | | 4754 | Local Regulatory/Legal Dispute | A legal right under local law. | `consumer_disputes` | Other American Express codes, such as F10, F14, C18, P22, M01, M10, M49, R03, R13, FR4, and FR6, map to `consumer_disputes`. R03 and R13 are chargebacks for an inquiry you answered incompletely or not at all. FR4 and FR6 come from the Immediate Chargeback programs, described in [Monitoring programs](/risk/disputes/monitoring-programs#immediate-chargeback). ## Discover [#discover] Discover sends letter codes, such as UA02, and many acquirers send a numeric equivalent instead. Pay.com maps Discover's numeric codes: | Code | Discover code | Discover name | What the cardholder claims | `reason` | | :--- | :------------ | :---------------------------------- | :---------------------------------------------------------- | :------------------ | | 7010 | UA01 | Fraud, Card Present Transaction | They didn't make an in-person payment. | `fraud` | | 7030 | UA02 | Fraud, Card Not Present Transaction | They didn't make an online, phone, or mail-order payment. | `fraud` | | 4866 | UA05 | Fraud, Chip Counterfeit Transaction | A counterfeit chip card was used, and the chip wasn't read. | `fraud` | | 4867 | UA06 | Fraud, Chip and PIN Transaction | A lost or stolen chip-and-PIN card was used without PIN. | `fraud` | | 4752 | AA | Does Not Recognize | They don't recognize the payment. | `fraud` | | 4753 | IN | Invalid Card Number | The card number isn't on the issuer's file. | `authorization` | | 4534 | DP | Duplicate Processing | The same payment was charged twice. | `processing_errors` | | 4542 | LP | Late Presentation | The payment was submitted too late. | `processing_errors` | | 4550 | CD | Credit/Debit Posted Incorrectly | A refund was posted as a sale, or the reverse. | `processing_errors` | | 4586 | AW | Altered Amount | The amount differs from what they agreed to. | `processing_errors` | | 4865 | PM | Paid by Other Means | They already paid another way. | `processing_errors` | | 4755 | RG | Non-Receipt of Goods or Services | They didn't receive the goods or service. | `consumer_disputes` | | 4553 | RM | Quality of Goods or Services | The goods or service were defective or not as described. | `consumer_disputes` | | 4541 | AP | Recurring Payments | A recurring charge came after they canceled. | `consumer_disputes` | | 8002 | RN2 | Credit Not Processed | A refund they were promised wasn't processed. | `consumer_disputes` | If the acquirer sends a letter code, or a code that isn't in this table, such as AT, DA, NA, EX, or NF, `reason` is `consumer_disputes`. ## Diners Club [#diners-club] Pay.com also maps Diners Club International codes: | Code | Diners Club name | `reason` | | :--- | :---------------------------------------------------- | :------------------ | | C41 | Card Present Transaction | `fraud` | | C42 | Card Not Present Transaction | `fraud` | | C46 | Multiple Charges at Service Establishment, Fraudulent | `fraud` | | C53 | Chip Card Counterfeit Transaction | `fraud` | | C54 | Lost or Stolen Chip and PIN Card Transaction | `fraud` | | A06 | Unissued Account Number | `authorization` | | A02 | Authorization Processing Errors | `processing_errors` | | B24 | Late Presentation | `processing_errors` | | B25 | Duplicate Charge | `processing_errors` | | B26 | Incorrect Exchange Rates | `processing_errors` | | B27 | Incorrect Currency | `processing_errors` | | D61 | Altered Amount | `processing_errors` | | D67 | Cardmember Paid by Other Means | `processing_errors` | | D62 | Non-Receipt of Goods or Services | `consumer_disputes` | | D66 | Credit Not Processed | `consumer_disputes` | | D69 | Canceled Recurring Transactions | `consumer_disputes` | | D70 | Cardmember Does Not Recognize | `consumer_disputes` | ## JCB [#jcb] Pay.com doesn't map JCB codes, so `reason` is `consumer_disputes` for every JCB dispute. Read `reason_code` and this table to see the claim. JCB cards acquired in the US use Discover's network and codes. | Code | JCB name | What the cardholder claims | | :--- | :--------------------------------------- | :---------------------------------------------------------------------------- | | 501 | No Authorization / Non-JCB Card | The payment had no valid authorization, or the card isn't a JCB card. | | 503 | Expired JCB Card | The payment used an expired card without proper authorization. | | 521 | Transaction Exceeds Floor Limit | An offline payment above the floor limit had no approval. | | 522 | Authorization Declined | The payment proceeded after a decline. | | 547 | JCB Card on Stop List | The card was on JCB's stop list. | | 581 | Split Sale | One purchase was split into several charges. | | 523 | Incorrect Card Number | The payment was posted to a wrong card number. | | 541 | Illegible Item | The payment record was missing data or unreadable. | | 507 | Incorrect Transaction Amount | The amount differs from the receipt. | | 510 | Mispost | A sale was processed instead of a refund, or the reverse. | | 512 | Duplicate Processing | The same payment was charged twice. | | 524 | Addition Error | The amount is higher than authorized. | | 525 | Altered Amount | The amount was changed after they agreed to it. | | 536 | Late Submission | The payment was submitted too late. | | 545 | Incorrect ECI | They deny the payment, and its e-commerce indicator was wrong. | | 582 | Domestic Transaction | A domestic payment in Japan was settled internationally. | | 583 | Paid by Other Means | They already paid another way. | | 502 | Cardmember Dispute | The goods were defective or not as described, or the service wasn't provided. | | 513 | Credit Not Received | A refund they were promised didn't arrive. | | 554 | Non-Receipt of Merchandise / Cash at ATM | The goods or ATM cash didn't arrive. | | 537 | No Show Dispute | They dispute a no-show charge. | | 538 | Advance Deposit | They were charged a deposit for a booking that was canceled or changed. | | 544 | Canceled Recurring Transaction | A recurring charge came after they canceled. | | 516 | Non-Receipt of Requested Item | You didn't answer a copy request. | | 517 | Requested Copy Illegible | The copy you sent was unreadable. | | 527 | No Imprint | They deny the payment, and no card imprint was taken. | | 534 | Unauthorized Multiple Transactions | They deny extra payments made with their card. | | 546 | Unauthorized Purchase | They didn't make a card-not-present payment. | | 548 | IC Liability Shift | A lost or stolen chip card was used, and the chip wasn't read. | ## UnionPay [#unionpay] Pay.com doesn't map UnionPay codes, so `reason` is `consumer_disputes` for every UnionPay dispute. Read `reason_code` and this table to see the claim. UnionPay cards acquired in the Americas use Discover's network and codes. | Code | UnionPay name | What the cardholder claims | | :--- | :--------------------------------------- | :------------------------------------------------------------------------- | | 4514 | Fraudulent Multiple Transactions | Extra payments were made without their permission while they had the card. | | 4515 | Cardholder Denies the Transaction | They didn't make or allow the payment. | | 4562 | Counterfeit Card | A counterfeit card was used. | | 4547 | Hot Card List | The card was on UnionPay's blocked-card list. | | 4803 | Risk Merchant | The merchant is on UnionPay's risk list. | | 4508 | Exceeds Limited or Authorized Amount | The amount was over the authorized amount or limit. | | 4522 | Declined Authorization | The payment proceeded after a decline. | | 4558 | Verification for Transaction Certificate | The issuer questions the chip data behind the payment. | | 4503 | Dispute on Debit Adjustment | They dispute a debit adjustment. | | 4512 | Duplicate Processing | The same payment was charged twice. | | 4536 | Late Presentment | The payment was presented too late. | | 4806 | Paid by Other Means | They already paid another way. | | 4507 | Transaction Amount Differs | The amount differs from what they agreed to. | | 4559 | Transaction Certificate Not Provided | The acquirer couldn't send the chip data the issuer asked for. | | 4502 | Cash/Goods/Services Not Received | The cash, goods, or service didn't arrive. | | 4532 | Refund/Credit Not Processed | A refund they're owed wasn't processed. | | 4544 | Canceled Transaction | They were charged for a canceled purchase. | ## Next steps [#next-steps] * [Dispute evidence](/risk/disputes/evidence): Submit the evidence that answers the code. * [Respond to a dispute](/risk/disputes/respond): Accept or defend before the deadline. * [Monitoring programs](/risk/disputes/monitoring-programs): How disputes count toward each network's ratios. # Respond to a dispute (/risk/disputes/respond) When a dispute is `open`, accept it or defend it before its `evidence_required_by` deadline. If you do nothing, it expires and closes in the cardholder's favor. Respond in the Pay.com dashboard, in **Fraud & Disputes** → **Disputes**, or with the [Disputes API](/api-reference/endpoints/disputes/list-disputes). ## Accept or defend [#accept-or-defend] You can respond to a dispute while its status is `open`, or `pre_arbitration` with `evidence_required_by` set. Otherwise the API returns `400`. | Response | What it means | When to choose it | | :--------- | :------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------- | | **Accept** | You agree the cardholder is right. The dispute closes as `chargeback_accepted`, and the amount stays debited. You can't undo it. | The charge was a mistake, the customer is owed the money, or you don't have evidence that answers the reason code. | | **Defend** | You submit evidence that the charge was valid. The acquirer presents it to the issuer. | You can show the customer authorized the payment and received what they paid for. | To decide, read the dispute's `reason` and `reason_code`, and check what evidence answers that claim. See [Reason codes](/risk/disputes/reason-codes). ### Accept a dispute [#accept-a-dispute] Send [`POST /v1/disputes/{dispute_id}/accept`](/api-reference/endpoints/disputes/accept-dispute). The call is synchronous, so the dispute it returns is already `chargeback_accepted`, and Pay.com sends a `dispute.chargeback_accepted` event. ```bash curl -X POST https://api.sandbox.pay.com/v1/disputes/dspt_692434889303132160/accept \ -u ':sk-pay-com-sandbox-…' \ --header 'idempotency-key: 7d2e4c1a-5b8f-4e6a-9c3d-2f1b0a9e8d77' ``` ```json { "id": "dspt_692434889303132160", "resource": "dispute", "amount": 5000, "currency": "usd", "charge": "chrg_692434850019280896", "reason": "consumer_disputes", "reason_code": "13.1", "status": "chargeback_accepted", "evidence_required_by": null } ``` Amounts are in the currency's smallest unit, so `5000` is $50.00. ### Defend a dispute [#defend-a-dispute] Upload your documents and submit them as evidence with [`POST /v1/disputes/{dispute_id}/evidences`](/api-reference/endpoints/disputes/submit-dispute-evidence). The dispute moves to `evidence_under_review`. See [Dispute evidence](/risk/disputes/evidence) for the steps and the file limits, and [Defend disputes in bulk](/risk/disputes/bulk-defend) to send the same files for several disputes. ## Deadlines [#deadlines] `evidence_required_by` is the last time to respond. Pay.com sets it from the deadline the acquirer reports, or, when the acquirer reports none, to a fixed number of days after the dispute arrives, 7 days for most acquirers. It's set only while you can respond, and `null` otherwise. The Pay.com dashboard shows an earlier date, **Expires in**, 2 to 8 days before `evidence_required_by`. That leaves time for Pay.com to review your evidence and send it to the acquirer before the acquirer's own deadline. Respond by the dashboard's date. Once `evidence_required_by` has passed, the dispute expires the next time Pay.com checks for expired disputes. ### The card networks' deadlines [#the-card-networks-deadlines] Each card network sets how long every party has at each stage. Your deadline is earlier than the network's, because the acquirer needs time to present your evidence. | Network | Issuer files the dispute | Acquirer responds | Issuer's next step | Arbitration | | :--------------- | :------------------------------------------------------------------------------------- | :---------------- | :---------------------------------------------------------------------- | :------------- | | Visa | Within 120 days of processing, or 75 days for some authorization and processing errors | Within 30 days | Pre-arbitration within 30 days of the response, answered within 30 days | Within 10 days | | Mastercard | Within 120 days, or 90 days for authorization and most point-of-interaction errors | Within 45 days | Pre-arbitration within 45 days of the response, answered within 30 days | Within 10 days | | American Express | Up to 120 days after the purchase | Within 20 days | American Express decides, with no pre-arbitration | None | After the acquirer presents your evidence, the issuer has 30 days for Visa, or 45 days for Mastercard, to accept it or file pre-arbitration. Until then the dispute stays in `evidence_under_review`. Some acquirers don't report a final outcome. For those, Pay.com closes a dispute that's still under review 60 or 70 days after it arrived, depending on the acquirer. It closes as `won` if the acquirer reported a representment, which credits the amount back, and as `lost` otherwise. ## Pre-arbitration [#pre-arbitration] If the issuer rejects your defense and disputes again, the dispute moves to `pre_arbitration`. When `evidence_required_by` is set, you can accept or defend again by the new deadline. Evidence submitted now is stored as `pre_arbitration_evidence`, regardless of the `type` you send. If `evidence_required_by` is `null`, the case is with the acquirer, and you can't respond. If the issuer still disagrees, the card network decides the case in arbitration (`arbitration_under_review`, then `arbitration_won` or `arbitration_lost`). ## Reissued disputes [#reissued-disputes] Pay.com keeps one dispute for each charge. If the issuer files again on a charge after the dispute closed, for example after you won, the same `dspt_` ID goes back to `open` or `pre_arbitration`, with a new deadline. Pay.com sends the event for the new status. Respond to it like a new dispute, and update your records from `data.status`, not from the earlier outcome. ## Chargebacks after a refund [#chargebacks-after-a-refund] Once a charge has a dispute, you can't refund it. The refund request returns `422` with `code: invalid_parameters` and the message "Related payment transaction is disputed". This keeps the cardholder from getting the money back twice. A cardholder can still dispute a charge you already refunded. The chargeback arrives for the full amount, and the acquirer debits it like any other. Defend it with proof of the refund: its date, its amount, and its acquirer reference number (ARN), which is in the refund's `underlying_network_details`. ## Disputes on third-party acquirers [#disputes-on-third-party-acquirers] When Pay.com routes a payment to an acquirer you contract with directly, that acquirer handles any dispute with the card network and Pay.com ingests it under the same `dspt_` object, statuses, and webhook events. The dispute's `settlement_account` and `settlement_account_details` show which acquirer processed the payment. Third-party acquirer disputes differ in five ways: * **Report latency and fields:** Pay.com receives these disputes from the acquirer's webhooks or daily reports. A dispute that comes in a daily report can reach Pay.com a day after the acquirer received it, and its status changes arrive the same way. `created` is the date the acquirer reports. `evidence_required_by` is the acquirer's deadline when it reports one, or a fixed number of days after the dispute arrives when it doesn't. `arn` holds the payment's retrieval reference number (RRN) when the acquirer doesn't send an ARN. * **Respond through Pay.com only:** Accept or defend these disputes in the Pay.com dashboard or the API, never in the acquirer's own portal. Pay.com sends your response to the acquirer through the acquirer's API, a file, or its portal. Pay.com sees actions in the acquirer's portal only when the acquirer's reports show them, so a response sent there can leave the wrong status in Pay.com and send the acquirer two responses. * **Evidence files:** Each acquirer limits the evidence files it accepts. One PDF of up to 2 MB and 18 pages meets every acquirer's limits. See [Limits](/risk/disputes/evidence#limits). * **Outcomes:** The acquirer reports the outcome, and the debit and credit, in its reports. For acquirers that don't report a final outcome, Pay.com closes the dispute as described in [Deadlines](#deadlines). A later report from the acquirer can still change the outcome, so read `data.status` on every event, as described in [Act on the status, not the event](/risk/disputes/lifecycle#act-on-the-status-not-the-event). * **Missing reason codes:** If the acquirer's report has no reason code, `reason_code` is `13.7` and `reason` is `consumer_disputes`, regardless of what the cardholder claimed. Check the acquirer's records for the real reason before you choose your evidence. ## Next steps [#next-steps] * [Dispute evidence](/risk/disputes/evidence): Upload and submit documents. * [Dispute lifecycle and statuses](/risk/disputes/lifecycle): Every status and event. * [Reason codes](/risk/disputes/reason-codes): What each network's codes claim. # Pay with Apple Pay or Google Pay (/sdks/react-native/apple-pay-google-pay) The drop-in shows the Apple Pay button on iOS, and the Google Pay button on Android, above the other methods. Turn them on with the `applePay` and `googlePay` options of [`checkout.presentDropIn()`](/sdks/react-native/checkout-present-drop-in). Each platform reads only its own option, so pass both and each platform shows its wallet. The customer pays in the wallet's own sheet, which opens with the session's [current total](/sdks/react-native/checkout-present-drop-in#when-the-amount-changes), and `presentDropIn()` resolves with the result as for any other method. Pay.com decrypts the wallet's token, so the app never handles card data. ```tsx const result = await checkout.presentDropIn({ applePay: { merchantIdentifier: 'merchant.com.myshop' }, googlePay: {}, }) ``` ## Parameters [#parameters] | Parameter | Type | Required | Description | | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------ | | `applePay` | `PayApplePayOptions` | No | Shows the Apple Pay button on iOS. | | `applePay.merchantIdentifier` | `string` | Yes | A merchant ID from your app's Apple Pay entitlement, for example `merchant.com.myshop`. | | `applePay.merchantCountryCode` | `string` | No | Your country, as an ISO 3166 alpha-2 code such as `US`. Default: your Pay.com account's country. | | `applePay.merchantDisplayName` | `string` | No | The total's label in the Apple Pay sheet. Default: your account's statement name. | | `applePay.buttonType` | `'plain' \| 'buy' \| 'checkout' \| 'book' \| 'subscribe' \| 'donate' \| 'order' \| 'continue' \| 'inStore' \| 'setUp'` | No | The button's label. Default: `'plain'`, the Apple Pay mark alone. | | `googlePay` | `PayGooglePayOptions` | No | Shows the Google Pay button on Android. `{}` turns it on with the defaults. | | `googlePay.merchantId` | `string` | No | Your Google merchant ID. Default: the one set up with Pay.com for your account. | | `googlePay.merchantName` | `string` | No | The merchant name in the Google Pay sheet. Default: your account's statement name. | | `googlePay.environment` | `'test' \| 'production'` | No | Google Pay's environment. Default: `'production'` for live sessions, `'test'` for sandbox ones. | | `googlePay.buttonType` | `'plain' \| 'buy' \| 'pay' \| 'checkout' \| 'order' \| 'subscribe' \| 'book' \| 'donate'` | No | The button's label. Default: `'plain'`, the Google Pay mark alone. | | `googlePay.buttonTheme` | `'dark' \| 'light'` | No | The button's theme. Default: dark on a light sheet, light on a dark one. | On iOS, [`appearance.applePayButtonStyle`](/sdks/react-native/drop-in-appearance) sets the Apple Pay button's colors. [`strings.orSeparator`](/sdks/react-native/drop-in-strings) is the text between the wallet's button and the other methods. ## When the button shows [#when-the-button-shows] The drop-in shows the wallet's button when all of these hold: * You passed the platform's option (`applePay` on iOS or `googlePay` on Android). * The session offers the wallet, which means [`checkout.paymentMethods()`](/sdks/react-native/checkout-payment-methods) lists `applepay` or `googlepay`. If you pass the drop-in's `paymentMethods` option, the wallet is in that list too. * The session takes a payment. It's a sale or authorization session with an amount and a currency, not a setup session. * Your Pay.com account has a country. On iOS, `merchantCountryCode` can set it instead. * The device can pay with the wallet, with a card network the session accepts. Otherwise, the sheet opens without the button. ## Set up the wallets [#set-up-the-wallets] **Apple Pay** needs the Apple Pay capability in your app, with the merchant ID you pass as `merchantIdentifier`. Pay.com must also hold that merchant ID's payment processing certificate for your account, because Pay.com decrypts the Apple Pay token. **Google Pay** runs in Google's test environment for sandbox sessions. Live payments need Google's production access for your app, with your Google merchant ID, from the Google Pay & Wallet Console. The SDK already turns on the Google Pay API in the app's manifest. ## Errors [#errors] `presentDropIn()` rejects as described in [its errors](/sdks/react-native/checkout-present-drop-in#errors). It rejects with a `TypeError` before the sheet opens when an option has an invalid value, such as an `applePay` without a non-empty `merchantIdentifier`, a `merchantCountryCode` that isn't two letters, a `googlePay` that isn't an object, or a `buttonType`, `environment`, or `buttonTheme` outside the allowed values. This validation runs on both platforms, even for the option the current platform doesn't use. ## Example [#example] ```tsx import { PayCheckout, type PayResult } from '@pay-com/react-native' export async function payWithWallets(clientSecret: string): Promise { const checkout = await PayCheckout.create(clientSecret, { returnUrl: 'myshop://pay' }) try { return await checkout.presentDropIn({ merchantDisplayName: 'My Shop', applePay: { merchantIdentifier: 'merchant.com.myshop', merchantCountryCode: 'US', buttonType: 'buy', }, googlePay: { buttonType: 'buy' }, appearance: { applePayButtonStyle: 'black' }, }) } finally { checkout.release() } } ``` ## Next steps [#next-steps] * [Present the drop-in](/sdks/react-native/checkout-present-drop-in): The sheet's other options, its result, and its errors. * [Style the drop-in](/sdks/react-native/drop-in-appearance): The Apple Pay button's style, with the rest of the sheet's look. * [Change the drop-in's text](/sdks/react-native/drop-in-strings): The text between the wallet's button and the other methods. # Pay with a saved payment method (/sdks/react-native/checkout-pay-with-saved-payment-method) In a sale or authorization session, the customer can pay with one of their saved payment methods, such as a card, a PayPal account, or a bank account. [`checkout.savedPaymentMethods()`](/sdks/react-native/checkout-saved-payment-methods) lists the saved methods of the customer the session was created for (its `customer_reference_id`), and [`checkout.pay()`](/sdks/react-native/checkout-pay) charges the one they pick. A saved method's `requiresCvc` tells you when to ask for a card's CVV. ```tsx const method = checkout.savedPaymentMethods()[0] const { cvc } = usePaySavedCardCvc(method) // Show when method.requiresCvc is true. const result = await checkout.pay({ type: 'savedPaymentMethod', id: method.id, cvc }) ``` The [drop-in](/sdks/react-native/checkout-present-drop-in#a-returning-customer) shows the customer's saved methods for you, in a carousel. To show them on your own screen instead, use `checkout.savedPaymentMethods()`, `requiresCvc`, and `checkout.pay()`. ## List the saved methods [#list-the-saved-methods] In a sale or authorization session, `checkout.savedPaymentMethods()` returns the customer's saved cards that haven't expired and their other saved methods the session can pay, such as PayPal accounts and bank accounts, as [`PaySavedPaymentMethod`](/sdks/react-native/checkout-saved-payment-methods#returns) objects, in the order the API sends them. Passkeys, Click to Pay, Apple Pay, and Google Pay aren't listed. Some saved methods can be paid only in a sale session, so an authorization session doesn't list them. A method's `type` indicates the payment method type, for example `card` or `paypal`. A card's `card` has the brand, the last 4 digits, and the expiration date. A bank account's `bankAccount` has the bank's name and the last 4 digits, and a PayPal account has its `email`. ## Ask for the CVV [#ask-for-the-cvv] A method's `requiresCvc` is `true` when the session checks CVVs and Pay.com doesn't hold one for the card. It's always `false` in a setup session, and for a saved method that isn't a card. When it's `true`, show a `PaySavedCardCvcField` for the customer to type the CVV into, with a `cvc` from [`usePaySavedCardCvc(method)`](/sdks/react-native/use-pay-saved-card-cvc). The hook follows the card's brand, so the input expects the right length (4 digits for American Express, 3 for other brands). Its `state.status` is `'valid'` once the CVV is complete. The CVV never reaches JavaScript. It stays in the native input, and goes from there only to Pay.com's vault. ## Pay [#pay] Call `checkout.pay({ type: 'savedPaymentMethod', id: method.id, cvc })`. It resolves with a [`PayResult`](/sdks/react-native/types#payresult). * **A card.** The SDK sends the saved card to Pay.com's vault, with the CVV when there is one. The payment then runs as it does for a card typed into the card fields, including 3DS, any challenge over the app's current screen, and the [amount check](/sdks/react-native/checkout-pay#when-the-amount-changes). * When `requiresCvc` is `false`, `cvc` is optional. An empty input sends nothing, and a CVV typed into it must be valid. * With [client-side encryption](/sdks/react-native/paycheckout-create#parameters) on, the native SDK encrypts the CVV on the device first. * **Another saved method,** such as a PayPal account or a bank account. Pay.com charges it the same way as in Pay.com.js. It may open the provider's page, as a redirect method does, which comes back to the app at its [return URL](/sdks/react-native/paycheckout-handle-return). The result can be `'processing'`, and your server learns the outcome from Pay.com. Leave `cvc` out. ## Errors [#errors] `pay()` rejects with a [`PayError`](/sdks/react-native/types#payerror) only when a call fails before sending a request: | Error code | When | | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `invalid_card_input` | For a card, `requiresCvc` is `true` and no `cvc` was passed, or the CVV isn't valid for the card's brand. `error.fields` is `['cvc']`. | | `unsupported` | The `id` isn't in this checkout's `savedPaymentMethods()`. | | `released` | The checkout, or the `cvc` in the request, was released. | | `payment_in_progress` | Another `pay()` on this checkout is still running. | | `no_screen` | There's no screen to show 3DS or the provider's page on (no foreground activity on Android, or no view controller on iOS). | Declines and the other failures come back as a `'failed'` result, as for a new card. ## Example [#example] ```tsx import { useState } from 'react' import { Button, Text, View } from 'react-native' import { PayError, PaySavedCardCvcField, usePaySavedCardCvc, type PayCheckout, type PaySavedPaymentMethod, } from '@pay-com/react-native' function label(method: PaySavedPaymentMethod): string { if (method.card) return `${method.card.brand ?? 'Card'} ending ${method.card.last4 ?? ''}` if (method.bankAccount) return `${method.bankAccount.bankName ?? 'Bank account'} ending ${method.bankAccount.last4 ?? ''}` return method.email ? `${method.type} (${method.email})` : method.type } export function SavedMethods({ checkout, onPaid }: { checkout: PayCheckout; onPaid: () => void }) { const methods = checkout.savedPaymentMethods() const [chosen, setChosen] = useState(methods[0] ?? null) const { cvc, state } = usePaySavedCardCvc(chosen) const [busy, setBusy] = useState(false) const [message, setMessage] = useState(null) async function pay() { if (!chosen) return setBusy(true) setMessage(null) try { const result = await checkout.pay({ type: 'savedPaymentMethod', id: chosen.id, cvc }) if (result.status === 'succeeded' || result.status === 'processing') { onPaid() // A hint for your UI: your server confirms the payment before you fulfill the order. } else if (result.status === 'failed') { setMessage(result.error.code === 'declined' ? 'This payment method was declined.' : "The payment didn't go through.") } // 'canceled': the customer closed the 3DS screen or the provider's page, and can pay again. } catch (error) { // Nothing was sent. if (error instanceof PayError && error.code === 'invalid_card_input') setMessage('Check the CVV.') else setMessage('Something went wrong. Try again.') } finally { setBusy(false) } } return ( {methods.map((method) => ( ``` ```js import Pay from '@pay-com/js' const pay = await Pay.com({ identifier: '', // your Pay.com merchant ID, not the session ID }) const checkout = pay.checkout({ clientSecret: 'eyJhbGciOiJIUzUxMiJ9...', // client_secret from your server onSuccess: (result) => { console.log('Bank account linked:', result) // Notify your server with result.transaction (the setup session ID) // so your server can retrieve GET /v1/sessions/setup/{id} }, onFailure: (error) => { console.error('Linking failed:', error.message) }, }) document.getElementById('link-bank-btn').addEventListener('click', async () => { try { await checkout.headless('us_bank_account') } catch (error) { console.error('Linking failed:', error.message) } }) ``` `identifier` is your Pay.com merchant ID (in the Pay.com dashboard, under **Developers**), not the setup session ID. The session is identified by the `client_secret` you pass to `pay.checkout()`. Create a new setup session on your server for each customer that needs to link their bank account.
### Retrieve the payment method ID [#retrieve-the-payment-method-id] After the customer completes the Plaid flow, `onSuccess` fires and Pay.com sends a [`setup_session.completed`](/api-reference/endpoints/setupsessions/events) webhook. Call [`GET /v1/sessions/setup/{id}`](/api-reference/endpoints/setupsessions/get-ss-by-id) from your server with the setup session ID from Step 1, confirm `status` is `completed`, and read `payment_method` for the newly linked `pm_us_bank_account_...` ID. Store this ID on the customer record as the destination for future payouts. ```bash curl https://api.sandbox.pay.com/v1/sessions/setup/ss_717689445138038784 \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "ss_717689445138038784", "resource": "setup_session", "customer": "cust_717689313483032577", "customer_reference_id": "your-customer-id", "payment_method": "pm_us_bank_account_717695840956713984", "status": "completed", "test_mode": true } ``` To display masked bank account metadata (bank name, account type, last four digits) in your UI, retrieve all saved methods for the customer with [`GET /v1/customers/{customer_reference_id}/payment_methods`](/api-reference/endpoints/customers/get-customer-payment-methods-by-reference) and match by `id`. ### Create a payout [#create-a-payout] Send [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout) from your server using the `pm_us_bank_account_...` ID as `destination`, with a unique [`idempotency-key`](/developer-resources/idempotency-and-retries). Amounts are in minor units (the smallest currency unit), so `10000` is $100.00 USD. To control the transfer rail, pass `payout_method_options.us_bank_account`. Set `rail` to `ach`, `rtp`, or `fednow`. For ACH, set `ach_payment_type` to `next_day` or `same_day`. Set `fallback_to_ach: true` to fall back to same-day ACH when RTP isn't available. FedNow payouts always fall back to ACH. ACH bank account payouts must be explicitly enabled on your Pay.com account before this step works. Card payout enablement doesn't cover bank account payouts. If you receive `"Payouts are not allowed"`, contact your account manager to enable ACH payouts. ```bash curl https://api.sandbox.pay.com/v1/payouts \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -H "idempotency-key: $(uuidgen)" \ -d '{ "amount": 10000, "currency": "usd", "destination": "pm_us_bank_account_717695840956713984", "reference": "payout-order-001", "payout_method_options": { "us_bank_account": { "rail": "rtp", "fallback_to_ach": true, "ach_payment_type": "same_day" } } }' ``` ```json { "id": "po_709068516191371264", "resource": "payout", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "payment_method": "pm_us_bank_account_717695840956713984", "payment_method_details": { "type": "us_bank_account", "us_bank_account": { "account_holder_name": "Jane Smith", "account_holder_type": "individual", "account_type": "savings", "bank_name": "Tartan Bank", "country": "US", "currency": "USD", "last4": "1111", "routing_number": "011401533" } }, "reference": "payout-order-001", "status": "pending", "test_mode": true } ``` An ACH payout is created with `status: "pending"`, and webhooks deliver its outcome. Pay.com sends `payout.succeeded` when the payout is sent to the customer's bank, `payout.failed` if it's declined or canceled, and `payout.returned` if the bank sends it back, usually within 2 business days. Until a pending ACH payout is sent to the bank, you can cancel it with [`POST /v1/payouts/{id}/cancel`](/api-reference/endpoints/payouts/cancel-payout). A payout on RTP or FedNow can't be canceled. See [Track and manage payouts](/payouts/track-payouts).
## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Sandbox transactions never move real funds. See [Environments](/get-started/environments). In the sandbox, Plaid Link runs against Plaid's test environment, so use Plaid's test credentials. **Plaid test credentials:** Plaid Link opens with a phone number prompt. There are two paths through the Plaid test flow: Use this path for faster testing. The `onSuccess` callback fires immediately after account selection. | Field | Value | | ------------ | -------------- | | Phone number | `415-555-0011` | | OTP code | `123456` | After entering the OTP, select any account shown. Plaid presents test accounts such as "Plaid Saving" from "Tartan Bank". Click **Continue without phone number** on the first screen. This path redirects through a simulated bank OAuth flow: 1. Select an institution (for example, "Tartan Bank") 2. You're redirected to the bank's external sign-in page 3. Enter username `user_good` and password `pass_good` 4. Enter OTP `123456` when prompted 5. Select the accounts to share with Plaid 6. Confirm the account information 7. Optionally save your login with Plaid, then continue ### Test scenarios [#test-scenarios] To test account linking, enter phone `415-555-0011` and OTP `123456`, select an account, and confirm `GET /v1/sessions/setup/{id}` returns `status: "completed"` with a `pm_us_bank_account_...` ID in `payment_method`. For sandbox payout outcome amounts (`202` succeeded, `303` failed, `505` immediate failure) and simulated returns (`POST /v1/payouts/{id}/simulate/return`), see [Test and go live](/payouts/test-and-go-live). ## Next steps [#next-steps] * [Track and manage payouts](/payouts/track-payouts): Monitor payout webhooks, cancel pending ACH transfers, and handle bank returns. * [Test and go live](/payouts/test-and-go-live): Run sandbox payout test cases and prepare for live processing. # Venmo payouts (/payouts/methods/venmo) Pay out to a recipient's Venmo account in the United States. See [Venmo](/payout-methods/venmo) in Payout connections for the providers that pay out to it. ## Pay out with the API [#pay-out-with-the-api] When you have the recipient's details, send [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout) with `destination_data.type` set to `"venmo"` and a unique [`idempotency-key`](/developer-resources/idempotency-and-retries) header. Amounts are in minor units, so `10000` is $100.00. Send at least one of `email`, `user_handle`, or `phone` to identify the recipient's Venmo account. ```json { "amount": 10000, "currency": "usd", "destination_data": { "type": "venmo", "venmo": { "email": "jane.smith@example.com" } }, "reference": "payout-12345" } ``` ```json { "id": "po_687092287729042432", "resource": "payout", "amount": 10000, "currency": "usd", "status": "pending", "payment_method_details": { "type": "venmo" }, "reference": "payout-12345", "test_mode": true } ``` `destination_data.venmo` accepts these fields. | Field | Description | | ------------- | ----------------------------------- | | `email` | Email address of the Venmo account. | | `user_handle` | Venmo user handle. | | `phone` | Phone number of the Venmo account. | See [Create a payout](/payouts/create-a-payout) for common payout fields, and [Track and manage payouts](/payouts/track-payouts) for payout statuses and webhook events. ## Pay out to a saved Venmo account [#pay-out-to-a-saved-venmo-account] When the customer already saved their Venmo account with you, pay out to it without asking for their details again. It can be a payment method saved when they paid, or in a setup session. Read its ID from `payment_method` on the charge or payment session, or list the customer's payment methods with [`GET /v1/customers/{reference_id}/payment_methods`](/api-reference/endpoints/customers/get-customer-payment-methods-by-reference). Then pass the ID as `destination` in [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout). ```json { "amount": 10000, "currency": "usd", "destination": "pm_venmo_750042760773370880", "customer_reference_id": "cust-001", "reference": "payout-12345" } ``` Pay out only to a payment method whose `flow_directions.payout` is `true`. Pay.com sends the payout to any saved method you name, so one that can't receive payouts comes back declined, with `400` and `payment_method_error`. When you send `customer_reference_id`, the payment method must belong to that customer. ## Save the recipient's details with Pay.com.js [#save-the-recipients-details-with-paycomjs] The recipient enters their Venmo details in Pay.com.js, Pay.com saves them as a payment method, and you pay out to it. ### Create a payout setup session [#create-a-payout-setup-session] On your server, send [`POST /v1/sessions/setup`](/api-reference/endpoints/setupsessions/create-ss) with `payout` set to `true` and `"venmo"` in `payment_method_types`. Pay.com verifies that Venmo payouts are enabled on your account. `customer_reference_id` is required. Return the session's `client_secret` to your page. ```json { "customer_reference_id": "cust-001", "payment_method_types": ["venmo"], "payout": true } ``` ### Collect the details [#collect-the-details] Initialize Pay.com.js with the `client_secret`, and call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) when the recipient selects Venmo. Pay.com.js opens Venmo in a new tab. ```javascript try { await checkout.headless('venmo') } catch (error) { // onFailure receives the error details too. } ``` ### Pay out to the saved method [#pay-out-to-the-saved-method] When Pay.com.js calls `onSuccess`, retrieve the setup session with [`GET /v1/sessions/setup/{id}`](/api-reference/endpoints/setupsessions/get-ss-by-id). Read the saved payment method ID from `payment_method` and pass it as `destination` in [`POST /v1/payouts`](/api-reference/endpoints/payouts/create-payout) for this and future payouts. ## Next steps [#next-steps] * [Track and manage payouts](/payouts/track-payouts): Follow payout statuses, webhook events, cancellations, and returns. * [Test and go live](/payouts/test-and-go-live): Test sandbox outcomes and complete the go-live checklist. # Chargebacks911 (/payments/integrated-partners/chargeback-providers/chargebacks911) Chargebacks911 is a chargeback management company. Pay.com receives Ethoca and Verifi CDRN alerts about your payments through Chargebacks911, and each alert that matches a charge becomes a collaboration in the **Collaborations** tab of the Pay.com dashboard. ## How it works [#how-it-works] An alert becomes a collaboration you resolve in three steps. ### An alert arrives [#an-alert-arrives] The customer's bank flags a payment, and Chargebacks911 sends Pay.com the alert. Pay.com matches it to your charge. ### Pay.com opens a collaboration [#paycom-opens-a-collaboration] If the charge is already refunded, Pay.com reports that to Chargebacks911 and the alert closes. Otherwise Pay.com opens a collaboration and sends the `collaboration.open` webhook event. You have 24 hours to refund the charge. ### You resolve it [#you-resolve-it] Refund the charge in the dashboard, with the [Collaborations API](/api-reference/endpoints/collaborations/refund-collaboration), or with an Automatic Resolve rule. Pay.com refunds the charge and reports the outcome to Chargebacks911. ## Get started [#get-started] Contact Pay.com support to enroll. If you already receive Ethoca or Verifi CDRN alerts through another provider, leave that enrollment first. ## Next steps [#next-steps] * [Collaborations](/risk/collaborations): Respond to alerts, and set up Automatic Resolve rules. * [Disputes](/risk/disputes): What happens when an alert isn't resolved. # ChargeForwards (/payments/integrated-partners/chargeback-providers/chargeforwards) ChargeForwards is a chargeback prevention service. With ChargeForwards Avoid, it receives Ethoca alerts about your payments, finds each alerted charge in Pay.com, and refunds it before the customer's bank files a dispute. Pay.com then records the alert as a resolved collaboration, which you see in the **Collaborations** tab of the Pay.com dashboard. ## What it supports [#what-it-supports] ChargeForwards does these through the Pay.com API: | Action | What happens in Pay.com | | ---------------- | ------------------------------------------------------------------------------------------------------------ | | Find the charge | Lists your charges and matches the alert by amount, date, currency, and the card's BIN and last four digits. | | Refund | Refunds the charge. The refund's `reference` is `CF` followed by the alert's ID. | | Report the alert | Pay.com records a resolved collaboration from Ethoca for the charge. | ## Get started [#get-started] ChargeForwards connects to Pay.com with an API key you create for it. 1. Create an API key for ChargeForwards with **Read** permission on **Charges** and **Write** permission on **Refunds**. Create one key for each Pay.com account. See [How a provider connects](/payments/integrated-partners/chargeback-providers#how-a-provider-connects). 2. Add ChargeForwards' IP addresses to the key under [network access](/developer-resources/authentication/scoped-api-keys#network-access). 3. Send the API key to ChargeForwards. ChargeForwards matches most alerts to a charge on its own. To let its team handle an alert that doesn't match, invite a ChargeForwards user to your Pay.com dashboard with permission to search and refund charges. ## Next steps [#next-steps] * [Collaborations](/risk/collaborations): How Pay.com records pre-dispute alerts. * [Refunds](/payments/refunds): Refund statuses, and how refunds appear in the dashboard. * [Manage API keys](/developer-resources/authentication/scoped-api-keys): Permissions and network access. # Chargeback providers (/payments/integrated-partners/chargeback-providers) Chargeback providers work on your disputes and pre-dispute alerts for you. They read what's in your Pay.com account and act on it through the Pay.com API, so every refund, alert, and piece of evidence they handle shows in your Pay.com dashboard. ## Choose a provider [#choose-a-provider] Compare what each provider does with Pay.com, then open its page for setup details. | Provider | What it does with Pay.com | API key permissions | Setup | | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------- | ---------------------------- | | [Chargebacks911](/payments/integrated-partners/chargeback-providers/chargebacks911) | Delivers Ethoca and Verifi CDRN alerts, which you resolve as collaborations | No key | Pay.com support | | [ChargeForwards](/payments/integrated-partners/chargeback-providers/chargeforwards) | Resolves Ethoca alerts by refunding the alerted charge | **Read** on **Charges**, **Write** on **Refunds** | API key | | [Justt](/payments/integrated-partners/chargeback-providers/justt) | Fights disputes by submitting evidence for them | **Write** on **Disputes** and **Documents** | API key and webhook endpoint | ## How a provider connects [#how-a-provider-connects] A provider that works through the API connects with a Pay.com API key you create for it under **Developers** → **API keys** in the [Pay.com dashboard](https://dashboard.pay.com). Give the key only the permissions in the provider's row, and add the provider's IP addresses to it under [network access](/developer-resources/authentication/scoped-api-keys#network-access). Chargeback providers don't send card details, so their keys don't need to be PCI compliant. ## Next steps [#next-steps] * [Disputes](/risk/disputes): How disputes work, and how to respond to them yourself. * [Collaborations](/risk/collaborations): Pre-dispute alerts, and how to resolve them. * [Manage API keys](/developer-resources/authentication/scoped-api-keys): Permissions and network access. # Justt (/payments/integrated-partners/chargeback-providers/justt) Justt is a chargeback management service. It reads your disputes from the Pay.com API, builds the evidence for each one, and submits it to Pay.com, which sends it to the acquirer. It works on the disputes for every payment you process through Pay.com. ## What it supports [#what-it-supports] Justt does these through the Pay.com API: | Action | What happens in Pay.com | | ----------------- | ---------------------------------------------------------------------------------------------------------------- | | Read disputes | Lists your disputes and retrieves each one. | | Upload a document | Creates a document and uploads the file for it. | | Submit evidence | Adds the document and a description to the dispute as evidence. Pay.com reviews it and sends it to the acquirer. | Justt waits for each uploaded document's `document.active` event before it submits the document as evidence. See [Dispute evidence](/risk/disputes/evidence). ## Get started [#get-started] Justt connects to Pay.com with an API key and a webhook endpoint you create for it. 1. Create an API key for Justt with **Write** permission on **Disputes** and **Documents**, and add Justt's IP addresses to it under [network access](/developer-resources/authentication/scoped-api-keys#network-access). See [How a provider connects](/payments/integrated-partners/chargeback-providers#how-a-provider-connects). 2. Under **Developers** → **Webhooks**, add the webhook endpoint Justt gives you, with the `document.active` event. See [Webhooks](/developer-resources/webhooks#set-up-a-webhook-endpoint). 3. Send the API key and the endpoint's signing secret to Justt's onboarding team. ## Next steps [#next-steps] * [Disputes](/risk/disputes): How disputes work, and their statuses. * [Dispute evidence](/risk/disputes/evidence): The evidence types and the file limits processors accept. * [Manage API keys](/developer-resources/authentication/scoped-api-keys): Permissions and network access. # Magento module (/payments/plugins/magento) The Pay.com module for Magento 2 and Adobe Commerce adds Pay.com as a payment method at the Luma checkout. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, in a payment form rendered in Pay.com-hosted frames. Magento places and validates the order before any payment is taken, and the store confirms every payment with Pay.com on its server before it marks the order paid. To install the module and connect it to your Pay.com account, see [Set up the Magento module](/payments/plugins/magento/set-up). Every setting and its default is in [Settings](/payments/plugins/magento/settings). ## Supported features [#supported-features] The module supports these checkout and order management features. | Feature | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Checkout | Cards, wallets, and local payment methods at the Luma checkout. By default, the card is entered in secure fields styled like your checkout, and each payment method is an option of its own. See [Checkout settings](/payments/plugins/magento/settings#checkout). | | Capture | Capture when the customer pays, or authorize at checkout and capture by invoicing the order with **Capture Online**. With **Capture when the order ships**, the first shipment captures the authorization. | | Refunds | Refund a captured payment online from a credit memo, in full or in part. **Void**, or canceling an order that is only authorized, releases the authorization. | | Payment review | A payment that doesn't match its order waits in **Payment Review**. **Accept Payment** takes it as it is, and **Deny Payment** refunds the payment and cancels the order. | | Express checkout | Apple Pay and Google Pay buttons on product pages, the cart page, the mini-cart, and the top of the checkout page. Customers pay without going through the checkout form, and Magento still places and validates the order first. A product page button buys that one product and leaves the cart as it was. | | Saved cards | Logged-in customers can save a card when they pay in Pay.com's payment form, pay with it later, and add or delete cards under **My Account** → **Stored Payment Methods**. With card fields, the default, cards aren't saved at checkout. Pay.com keeps the card. The store keeps only its brand, last four digits, and expiration date. | | Apple Pay domain | The store serves Apple's domain association file and registers each website's domain with Apple through Pay.com. | | Headless storefronts | Storefronts on Magento's GraphQL, such as PWA Studio, take payments through the mutations of the module's GraphQL companion. See [Headless storefronts](#headless-storefronts). | ## How orders stay in sync [#how-orders-stay-in-sync] The store confirms each payment with Pay.com on its server. Webhooks, and a background check every 15 minutes on Magento's cron, reconcile payments when a customer closes the browser before returning to your store. | Pay.com outcome | Magento order | | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | Paid | **Processing**, with a paid invoice. Magento sends the order email. | | Authorized (manual capture) | **Processing**, with an open authorization and a note to invoice the order with **Capture Online** before the authorization expires. | | Funds pending, for example a bank debit | **Payment Review**, with no invoice and a note not to ship until the funds clear. | | Failed | **Canceled**. The cart is kept, so the customer can pay again. | | Requires manual review | **Payment Review**, with a note saying why. A paid order whose payment is disputed later goes **On Hold**. | A payment that completes after its order was canceled is refunded, or its authorization released, with a note on the order. Before Magento's cleanup of pending orders cancels a Pay.com order, the module checks it with Pay.com. A paid order is settled instead, and an order with a payment in flight is kept. A refund made in the Pay.com dashboard is noted on its order. Record it in Magento with an offline credit memo. The module subscribes to the 12 shared [plugin webhook events](/payments/plugins#webhook-events). ## Apple Pay [#apple-pay] The Apple Pay button shows only on a domain registered with Apple. Under **Apple Pay domain** in the settings, on the default scope or a website, click **Register domain** for each environment. The store sends its domain, the host of the website's secure base URL, to Pay.com, and Pay.com asks Apple to check the domain association file that the module serves. If Apple can't verify the domain, the settings page shows Apple's reason. The store must be on HTTPS at the root of its domain. A real file at `pub/.well-known/apple-developer-merchantid-domain-association` takes precedence over the module's. ## Headless storefronts [#headless-storefronts] For a storefront that uses Magento's GraphQL, install the GraphQL module, `pay-com/magento2-payments-graphql`, next to this one. It adds these mutations to Magento's own, for the same flow. Magento places the order, then the browser pays. | Mutation | What it does | | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `createPayComPaymentSession` | Gives a cart a payment session to render Pay.com's payment form on. Charges nothing. | | `attachPayComPaymentSession` | Right after Magento's `placeOrder` with a Pay.com payment method, ties the session to the order's exact total. The browser pays once it returns `READY`, then goes to its `return_url`. | | `payComOrderPaymentStatus` | Called on the storefront's return page with the return URL's `t` parameter to confirm the payment with Pay.com, settle the order, and return the payment status. | | `startPayComExpressCheckout`, `payComExpressQuote`, `placePayComExpressOrder` | Apple Pay and Google Pay for a cart, priced with Magento's carriers and totals. | With card fields and **Each payment method is its own option**, the defaults, Magento's `available_payment_methods` lists the card as `pay_com`, each of your payment methods as `pay_com_`, such as `pay_com_paypal` or `pay_com_applepay`, and `pay_com_other` for the rest. They all pay the cart's one session. Set any of them with `setPaymentMethodOnCart`, then place the order and attach the session as with `pay_com`. In `setPaymentMethodOnCart`, `payment_method.pay_com` describes what the form pays. With code `pay_com`, `method` names the method it pays, and `button: true` means an Apple Pay or Google Pay button placed the order. An order for Apple Pay or Google Pay is refused without `button: true`. A storefront that uses only `pay_com` can set **Payment methods at checkout** to **One option, with the payment methods listed inside it**. To pay with a saved card, set `pay_com_vault` with the card's `public_hash` in `setPaymentMethodOnCart`. Magento's `customerPaymentTokens` lists the cards. Set **Headless return page** to the storefront page customers come back to. ## Data the module sends [#data-the-module-sends] The module communicates with Pay.com in three ways: * The checkout page loads Pay.com.js from `https://js.pay.com/v1`, through Magento's RequireJS. Card details are entered in Pay.com frames and sent only to Pay.com. The details a payment method asks for, such as a bank or a code, are sent only to Pay.com too. * The store's server calls the Pay.com API (`https://api.pay.com/v1`, or `https://api.sandbox.pay.com/v1` for the sandbox) to read the payment methods your account offers, to create payment sessions, to confirm, capture, and refund payments, and to manage saved cards. * For Apple Pay, the store downloads Apple's domain association file from Pay.com at most once a day, and sends its domain to the Pay.com API when an administrator clicks **Register domain**. API keys and webhook secrets are encrypted with Magento's encryption key and stored separately from the payment method's settings, and the settings page never shows more than their last four characters. They're marked sensitive, so `bin/magento app:config:dump` writes them to `app/etc/env.php`, never to `config.php`. # Set up the Magento module (/payments/plugins/magento/set-up) The Pay.com module for Magento 2 and Adobe Commerce adds Pay.com as a payment method at your store's checkout. Install it, connect it to your Pay.com account, and take a test payment in the sandbox. What the module does once it's running is in [Magento module](/payments/plugins/magento). ## Requirements [#requirements] The module works with Magento's Luma checkout. Storefronts on Magento's GraphQL, such as PWA Studio, also need its GraphQL module. See [Headless storefronts](/payments/plugins/magento#headless-storefronts). | Requirement | Version | | ------------------------------------- | ------------------------------------------------- | | Magento Open Source or Adobe Commerce | 2.4.7 or later (tested on 2.4.7-p10 and 2.4.8-p5) | | PHP | 8.2, 8.3, or 8.4 | | Module | 0.1.0 | ## Install and connect [#install-and-connect] You connect the module with an API key, created in the Pay.com dashboard, for each environment you use. ### Install the module [#install-the-module] The module comes as a Composer package, `pay-com-magento2-payments-0.1.0.zip`. Put it in a folder of your Magento project, such as `packages/pay-com`, add that folder to Composer as an artifact repository, then require the package and run Magento's setup: ```bash composer config repositories.pay-com artifact ./packages/pay-com composer require pay-com/magento2-payments:0.1.0 bin/magento module:enable PayCom_Payments bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush ``` For a GraphQL storefront, put `pay-com-magento2-payments-graphql-0.1.0.zip` in the same folder and require `pay-com/magento2-payments-graphql:0.1.0` as well. ### Enter your API keys [#enter-your-api-keys] Go to **Stores** → **Configuration** → **Sales** → **Payment Methods** → **Pay.com**, on the default scope or a website. Paste an `sk-pay-com-sandbox-` key you created in the Pay.com dashboard into **Sandbox API key**, and an `sk-pay-com-live-` key into **Live API key** when you take live payments. Each key is checked with Pay.com when you save, and the store then reads the payment methods your account offers. Set **Enabled** to **Yes**. See [Settings](/payments/plugins/magento/settings#pay-com-account). ### Add the webhook [#add-the-webhook] In the Pay.com dashboard, add a webhook that sends events to the **Webhook URL** shown in the account block, then paste its signing secret into **Sandbox webhook signing secret** or **Live webhook signing secret**. Do this for each environment you use, and subscribe to the 12 [plugin webhook events](/payments/plugins#webhook-events). ### Check that cron runs [#check-that-cron-runs] On Magento's cron, the module checks open payments with Pay.com every 15 minutes, retries webhooks it couldn't process at first, and reads your account's payment methods once a day. Make sure the store's cron runs. ### Take a test payment [#take-a-test-payment] **Payments** is set to **Sandbox (test payments)** by default, so the store takes payments in the sandbox. Place an order with a [test card](/get-started/test-your-integration/test-cards), then set **Payments** to **Live** to take live payments. ## Next steps [#next-steps] * [Apple Pay](/payments/plugins/magento#apple-pay): Register your store's domain to show the Apple Pay button. * [Magento module](/payments/plugins/magento): What the module supports, how orders stay in sync with Pay.com, and the data the module sends. * [Settings](/payments/plugins/magento/settings): Every setting with its default. # Magento module settings (/payments/plugins/magento/settings) The settings are under **Stores** → **Configuration** → **Sales** → **Payment Methods** → **Pay.com**. They're set for the default scope or a website, so each website can have its own Pay.com account. **Title**, **Card title**, **Offer Apple Pay and Google Pay as payment methods**, the express checkout settings, each payment method's own **Title**, and **Headless return page** can also be set per store view. ## General [#general] These settings turn Pay.com on and name it at checkout: | Setting | Type | Default | Description | | ----------- | ------ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Enabled** | Yes/No | No | Offers Pay.com at checkout. | | **Title** | Text | `Card and other payment methods (Pay.com)` | The payment method's name at checkout when Pay.com is shown as a single payment method (with the Pay.com payment form, or with card fields and **One option, with the payment methods listed inside it**). When the checkout shows the Pay.com payment form in place of card fields, the card's payment method takes this title too, since that form offers every payment method. | ## Pay.com account [#pay-com-account] The account block shows the store's two environments, **Live** and **Sandbox**. For each one it shows whether the store has a key and its last four characters, and whether webhooks are set up. It also shows the **Webhook URL** to send events to (`https:///pay-com/webhook`). When the environment **Payments** picks has no key, the block warns that Pay.com doesn't show at checkout and names the key field to fill in, for example "Payments is set to Sandbox, but this store has only a live API key. Enter your Pay.com sandbox API key in the Sandbox API key field, or set Payments to Live." **Your payment methods** and **Apple Pay domain** say the same. | Setting | Description | | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Sandbox API key** | Paste an `sk-pay-com-sandbox-` key you created in the Pay.com dashboard. The key is checked with Pay.com before it's saved, stored encrypted, and never shown again. An empty field keeps the saved key. | | **Live API key** | The same for an `sk-pay-com-live-` key. | | **Remove key** | Removes the key you entered for the environment from the store. The key still works at Pay.com until you delete it in the Pay.com dashboard. | | **Sandbox webhook signing secret**, **Live webhook signing secret** | The signing secret of the webhook you added in the Pay.com dashboard for the environment, which sends events to the **Webhook URL**. When you replace it, the secret it replaces keeps verifying events for 24 hours. | | **Sandbox previous webhook secret**, **Live previous webhook secret** | An older signing secret, so events signed with it still verify while you rotate the secret. | ### Environment [#environment] **Payments** picks the environment the store takes payments in: | Setting | Type | Default | Description | | ------------ | ------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Payments** | Select | Sandbox (test payments) | **Sandbox (test payments)** takes payments in your Pay.com sandbox with the sandbox key, through `https://api.sandbox.pay.com/v1`. **Live** takes live payments with the live key, through `https://api.pay.com/v1`. Live needs a live key and the store on HTTPS. Otherwise, **Payments** stays set to **Sandbox (test payments)**, and the page says why. | ## Payments [#payments] These settings control capture, saved cards, the order reference, and where Pay.com is offered: | Setting | Type | Default | Description | | ------------------------------------- | ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Capture** | Select | Capture when the customer pays | **Capture when the customer pays** charges at checkout. **Authorize only; capture by invoicing the order** places an authorization. Invoice the order with **Capture Online** to capture it before it expires. | | **Capture when the order ships** | Yes/No | No | Shown with **Authorize only**. The first shipment of an authorized order invoices the whole order and captures the authorization, even when only part of it ships. If the capture fails, the shipment is kept and the order is put on hold with the reason. | | **Saved cards** | Yes/No | Yes | Logged-in customers can save a card at checkout in Pay.com's payment form, which asks them, pay with it next time, and remove it under **My Account** → **Stored Payment Methods**. With card fields, the default **Payment form**, there's no option to save a card at checkout. Cards saved in the sandbox are offered only in the sandbox, and live cards only in the live environment. | | **Order reference prefix** | Text | Empty | Shown in the Pay.com dashboard before the order number. Use a different prefix on each store that shares a Pay.com account. | | **Payment from Applicable Countries** | Select | All Allowed Countries | Offers Pay.com in every country the store allows, or only in **Specific Countries**. | | **Payment from Specific Countries** | Multiselect | Empty | The countries Pay.com is offered in, with **Specific Countries**. | | **Sort Order** | Text | `10` | Where Pay.com sits among the checkout's payment methods. | ## Checkout [#checkout] These settings control the payment form and how payment methods show at checkout: | Setting | Type | Default | Description | | ----------------------------------------------------- | ------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Payment form** | Select | Card fields styled like your checkout, with your payment methods listed | Card fields, the default, take the card in secure Pay.com fields that look like your checkout's own inputs, next to your store's list of payment methods. **Pay.com payment form** shows Pay.com's own form, with every payment method in it. | | **Payment methods at checkout** | Select | Each payment method is its own option | With card fields. **Each payment method is its own option** shows the card and each of your payment methods as a payment method of its own, when Pay.com offers it for the order. The methods without one show under **Other payment methods**. **One option, with the payment methods listed inside it** shows a single Pay.com payment method. | | **Card title** | Text | `Credit or debit card` | The card's name at checkout when each payment method is its own option. | | **Offer Apple Pay and Google Pay as payment methods** | Yes/No | Yes | With card fields. Lists Apple Pay and Google Pay among the payment methods. Each shows only in a browser that can pay with it. When a customer selects one, its button takes the place of **Place Order** and pays with the details they entered at checkout. | The checkout falls back to the Pay.com payment form if card fields aren't available or don't support any of the order's payment methods. With card fields, a payment method that requires additional details (such as a bank or code) shows inputs for them, and **Place Order** validates them before placing the order. Payment methods that require unsupported custom fields are omitted from checkout. Each payment method's own option has **Enabled**, **Title**, and **Sort Order** in a group at the end of the Pay.com settings, such as **Payment method: PayPal**. An empty **Title** uses the method's name, and an empty **Sort Order** uses the Pay.com **Sort Order**. ### Your payment methods [#your-payment-methods] **Your payment methods** lists the payment methods your Pay.com account offers, in the environment **Payments** picks, and when they were read. When each payment method is its own option, each one is a payment method at checkout, shown when Pay.com offers it for the order. Apple Pay and Google Pay show when your account has them set up. The list is read when you save an API key and again once a day. After you change your methods in the Pay.com dashboard, click **Refresh**. If a read fails, the list it had is kept and the page says why. Until the list is first read, the methods other than the card, Apple Pay, and Google Pay show under **Other payment methods**. ## Express checkout [#express-checkout] These settings place Apple Pay and Google Pay buttons that pay without the checkout form. The wallets that show are the ones your Pay.com account offers. | Setting | Default | Description | | ------------------------------------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Apple Pay and Google Pay on product pages** | Yes | Under **Add to Cart**. Buys the product shown, with the options picked in its form, without touching the customer's cart. | | **Apple Pay and Google Pay on the cart page** | Yes | Under **Proceed to Checkout**. Pays for the whole cart. | | **Apple Pay and Google Pay in the mini-cart** | Yes | Pays for the whole cart, as the cart page does. The buttons load only once the customer opens the mini-cart. | | **Apple Pay and Google Pay at the top of the checkout page** | Yes | Above the customer's details. Pays for the whole cart. The wallet collects the customer's email, phone, and addresses, and the order is placed from them, without filling in the checkout form. | The buttons hide when the checkout requires information a wallet can't provide, such as a required company, prefix, suffix, fax, or custom address field, or a terms and conditions checkbox. They also hide for guests when guest checkout is off, below the minimum order amount, and for products other than simple, virtual, and configurable ones. ## Apple Pay domain [#apple-pay-domain] **Apple Pay domain** shows the website's domain and, for each environment with a key, whether it's registered with Pay.com. If it isn't, the Apple Pay button doesn't show on that domain. Click **Register domain**. Apple checks the domain association file the module serves, so the store must be on HTTPS at the root of its domain. The settings page warns you when it isn't. ## Headless return page [#headless-return-page] The GraphQL module adds this setting: | Setting | Type | Default | Description | | ------------------------ | ---- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Headless return page** | Text | Empty | Added by the GraphQL module. Sets the storefront page customers return to after 3D Secure or a redirect payment method for payments started through GraphQL (for example, `https://shop.example.com/pay-com/return`). The module adds `?t=`, and the page sends the token to the `payComOrderPaymentStatus` mutation. Empty uses Magento's own return page. | ## Debug log [#debug-log] One setting adds detail to the module's log: | Setting | Type | Default | Description | | ------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | **Debug log** | Yes/No | No | Also logs what each payment check decided, in `var/log/pay-com.log`, which always gets warnings and errors. Card data and secrets are never logged. | The keys and secrets are encrypted with the encryption key in `app/etc/env.php`. If the store can no longer decrypt them, for example after its database was copied to another installation, the account block says so. Enter the keys again. # PrestaShop module (/payments/plugins/prestashop) The Pay.com module for PrestaShop 8 and 9 adds Pay.com's payment methods to PrestaShop's checkout. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, and enter card details in Pay.com-hosted frames. PrestaShop creates and validates the order before any payment is taken, and the shop confirms every payment with Pay.com on its server before it marks the order paid. To install the module and connect it to your Pay.com account, see [Set up the PrestaShop module](/payments/plugins/prestashop/set-up). Every setting and its default is in [Settings](/payments/plugins/prestashop/settings). ## Supported features [#supported-features] The module supports these checkout and order management features. | Feature | Description | | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Checkout | Cards, wallets, and local payment methods on PrestaShop's payment step, with the Classic theme and Hummingbird. By default, the card is entered in secure fields styled like your checkout, and each payment method is an option of its own. See [Checkout settings](/payments/plugins/prestashop/settings#checkout). | | Capture | Capture when the order is placed, or authorize at checkout and capture later with **Capture** in the order page's **Pay.com** block, or when the order is marked shipped. | | Refunds | A credit slip refunds its amount at Pay.com, whether it comes from a partial refund, a standard refund, or a return. **Release authorization**, or canceling an order that is only authorized, releases the authorization. | | Payment review | A payment that doesn't match its order waits in **Pay.com payment to review**. **Accept payment** takes it as it is, and **Deny payment** refunds the payment and cancels the order. | | Express checkout | Apple Pay and Google Pay buttons on product pages, the cart page, the window that opens when a product is added to the cart, and the top of the checkout page. Customers pay without going through the checkout's steps, and PrestaShop still creates and validates the order first. A product page button buys that one product and leaves the cart as it was. | | Saved cards | Signed-in customers pay with their saved cards at checkout, and add or delete cards under **My account** → **Saved cards**. With Pay.com's form, they can also save a card when they pay. Card fields, the default, never save a card at checkout. Pay.com keeps the card. The shop keeps only its brand, last four digits, and expiration date. | | Apple Pay domain | The shop serves Apple's domain association file and registers its domain with Apple through Pay.com. | | Multistore | One Pay.com account for all shops, or one per shop. | ## How orders stay in sync [#how-orders-stay-in-sync] The shop confirms each payment with Pay.com on its server. Webhooks, and a background check every 15 minutes on the module's cron, reconcile payments when a customer closes the browser before returning to your store. A new order waits in **Awaiting Pay.com payment**, and PrestaShop's order confirmation email is held back until payment is authorized or captured. | Pay.com outcome | PrestaShop order | | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | Paid | **Payment accepted**, or **On backorder (paid)** for an order on backorder, with its invoice. PrestaShop sends the order confirmation. | | Authorized (manual capture) | **Pay.com payment authorized**. Capture it from the order page before the authorization expires. | | Funds pending, for example a bank debit | **Awaiting Pay.com funds**, until the funds clear. | | Failed | **Payment error**, and inventory is restocked. The customer gets a copy of the cart, so they can pay again. | | Requires manual review | **Pay.com payment to review**, with a note saying why. | Once you move an order on, for example to **Processing in progress** or **Shipped**, the module leaves its state as you set it and notes later payment changes on the order. An order still unpaid after 24 hours is canceled, and inventory is restocked, once its payment session is blocked so it can't be paid later. A payment that completes after its order went to **Payment error** reopens the order, unless its cart was ordered again. A payment for a **Canceled** order is refunded, or its authorization released. A refund made in the Pay.com dashboard is noted on its order. The module subscribes to the 12 shared [plugin webhook events](/payments/plugins#webhook-events). ## Capture when the order ships [#capture-when-the-order-ships] With **Authorize only** and **Capture an authorized order when it is marked shipped**, moving an authorized order to a shipped state captures the authorization first. If the capture fails, PrestaShop 9 stops the change and shows the reason. PrestaShop 8 can't stop it. The order is marked shipped, and the module removes the payment PrestaShop recorded and puts the order in **Pay.com payment to review** with a note. ## Apple Pay [#apple-pay] The Apple Pay button shows only on a domain registered with Apple. Under **Apple Pay domain** on the module's page, click **Register domain** for each environment. The shop sends its domain to Pay.com, and Pay.com asks Apple to check the domain association file that the module serves. The shop must be on HTTPS at the root of its domain. A domain has one association file. The page warns you when a real file at `/.well-known/apple-developer-merchantid-domain-association` is served instead of the module's, or when another module, such as PrestaShop Checkout, serves its own file there first. ## Data the module sends [#data-the-module-sends] The module communicates with Pay.com in three ways: * The checkout page loads Pay.com.js from `https://js.pay.com/v1`. Card details are entered in Pay.com frames and sent only to Pay.com. * The shop's server calls the Pay.com API (`https://api.pay.com/v1`, or `https://api.sandbox.pay.com/v1` for the sandbox) to create payment sessions, to confirm, capture, and refund payments, to manage saved cards, and to read your account's payment methods. * For Apple Pay, the shop downloads Apple's domain association file from Pay.com at most once a day, and sends its domain to the Pay.com API when an employee clicks **Register domain**. API keys and webhook secrets are encrypted with the shop's own key, and the module's page never shows more than their last four characters. See [Settings](/payments/plugins/prestashop/settings#pay-com-account). # Set up the PrestaShop module (/payments/plugins/prestashop/set-up) The Pay.com module for PrestaShop adds Pay.com's payment methods to your shop's checkout. Install it, connect it to your Pay.com account, and take a test payment in the sandbox. What the module does once it's running is in [PrestaShop module](/payments/plugins/prestashop). ## Requirements [#requirements] The module works with PrestaShop's own checkout, with the Classic theme and Hummingbird. | Requirement | Version | | ----------- | ------------------------------------------------- | | PrestaShop | 8.0 or later, including 9 (tested on 8.2 and 9.2) | | PHP | 8.1 or later | | Module | 0.1.1 | ## Install and connect [#install-and-connect] You connect the module with an API key, created in the Pay.com dashboard, for each environment you use. ### Install the module [#install-the-module] In the back office, go to **Modules** → **Module Manager**, click **Upload a module**, and upload `pay_com_payments-0.1.1.zip`. PrestaShop installs it. To update a shop that runs 0.1.0, upload the new zip the same way, then upgrade the module with **Upgrade** in **Module Manager** or with `bin/console prestashop:module upgrade pay_com_payments`. The upgrade registers the hooks the shop lacks, such as the one for the express buttons at the top of the checkout page, and adds **Payment** → **Pay.com** to the back office menu. The module doesn't need a **Reset**. ### Enter your API keys [#enter-your-api-keys] Go to **Payment** → **Pay.com**. Under **API keys and webhook secrets**, paste an API key you created in the Pay.com dashboard on each environment's row (an `sk-pay-com-sandbox-` key on **Sandbox** for sandbox payments, and an `sk-pay-com-live-` key on **Live**). Click **Save**. Each key is checked with Pay.com before it's saved. See [Settings](/payments/plugins/prestashop/settings#pay-com-account). ### Add the webhook [#add-the-webhook] In the Pay.com dashboard, add a webhook that sends events to the **Webhook URL** shown on the module's page. Paste its signing secret into **Webhook signing secret** on the environment's row and click **Save**. Do this for each environment you use, and subscribe to the 12 [plugin webhook events](/payments/plugins#webhook-events). ### Set up the cron [#set-up-the-cron] On a cron, the module processes webhooks that wait and checks open payments with Pay.com. Under **Cron** on the module's page, copy the crontab line and add it to the server so it runs every minute: ```bash * * * * * curl -fsS -X POST -H 'X-Pay-Com-Cron-Token: ' https://shop.example.com/module/pay_com_payments/cron ``` You can also run `php modules/pay_com_payments/bin/cron.php` from the server's crontab, or use PrestaShop's **Cron tasks manager** module. See [Cron](/payments/plugins/prestashop/settings#cron). ### Take a test payment [#take-a-test-payment] **Mode** is set to **Sandbox (test payments)** by default, so the shop takes payments in the sandbox. Place an order with a [test card](/get-started/test-your-integration/test-cards), then set **Mode** to **Live** under **Settings** and click **Save** to take live payments. ## Next steps [#next-steps] * [Apple Pay](/payments/plugins/prestashop#apple-pay): Register your shop's domain to show the Apple Pay button. * [PrestaShop module](/payments/plugins/prestashop): What the module supports, how orders stay in sync with Pay.com, and the data the module sends. * [Settings](/payments/plugins/prestashop/settings): Every setting with its default. # PrestaShop module settings (/payments/plugins/prestashop/settings) The settings are under **Payment** → **Pay.com** in the back office, which **Configure** on the module also opens. In multistore, pick **All shops** in the shop selector to set the defaults, or one shop to give it settings and a Pay.com account of its own. The page shows which one it's saving for. ## Pay.com account [#pay-com-account] The **Pay.com account** card lists the shop's two environments, **Live** and **Sandbox**, with the key's last four characters and the webhook's signing secret for each. It also shows the **Webhook URL** to send events to. | Setting | Description | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **API key** | Under **API keys and webhook secrets**, paste an `sk-pay-com-sandbox-` key on the **Sandbox** row and an `sk-pay-com-live-` key on the **Live** row from the Pay.com dashboard, then click **Save**. The key is checked with Pay.com before it's saved, stored encrypted, and never shown again. An empty field keeps the saved key. | | **Webhook signing secret** | On the same row, enter the signing secret of the webhook you added in the Pay.com dashboard for the environment, which sends events to the **Webhook URL**. When you replace it, the secret it replaces keeps verifying events for 24 hours. | | **Disconnect** | Removes the environment's key from the shop. The key still works at Pay.com until you delete it in the Pay.com dashboard. | When the environment **Mode** picks has no key, the top of the page, **Your payment methods**, and the **Apple Pay domain** card say which key to enter under **API keys and webhook secrets**, for example "Mode is set to Sandbox, but only a live API key is saved. Enter your sandbox API key under API keys and webhook secrets, or set Mode to Live." With no key saved at all, they say "Enter your Pay.com API key under API keys and webhook secrets first." ## Settings [#settings] These settings pick the environment and control capture, saved cards, the order reference, and logging: | Setting | Type | Default | Description | | -------------------------------------------------------------------- | -------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Mode** | Select | Sandbox (test payments) | **Sandbox (test payments)** takes payments in your Pay.com sandbox with the sandbox key, through `https://api.sandbox.pay.com/v1`. **Live** takes live payments with the live key, through `https://api.pay.com/v1`. Live needs a live key and the shop on HTTPS. | | **Capture** | Select | Capture the payment when the order is placed | **Capture the payment when the order is placed** charges at checkout. **Authorize only: capture from the order page or when it ships** places an authorization. Capture it with **Capture** in the order page's **Pay.com** block before it expires. | | **Capture an authorized order when it is marked shipped** | Checkbox | Off | With **Authorize only**, moving an authorized order to a shipped state captures the authorization first. See [Capture when the order ships](/payments/plugins/prestashop#capture-when-the-order-ships). | | **Signed-in customers can save cards** | Checkbox | On | Signed-in customers pay with their saved cards at checkout, and add or delete cards under **My account** → **Saved cards**, where adding a card charges nothing. With Pay.com's form, customers can also choose to save the card when they pay. Card fields don't ask, so they never save a card at checkout. **Saved cards** tells a customer who has none how to add one with the payment form you picked. Guests never save cards. Cards saved in the sandbox are offered only in the sandbox. | | **Reference prefix (for a Pay.com account shared by several shops)** | Text | Empty | Shown in the Pay.com dashboard before PrestaShop's order reference. Use a different prefix on each shop that shares a Pay.com account. Up to 16 letters, digits, hyphens, and underscores. | | **Debug log** | Checkbox | Off | Also logs what the module does to `var/logs/pay_com_payments-*.log`. Card data and secrets are never logged. | ## Checkout [#checkout] These settings control the payment form and how payment methods show at checkout: | Setting | Type | Default | Description | | ----------------------------------------------------- | ---------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Payment form** | Select | Card fields in the checkout's own style, with your payment methods listed | **Card fields in the checkout's own style, with your payment methods listed**, the default, takes the card in secure Pay.com fields that look like your checkout's own inputs, next to your shop's list of payment methods. **Pay.com's form (cards, wallets and local methods)** shows Pay.com's own form, with every payment method in it. | | **Payment methods at checkout** | Select | Each payment method is its own option | With card fields. **Each payment method is its own option** shows the card's option, an option for each payment method of your Pay.com account, and **Other payment methods** for the methods without an option of their own. Apart from the card's, an option shows only when Pay.com offers its method for the order. **One option, with the payment methods listed inside it** shows a single option that lists them. | | **Options at checkout** | Checkboxes | All on | When each payment method is its own option, displays a checkbox for Apple Pay, Google Pay, each payment method on your Pay.com account, and **Other payment methods**. An unchecked method never shows at checkout, not even under **Other payment methods**. The card's option can't be turned off. | | **Offer Apple Pay and Google Pay as payment methods** | Checkbox | On | With card fields. Lists Apple Pay and Google Pay among the payment methods, as options of their own or in the one option's list. A wallet shows only when the customer's browser can pay with it. When a customer selects one, its button takes the place of **Place order** and pays with the details they entered at checkout. When it's off, card fields show no wallets. | | **Card option title** | Text | `Credit or debit card` | The name of the card's option when each payment method is its own option. Up to 128 characters. | | **Payment option title** | Text | `Pay by card or wallet` | The payment option's name when the payment methods are listed in one option, or with Pay.com's form. Up to 128 characters. | The checkout falls back to Pay.com's form if card fields aren't available or don't support any of the order's payment methods. With card fields, a payment method that requires additional details (such as a bank or code) shows inputs for them. Payment methods that require unsupported custom fields are omitted from checkout. To disable a payment method across your store, turn it off in the Pay.com dashboard, then click **Refresh** under **Your payment methods**. The names of generic methods, such as **Other payment methods**, are the module's translations. Change them under **International** → **Translations**. ### Your payment methods [#your-payment-methods] **Your payment methods** lists the payment methods your Pay.com account offers, in the environment **Mode** picks, and when they were read. When each payment method is its own option, each one gets an option at checkout, shown when Pay.com offers it for the order. Apple Pay and Google Pay show when your account has them set up. After you change your methods in the Pay.com dashboard, click **Refresh**. The list is also read when you save a key or switch **Mode** to an environment it wasn't read for, and again once a day. If a read fails, the page says why and keeps the last list. Until the list is first read, the methods other than the card, Apple Pay, and Google Pay show under **Other payment methods**. ## Express checkout [#express-checkout] These settings place Apple Pay and Google Pay buttons that pay without the checkout's steps. The wallets that show are the ones your Pay.com account offers. | Setting | Default | Description | | -------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Apple Pay and Google Pay on product pages** | On | Customers buy one product without leaving its page. Their cart stays as it was. | | **Apple Pay and Google Pay on the cart page** | On | Pays for the whole cart. | | **Apple Pay and Google Pay in the added-to-cart window** | On | Pays for the whole cart, from the window that opens when a product is added to it. | | **Apple Pay and Google Pay buttons at the top of the checkout page** | On | Pays for the whole cart, from the checkout's first step, above the customer's details. The wallet gives the customer's email, addresses, and, when you made it required, phone number, and the order is placed from them. A signed-in customer starts past this step, so they see the buttons only when they go back to it. | The buttons hide when a wallet can't supply information the order requires, such as for visitors who aren't signed in when guest checkout is off, when required fields aren't provided by wallets (company, VAT number, identification number, or birthday), in catalog mode, or for products that can't be ordered or need customization. With terms of service turned on, the customer selects a checkbox next to the buttons first. ## Apple Pay domain [#apple-pay-domain] The **Apple Pay domain** card shows the shop's domain and, for each environment with a key, whether it's registered with Pay.com. If it isn't, the Apple Pay button doesn't show on that domain. Click **Register domain**. Apple checks the domain association file the module serves, so the shop must be on HTTPS at the root of its domain. The card warns you when it isn't, or when something else is served at the file's address. ## Cron [#cron] The **Cron** card shows when the module's cron last ran, with its URL and token. The cron processes webhooks that wait or need a retry, checks unpaid and authorized orders with Pay.com every 15 minutes, and reads your payment methods again once a day. Run it every minute, or every few minutes, in one of these ways: * Use PrestaShop's **Cron tasks manager** module to run the module's task. * Add a crontab line that posts to the cron URL with the token in the `X-Pay-Com-Cron-Token` header, as shown on the card. * Run `php modules/pay_com_payments/bin/cron.php` directly on the server. Without one, storefront visits run it at most every five minutes. The token goes in a header or the POST body, never in the URL. API keys and webhook secrets are encrypted with the shop's `_NEW_COOKIE_KEY_`. If the database is copied to a shop with another key, the saved keys can't be read there, and the page says so. Enter the keys again. # Shopware plugin (/payments/plugins/shopware) Pay.com Payments for Shopware 6 adds Pay.com as a payment method at the Storefront's checkout, and to headless storefronts through the Store API. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, in a payment form rendered in Pay.com-hosted frames. Shopware creates and validates the order before any payment is taken, and the shop confirms every payment with Pay.com on its server before it marks the order's transaction paid. To install the plugin and connect it to your Pay.com account, see [Set up the Shopware plugin](/payments/plugins/shopware/set-up). Every setting and its default is in [Settings](/payments/plugins/shopware/settings). ## Supported features [#supported-features] The plugin supports these checkout and order management features. | Feature | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Checkout | Cards, wallets, and local payment methods on the confirm page. By default, the card is entered in secure fields styled like your theme's inputs, and each payment method is a Shopware payment method of its own. See [Checkout settings](/payments/plugins/shopware/settings#checkout). | | Paying an open order | A failed payment keeps the order. The customer pays it again from the confirm page, or later from **Complete payment** on the order in their account. | | Capture | Capture when the order is paid, or authorize at checkout and capture later with **Capture** on the order's **Pay.com** card, or when the order's delivery is shipped. | | Refunds | Refund from the order's **Pay.com** card, or through Shopware's own refund API, which return management uses, in full or in part. Refunds made in the Pay.com dashboard reach the order. **Cancel authorization**, or canceling an order that is only authorized, releases the authorization. | | Payment review | A payment that doesn't match its order leaves the transaction **Unconfirmed**. **Accept payment** on the order's **Pay.com** card takes it as it is, and **Deny payment** refunds the payment. | | Express checkout | Apple Pay and Google Pay buttons on product pages, the cart page, the off-canvas cart, and the top of the checkout. Customers pay without filling in the checkout, and Shopware still creates and validates the order first. A product page button buys what the page's buy form picked and leaves the cart as it was. | | Saved cards | Customers with an account can save a card when they pay in Pay.com's Universal checkout, pay with it later, and add or delete cards under **Saved cards** in their account. With card fields, the default, there's no option to save a card at checkout. Pay.com keeps the card. The shop keeps only its brand, last four digits, and expiration date. | | Apple Pay domain | The Storefront serves Apple's domain association file, and the plugin registers each sales channel domain with Apple through Pay.com. | | Sales channels | One Pay.com account for all sales channels, or one per sales channel. | | Headless storefronts | Shopware Frontends and other composable frontends take payments through the plugin's Store API routes. See [Store API](#store-api). | ## How orders stay in sync [#how-orders-stay-in-sync] The shop confirms each payment with Pay.com on its server. Webhooks, and a background check every 15 minutes in Shopware's scheduled tasks, reconcile payments when a customer closes the browser before returning to your store. | Pay.com outcome | Order transaction | | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | Paid | **Paid**. | | Authorized (manual capture) | **Authorized**. Capture it from the order's **Pay.com** card before the authorization expires, or when its delivery ships. | | Funds pending, for example a bank debit | **In Progress** until the funds clear, then **Paid**, or **Failed** if they don't. | | Failed | **Failed**. The order stays, so the customer can pay it again. | | Requires manual review | **Unconfirmed**, with a note saying why. A paid order whose charge is disputed goes to **Chargeback**. | A refund sets the transaction to **Refunded** or **Refunded (partially)**. A payment that completes after its transaction failed or was canceled reopens the transaction, unless the order itself was canceled. In that case, the payment is refunded, or its authorization released. The plugin subscribes to the 12 shared [plugin webhook events](/payments/plugins#webhook-events). ## Apple Pay [#apple-pay] The Apple Pay button shows only on a domain registered with Apple. Under **Apple Pay domain** on the plugin's settings page, pick the sales channel and click **Register domain** for each environment. The shop sends its domain to Pay.com, and Pay.com asks Apple to check the domain association file that the Storefront serves. The shop must be on HTTPS at the root of its domain. ## Store API [#store-api] For Shopware Frontends and other composable frontends, the plugin adds Store API routes, called with the Store API's context token and access key: | Route | What it does | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `POST /store-api/pay-com/session` | The cart's payment session, to render Pay.com's payment form on, with the URL of Pay.com.js, the payment form, the Pay.com payment methods the checkout shows, and the customer's saved cards. | | `POST /store-api/pay-com/attach` | Called after Shopware's `POST /store-api/checkout/order` to bind the session to the order's exact total, return a new session if needed, or report that the order is already paid. | | `POST /store-api/pay-com/status` | Called on the frontend's return page with the return URL's `t` parameter to confirm the payment with Pay.com and return the order status. | | `GET /store-api/pay-com/saved-cards`, `DELETE /store-api/pay-com/saved-cards/{id}`, `POST /store-api/pay-com/saved-cards/setup`, and `POST /store-api/pay-com/saved-cards/save` | Lists, deletes, and adds saved cards for a signed-in customer. | | `POST /store-api/pay-com/express/start`, `/quote`, and `/order` | Express checkout for the cart, priced with Shopware's cart calculation. | Shopware's `/store-api/payment-method` lists every active Pay.com payment method of the sales channel. Show only those the session's `methods` lists, and hide those the session doesn't offer. A saved card pays only with the card's payment method. Set **Headless return page** to the frontend's page customers come back to after paying. ## Data the plugin sends [#data-the-plugin-sends] The plugin communicates with Pay.com in three ways: * The checkout page loads Pay.com.js from `https://js.pay.com/v1`. Card details are entered in Pay.com frames and sent only to Pay.com. * The shop's server calls the Pay.com API (`https://api.pay.com/v1`, or `https://api.sandbox.pay.com/v1` for the sandbox) to create payment sessions, to confirm, capture, and refund payments, to manage saved cards, and to read your account's payment methods. * For Apple Pay, the shop downloads Apple's domain association file from Pay.com at most once a day, and sends its domain to the Pay.com API when an administrator clicks **Register domain**. API keys and webhook secrets are encrypted with a key derived from the shop's `APP_SECRET`, and the administration never shows more than their last characters. See [Settings](/payments/plugins/shopware/settings#set-in-the-shops-environment) to use a key of its own. # Set up the Shopware plugin (/payments/plugins/shopware/set-up) Pay.com Payments for Shopware 6 adds Pay.com as a payment method at your shop's checkout. Install it, connect it to your Pay.com account, and take a test payment in the sandbox. What the plugin does once it's running is in [Shopware plugin](/payments/plugins/shopware). ## Requirements [#requirements] The plugin works with the Storefront's checkout, and with headless storefronts through the Store API. | Requirement | Version | | ----------- | --------------------------------------- | | Shopware | 6.6.10 or later, or 6.7 (tested on 6.7) | | PHP | 8.2 to 8.5, with the sodium extension | | Plugin | 0.1.0 | ## Install and connect [#install-and-connect] You connect the plugin with an API key, created in the Pay.com dashboard, for each environment you use. ### Install the plugin [#install-the-plugin] In the administration, go to **Extensions** → **My extensions**, click **Upload extension**, and upload `pay-com-shopware6-payments-0.1.0.zip`. Then install and activate **Pay.com Payments**. The first activation turns on the **Pay.com** payment method. If you deactivate the plugin later, it switches off its payment methods. Activating it again switches on only the ones it switched off, so a payment method you switched off yourself stays off. ### Add the payment method to your sales channels [#add-the-payment-method-to-your-sales-channels] In each sales channel that takes Pay.com, add **Pay.com** to the sales channel's payment methods. The confirm page offers it once the sales channel has a key for the environment it pays in. ### Enter your API keys [#enter-your-api-keys] Go to **Settings** → **Extensions** → **Pay.com**. On the **Sandbox** card, click **Enter an API key instead**, paste an `sk-pay-com-sandbox-` key you created in the Pay.com dashboard into **API key**, and click **Check and save the key**. Do the same with an `sk-pay-com-live-` key on the **Live** card when you take live payments. See [Settings](/payments/plugins/shopware/settings#pay-com-account). Saving a key also reads the payment methods your Pay.com account offers. Apple Pay, Google Pay, and the account's other methods get Shopware payment methods of their own, in the sales channels that have **Pay.com**. See [Your payment methods](/payments/plugins/shopware/settings#your-payment-methods). ### Add the webhook [#add-the-webhook] Each environment has its own webhook URL, which its card shows. In the Pay.com dashboard, add a webhook that sends events to that URL, then paste its signing secret into **Webhook signing secret** on the card and click **Save the secret**. Do this for each environment you use, and subscribe to the 12 [plugin webhook events](/payments/plugins#webhook-events). ### Keep the message queue and scheduled tasks running [#keep-the-message-queue-and-scheduled-tasks-running] The plugin processes webhooks in Shopware's message queue. In its scheduled tasks, it checks open payments with Pay.com, and once a day it reads your account's payment methods. Make sure the shop runs both, for example with `bin/console messenger:consume` and `bin/console scheduled-task:run`. ### Take a test payment [#take-a-test-payment] **Sandbox mode** is on by default, so the shop takes payments in the sandbox. Place an order with a [test card](/get-started/test-your-integration/test-cards), then turn **Sandbox mode** off to take live payments. ## Next steps [#next-steps] * [Apple Pay](/payments/plugins/shopware#apple-pay): Register your shop's domain to show the Apple Pay button. * [Shopware plugin](/payments/plugins/shopware): What the plugin supports, how orders stay in sync with Pay.com, and the data the plugin sends. * [Settings](/payments/plugins/shopware/settings): Every setting with its default. # Shopware plugin settings (/payments/plugins/shopware/settings) The settings are under **Settings** → **Extensions** → **Pay.com** in the administration. Pick **All Sales Channels** at the top of the page to set the defaults, or one sales channel to give it settings and a Pay.com account of its own. A sales channel inherits what it doesn't set. ## Pay.com account [#pay-com-account] The page has a card for each environment, **Live** and **Sandbox**. Each card shows whether the environment has a key and its last characters, and where its webhooks go. When the environment that **Sandbox mode** picks has no key, the top of the page says that the checkout doesn't offer Pay.com, and how to fix it. It tells you to paste the missing key on that environment's card, under **Enter an API key instead**, or, when the other environment has a key, to switch **Sandbox mode**. | Setting | Description | | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Enter an API key instead** | Opens the fields for an API key you created in the Pay.com dashboard (an `sk-pay-com-live-` key on the **Live** card and an `sk-pay-com-sandbox-` key on the **Sandbox** card). Paste it into **API key** and click **Check and save the key**. The key is checked with Pay.com before it's saved, stored encrypted, and never shown again. | | **Webhook signing secret** | The signing secret of the webhook you added in the Pay.com dashboard for the environment. Paste it and click **Save the secret**. The card shows the URL to send the environment's events to. When you replace the secret, the one it replaces keeps verifying events for a day. | | **Disconnect** | Removes the environment's key from the shop. A key you entered still works at Pay.com until you delete it in the Pay.com dashboard. | ## Payments [#payments] These settings pick the environment and control capture and the order reference: | Setting | Type | Default | Description | | -------------------------------- | ------ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Sandbox mode** | Switch | On | Orders are paid in your Pay.com sandbox with the sandbox key, through `https://api.sandbox.pay.com/v1`. Turn it off to take live payments with the live key, through `https://api.pay.com/v1`. Live payments need a live key and the shop on HTTPS. | | **Capture** | Select | Capture when the order is paid | **Capture when the order is paid** charges at checkout. **Authorize only, capture later** places an authorization. Capture it with **Capture** on the order's **Pay.com** card before it expires. | | **Capture when the order ships** | Switch | Off | With **Authorize only, capture later**, setting the order's delivery to **Shipped** captures the authorization. A capture that doesn't go through leaves the order authorized, with a note, and is tried again every hour. | | **Reference prefix** | Text | Empty | Shown in the Pay.com dashboard before the order number. Use a different prefix on each shop that shares a Pay.com account. | ## Checkout [#checkout] These settings control the payment form, how payment methods show, saved cards, and the headless return page: | Setting | Type | Default | Description | | ----------------------------------------------------- | ------ | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Payment form** | Select | Card fields and the shop's list of methods | **Card fields and the shop's list of methods**, the default, takes the card in secure Pay.com fields that look like your theme's inputs, next to your shop's own list of the other payment methods. **Pay.com's drop-in** shows every payment method in Pay.com's Universal checkout. With card fields, methods that leave for their provider's page take the whole window. | | **Payment methods at checkout** | Select | Each payment method is its own option | With card fields. **Each payment method is its own option** shows each method of your Pay.com account as a Shopware payment method of its own when Pay.com offers it for the order, and lists the methods without one only under **Other payment methods**. **Pay.com** then holds the card and saved cards alone, and shows as **Credit or debit card** unless you rename it. **One option, with the payment methods listed inside it** lists the methods inside **Pay.com**. | | **Offer Apple Pay and Google Pay as payment methods** | Switch | On | With card fields. Lists Apple Pay and Google Pay among the payment methods, when your Pay.com account has them set up and the customer's browser can pay with them. When a customer selects one, its button takes the place of **Submit order** and pays with the details they entered at checkout. | | **Saved cards** | Switch | On | Customers with an account can save cards in their account and pay with a saved card at checkout. With **Pay.com's drop-in**, they can also save a new card while they pay. Card fields don't offer that. Guests never save cards. Cards saved in the sandbox are offered only in the sandbox. | | **Headless return page** | URL | Empty | Sets the return page URL for headless storefronts after payment. It receives `?t=` and queries the Store API's `/store-api/pay-com/status` for the order status. | The checkout falls back to Pay.com's Universal checkout if card fields aren't available or don't support any of the order's payment methods. With card fields, a payment method that requires additional details (such as a bank or code) shows inputs for them. Payment methods that require unsupported custom fields are omitted from checkout. To rename, sort, or switch off a payment method, go to **Settings** → **Payment methods**. ### Your payment methods [#your-payment-methods] **Your payment methods** lists the payment methods your Pay.com account offers in each environment, and when each list was read. It marks the environment the checkout pays in. The plugin reads the lists when you save a key and once a day. After you change your methods in the Pay.com dashboard, click **Refresh**. If a read fails, the card says why and keeps the last list. With card fields and **Each payment method is its own option**, each method gets its own Shopware payment method under **Settings** → **Payment methods**: * Newly synced methods are added automatically to sales channels that have **Pay.com**, after which you choose which sales channels offer each method. * Apple Pay and Google Pay appear when enabled on your Pay.com account, regardless of whether they appear in the synced list. * Methods your account no longer offers are switched off rather than deleted so existing orders can still be refunded. Re-enabling a method in Pay.com switches it back on during a refresh, unless you manually switched it off in Shopware. * Deactivating the plugin switches off its payment methods, and reactivating it re-enables only the methods deactivated by the plugin (preserving any you switched off manually). * Until the list is first synced, methods other than cards, Apple Pay, and Google Pay appear under **Other payment methods**. ### Express checkout [#express-checkout] These settings place Apple Pay and Google Pay buttons that pay without filling in the checkout. The wallets that show are the ones your Pay.com account offers. | Setting | Default | Description | | ------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Apple Pay and Google Pay on product pages** | On | Buys what the page's buy form picked, its variant and quantity, without touching the customer's cart. | | **Apple Pay and Google Pay on the cart page** | On | Pays for the whole cart. | | **Apple Pay and Google Pay in the off-canvas cart** | On | Pays for the whole cart, as the cart page does. | | **Apple Pay and Google Pay at the top of the checkout** | On | Shown above the customer's details on the checkout's sign-in and registration step and at the top of the confirm page. Pays for the whole cart, and the order is placed from the details in the wallet's sheet. | The buttons hide when the shop requires fields a wallet can't supply (a required additional address line, or for guests, a required birthday, a required data protection checkbox, or a double opt-in for guest orders). A required phone number is asked for in the wallet sheet. Under the buttons, a line links your terms and conditions page. A guest who pays with express checkout gets a guest account, as a guest checkout does. A signed-in customer keeps their account, and the wallet's addresses are added to their address book. ## Apple Pay domain [#apple-pay-domain] **Apple Pay domain** shows the sales channel's domain and, for each environment, whether it's registered with Pay.com. If it isn't, the Apple Pay button doesn't show on that domain. Click **Register domain**. Apple checks the domain association file the Storefront serves, so the shop must be on HTTPS at the root of its domain. ## Logs [#logs] One setting controls how much the plugin logs: | Setting | Type | Default | Description | | ------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Debug log** | Switch | Off | Writes what the plugin does to `var/log/pay_com_*.log`, which always gets warnings and errors. Card data, the IDs of saved cards, and secrets are never logged. | ## Set in the shop's environment [#set-in-the-shops-environment] Two settings come from the shop's environment, `.env` or the server's own, never from the administration: | Variable | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------ | | `PAY_COM_SECRET_KEY` | The key material the plugin encrypts API keys and webhook secrets with. Without it, the plugin uses `APP_SECRET`. | | `PAY_COM_PUBLIC_URL` | The address Pay.com reaches the shop at, when it isn't `APP_URL`, for example behind a proxy. Webhook URLs use it. | If `PAY_COM_SECRET_KEY`, or `APP_SECRET` without it, changes, the stored keys and secrets can no longer be decrypted. The settings page says so. Enter the keys again. # WooCommerce plugin (/payments/plugins/woocommerce) Pay.com Payments for WooCommerce adds Pay.com's payment methods to the WooCommerce checkout. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, and they enter card details in Pay.com-hosted frames. WooCommerce creates and validates each order before payment starts, and your store confirms every payment server-side with Pay.com before marking the order paid. To install and connect the plugin, see [Set up the WooCommerce plugin](/payments/plugins/woocommerce/set-up). For all plugin options and defaults, see [Settings](/payments/plugins/woocommerce/settings). ## Supported features [#supported-features] The plugin supports these checkout and order management features. | Feature | Description | | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Checkout | Cards, wallets, and local payment methods at checkout and on the order's **Pay for order** page. By default, the card is entered in secure fields styled like your checkout, and each payment method is an option of its own. See [Checkout settings](/payments/plugins/woocommerce/settings#checkout). | | Capture | Capture immediately, or authorize at checkout and capture later with the **Capture Pay.com payment** order action. | | Refunds | Refund a captured payment from the WooCommerce order, in full or in part. Canceling an order that's only authorized releases the authorization. A refund made in the Pay.com dashboard is recorded on the order. | | Express checkout | Apple Pay and Google Pay buttons on product pages, the cart page, the mini-cart, and the top of the checkout page. Customers pay without going through the checkout form, and WooCommerce still creates and validates the order first. A product page button buys only that product and leaves the cart as it was. | | Saved cards | Logged-in customers can save a card in **My account**, or when they pay with the Pay.com payment form, and pay with it later. With card fields, a card is saved at checkout only for a subscription. Pay.com vaults the card, and WooCommerce stores only its brand, last four digits, and expiration date. | | WooCommerce Subscriptions | Charges renewals to the customer's saved card, server to server, on the renewal order WooCommerce Subscriptions creates. A failed renewal marks its order failed, so WooCommerce Subscriptions retries it and emails the customer. Customers and admins can change a subscription's card. | | Apple Pay domain | Serves Apple's domain association file and registers your domain with Apple through Pay.com. | ## How orders stay in sync [#how-orders-stay-in-sync] Your store confirms each payment server-side with Pay.com. Webhooks and a background check every 15 minutes reconcile payments when a customer closes the browser before returning to your store. | Pay.com outcome | WooCommerce order status | | --------------------------------------- | ----------------------------------------------------------------------------------------------- | | Paid | Marked paid (reduces stock and sends WooCommerce order emails). | | Authorized (manual capture) | **On hold**, with a note to capture it from **Order actions** before the authorization expires. | | Funds pending (for example, bank debit) | **On hold**, with a note not to ship until the funds clear. | | Failed | **Failed**. | | Requires manual review | **On hold**, with a note explaining why. | The plugin subscribes to the 12 shared [plugin webhook events](/payments/plugins#webhook-events). A refund made in the Pay.com dashboard arrives as `charge.refunded` or `refund.succeeded`. The plugin adds a WooCommerce refund for whatever Pay.com refunded beyond what the order already shows, with a note on the order. It doesn't refund the payment again or restock items. ## Apple Pay [#apple-pay] The Apple Pay button shows only on a domain registered with Apple. The store must be on HTTPS, at the root of its domain. In **WooCommerce** → **Settings** → **Payments** → **Pay.com**, under **Apple Pay domain**, click **Register domain**. Your store sends its domain to Pay.com, and Pay.com asks Apple to verify the domain association file that the plugin serves. ## Data sent by the plugin [#data-sent-by-the-plugin] The plugin communicates with Pay.com in three ways: * The checkout page loads Pay.com.js from `https://js.pay.com/v1`. Card details are entered in Pay.com frames and sent only to Pay.com. * Your store's server calls the Pay.com API (`https://api.pay.com/v1`, or `https://api.sandbox.pay.com/v1` in the sandbox) to create payment sessions, confirm payments, and refund them. * For Apple Pay, your store downloads Apple's domain association file from Pay.com at most once a day. It sends its domain to the Pay.com API when an administrator clicks **Register domain**. API keys and webhook secrets are stored encrypted, separately from the gateway settings, and the settings page never shows more than their last four characters. See [Keep secrets in `wp-config.php`](/payments/plugins/woocommerce/settings#keep-secrets-in-wp-configphp) to store them outside the database. # Set up the WooCommerce plugin (/payments/plugins/woocommerce/set-up) Pay.com Payments for WooCommerce adds Pay.com as a payment method at your store's checkout. Install it, connect it to your Pay.com account, and take a test payment in the sandbox. What the plugin does once it's running is in [WooCommerce plugin](/payments/plugins/woocommerce). ## Requirements [#requirements] The plugin works with the classic checkout and the Checkout block, and with WooCommerce's high-performance order storage. | Requirement | Version | | ----------- | -------------------------------- | | WordPress | 6.4 or later (tested up to 7.1) | | WooCommerce | 8.6 or later (tested up to 11.3) | | PHP | 7.4 or later | | Plugin | 0.1.0 | ## Install and connect [#install-and-connect] You connect the plugin with an API key, created in the Pay.com dashboard, for each environment you use. ### Install the plugin [#install-the-plugin] Install and activate Pay.com Payments for WooCommerce. ### Enter your API keys [#enter-your-api-keys] Go to **WooCommerce** → **Settings** → **Payments** → **Pay.com**. The settings list two environments, **Live** and **Sandbox**. For each one you use, paste an API key you created in the Pay.com dashboard (an `sk-pay-com-live-` key under **Live**, and an `sk-pay-com-sandbox-` key under **Sandbox** for sandbox payments). Each key is checked with Pay.com when you save. Pay.com shows at checkout once the environment **Sandbox mode** picks has a key. Until then, **Your payment methods** on the settings page says which key to enter. See [Settings](/payments/plugins/woocommerce/settings#pay-com-account). ### Add the webhook [#add-the-webhook] In the Pay.com dashboard, add a webhook that sends events to the URL shown on the settings page, then paste its signing secret into **Signing secret**. Do this for each environment you use, and subscribe to the 12 [plugin webhook events](/payments/plugins#webhook-events). ### Take a test payment [#take-a-test-payment] **Sandbox mode** is on by default, so the store takes payments in the sandbox. Place an order with a [test card](/get-started/test-your-integration/test-cards), then turn **Sandbox mode** off to take live payments. ## Next steps [#next-steps] * [Apple Pay](/payments/plugins/woocommerce#apple-pay): Register your store's domain to show the Apple Pay button. * [WooCommerce plugin](/payments/plugins/woocommerce): What the plugin supports, how orders stay in sync with Pay.com, and the data the plugin sends. * [Settings](/payments/plugins/woocommerce/settings): Every setting with its default, and how to keep your keys in `wp-config.php`. # WooCommerce plugin settings (/payments/plugins/woocommerce/settings) The settings are under **WooCommerce** → **Settings** → **Payments** → **Pay.com**. ## General [#general] These settings turn Pay.com on and name it at checkout: | Setting | Type | Default | Description | | --------------------- | --------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------- | | **Enable** | Checkbox | Off | Offers Pay.com at checkout. | | **Title** | Text | `Card and other payment methods` | The option's name at checkout when one option lists the payment methods, as with the Pay.com payment form. | | **Card option title** | Text | `Credit or debit card` | The card option's name when each payment method is an option of its own. | | **Description** | Text area | Empty | Text shown with the payment method at checkout. | ## Pay.com account [#pay-com-account] The store keeps one connection per environment, shown as **Live** and **Sandbox**. **Sandbox** uses `https://api.sandbox.pay.com/v1`. Each environment shows where its key comes from (an API key you entered, or a constant in `wp-config.php`) and the key's last four characters. | Setting | Description | | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Enter an API key instead** | Paste an API key you created in the Pay.com dashboard (an `sk-pay-com-live-` key under **Live** and an `sk-pay-com-sandbox-` key under **Sandbox**). The key is checked with Pay.com when you save, stored encrypted, and never shown again. This is how you set up the plugin. | | **Remove key** | Stops using the key you entered for the environment. | | **Signing secret** | The webhook signing secret for the environment. In the Pay.com dashboard, send events to the URL shown here and paste the secret. | | **Previous secret** | While you rotate the webhook secret, keep the old one here until the new one works, then remove it. | ### Sandbox mode [#sandbox-mode] **Sandbox mode** picks the environment the store takes payments in: | Setting | Type | Default | Description | | ---------------- | -------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Sandbox mode** | Checkbox, labeled "Take test payments in your Pay.com sandbox" | On | Takes test payments with the **Sandbox** key, through `https://api.sandbox.pay.com/v1`. Turn it off to take live payments with the **Live** key, through `https://api.pay.com/v1`. Turning it off needs a live key and the site on HTTPS. Otherwise, **Sandbox mode** stays on. | Pay.com shows at checkout only when the environment **Sandbox mode** picks has a key. Until it does, **Your payment methods** and **Apple Pay domain** say which key to enter, for example "Sandbox mode is on, but only a live API key is saved. Enter a sandbox API key, or turn off Sandbox mode." With no key saved at all, they say "Enter your Pay.com API key first." ## Payments [#payments] These settings control capture, the order reference, and saved cards: | Setting | Type | Default | Description | | -------------------------- | -------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Capture** | Select | Capture immediately | **Capture immediately** charges at checkout. **Authorize only, capture from the order** places an authorization. Capture it with the **Capture Pay.com payment** order action before it expires. | | **Order reference prefix** | Text | `WC-` | Shown in the Pay.com dashboard before the order number. Use a different prefix on each store that shares a Pay.com account. | | **Saved cards** | Checkbox | On | Lets logged-in customers save cards and pay with them later. Customers manage their cards in **My account**. With card fields, there's no option to save a card at checkout. A card is saved only for a subscription, without asking. | ## Checkout [#checkout] These settings control the payment form and how payment methods show at checkout: | Setting | Type | Default | Description | | ----------------------------------------------------- | -------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Payment form** | Select | Card fields styled like your checkout, with your payment methods listed | Card fields, the default, take the card in secure Pay.com fields that look like your checkout's own inputs, next to your store's list of payment methods. **Pay.com payment form** shows Pay.com's own form, with every payment method in it. | | **Payment methods at checkout** | Select | Each payment method is its own option | With card fields. **Each payment method is its own option** shows each method as a payment option when Pay.com offers it for the order, and methods without an option of their own under **Other payment methods**. **One option, with the payment methods listed inside it** shows a single Pay.com option. | | **Offer Apple Pay and Google Pay as payment methods** | Checkbox | On | With card fields. Lists Apple Pay and Google Pay among the payment methods. When a customer selects one, its button takes the place of **Place order** and pays with the details they entered at checkout. | The checkout falls back to the Pay.com payment form if card fields aren't available or don't support any of the order's payment methods. With card fields, a payment method that requires additional details (such as a bank or code) shows inputs for them at checkout. Payment methods that require unsupported custom fields are omitted from checkout. To turn a payment method's option off, rename it, or reorder it, go to **WooCommerce** → **Settings** → **Payments**. ### Your payment methods [#your-payment-methods] **Your payment methods** lists the payment methods your Pay.com account offers, in the environment **Sandbox mode** picks, and when they were read. When each payment method is its own option, each one gets an option at checkout, shown when Pay.com offers it for the order. Apple Pay and Google Pay show when your account has them set up. After you change your methods in the Pay.com dashboard, click **Refresh**. The list is also read again once a day. Until the list is first read, the methods other than the card, Apple Pay, and Google Pay show under **Other payment methods**. ## Express checkout [#express-checkout] These settings place Apple Pay and Google Pay buttons that pay without the checkout form. The wallets that show are the ones your Pay.com account offers. | Setting | Default | Description | | -------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- | | **Apple Pay and Google Pay buttons on product pages** | On | Customers buy one product without leaving its page. Their cart stays as it was. | | **Apple Pay and Google Pay buttons on the cart page** | On | Pays for the whole cart. | | **Apple Pay and Google Pay buttons in the mini-cart** | On | Pays for the whole cart, as the cart page does. Not shown on the checkout and cart pages, which have their own. | | **Apple Pay and Google Pay buttons at the top of the checkout page** | On | The wallet collects the customer's email, phone, and addresses, and the order is placed from them without filling in the checkout form. | ## Apple Pay domain [#apple-pay-domain] **Apple Pay domain** shows whether the store's domain can run Apple Pay. If it isn't registered yet, the Apple Pay button doesn't show. Click **Register domain**. Apple checks the domain association file the plugin serves, so the store must be on HTTPS at the root of its domain. ## Debug log [#debug-log] One setting turns on detailed logging: | Setting | Type | Default | Description | | ------------- | -------- | ------- | ------------------------------------------------------------------------ | | **Debug log** | Checkbox | Off | Logs API calls and decisions to **WooCommerce** → **Status** → **Logs**. | ## Keep secrets in wp-config.php [#keep-secrets-in-wp-configphp] Instead of storing them in the database, you can define the API keys and webhook secrets as constants in `wp-config.php`. A constant takes precedence over a stored value, and keeps that secret out of the database entirely. ```php define( 'PAY_COM_LIVE_API_KEY', 'sk-pay-com-live-…' ); define( 'PAY_COM_LIVE_WEBHOOK_SECRET', 'whsec-pay-com-live-…' ); define( 'PAY_COM_SANDBOX_API_KEY', 'sk-pay-com-sandbox-…' ); define( 'PAY_COM_SANDBOX_WEBHOOK_SECRET', 'whsec-pay-com-sandbox-…' ); ``` `PAY_COM_SANDBOX_API_KEY` and `PAY_COM_SANDBOX_WEBHOOK_SECRET` hold the sandbox's key and secret. Secrets stored in the database are encrypted with `PAY_COM_ENCRYPTION_KEY` from `wp-config.php` when it's defined and at least 32 characters long, or with the site's `LOGGED_IN` salts otherwise. If the site's security keys change, the stored secrets can no longer be decrypted. The settings page says so. Enter the keys again. # Salesforce Commerce Cloud cartridges (/payments/plugins/salesforce-commerce-cloud) The Pay.com cartridges for Salesforce B2C Commerce add Pay.com as a payment method at the SFRA checkout, and to PWA Kit storefronts through a Custom API. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, and card details are entered in Pay.com-hosted frames. B2C Commerce creates and validates the order before any payment is taken. The order stays `CREATED` until the cartridges confirm the payment with Pay.com on the server, and only then is it placed. To install the cartridges and connect them to your Pay.com account, see [Set up the Salesforce Commerce Cloud cartridges](/payments/plugins/salesforce-commerce-cloud/set-up). Every setting and its default is in [Settings](/payments/plugins/salesforce-commerce-cloud/settings). ## Supported features [#supported-features] The cartridges support these checkout and order management features. | Feature | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Checkout | Cards, wallets, and local payment methods at SFRA's checkout, with the payment form on the review step, above **Place order**. By default, each payment method is an option of its own on the payment step, and the card is entered in secure fields styled like your checkout. See [Checkout settings](/payments/plugins/salesforce-commerce-cloud/settings#checkout). | | Capture | Capture automatically when the customer pays, or authorize at checkout and capture later in **Merchant Tools** → **Pay.com** → **Orders**, or when the order's shipping status becomes `SHIPPED`. | | Refunds | Refund a captured payment from **Pay.com** → **Orders**, in full or in part. Refunds made in the Pay.com dashboard reach the order. Voiding releases an authorization. | | Payment review | A payment that doesn't match its order holds the order for review. Accept or deny it in **Pay.com** → **Orders**. | | Express checkout | Apple Pay and Google Pay buttons on product pages, the cart, the mini-cart, and the top of the checkout page. Customers pay without filling in the checkout form, and B2C Commerce still creates and validates the order first. A product page button buys that one product from a basket of its own and leaves the customer's basket as it was. | | Saved cards | Registered customers can save a card when they pay in Pay.com's Universal checkout, pay with it later, and add or delete cards in **My Account**. With card fields, the default, there's no option to save a card at checkout. Pay.com keeps the card. The storefront keeps only its brand, last four digits, and expiration date. | | Apple Pay domain | The storefront serves Apple's domain association file through a static mapping, and registers its domain with Apple through Pay.com. | | Headless storefronts | PWA Kit storefronts take payments through the cartridges' `pay-com` Custom API. See [PWA Kit](#pwa-kit). | ## How orders stay in sync [#how-orders-stay-in-sync] The storefront confirms each payment with Pay.com on its server. Webhooks, which the **PayCom-ProcessWebhooks** job processes every minute, and the **PayCom-Reconcile** job, which runs every 15 minutes, reconcile payments when a customer closes the browser before returning to your store. | Pay.com outcome | B2C Commerce order | | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Paid | Placed as `NEW`, payment status `PAID`, confirmed and ready to export. SFRA sends the order confirmation email. | | Authorized (manual capture) | Placed as `NEW`, confirmed and ready to export, with the authorization to capture in **Pay.com** → **Orders** before it expires. | | Funds pending, for example a bank debit | Placed as `NEW`, not confirmed and not exported until the funds clear. The confirmation email waits until then, and the order is canceled if the funds don't clear. | | Failed | `FAILED`, and the customer's basket comes back, so they can pay again. | | Requires manual review | Placed, not confirmed and not exported, with the reason on the order. | A customer who leaves an unpaid order, back to the cart or the checkout, gets their basket back once the order's payment session is blocked. The reconciler fails an order still unpaid after **Fail unpaid orders after (minutes)**, once its payment session is blocked. An order with a payment in flight is kept. A payment that completes after its order failed reopens the order when the stock is still there. Otherwise, **Late payments** decides whether the payment is refunded or the order is held for review. A refund made in the Pay.com dashboard is recorded on its order, and a full refund marks the order's payment refunded. The cartridges subscribe to the 12 shared [plugin webhook events](/payments/plugins#webhook-events). ## Pay.com orders in Business Manager [#paycom-orders-in-business-manager] **Merchant Tools** → **Pay.com** → **Orders** lists the site's Pay.com orders. On an order, you can capture an authorization (in full or in part), void it, refund a captured payment (in full or in part), and accept or deny a payment held for review. A refund after a manual capture goes through the capture's charge. ## Apple Pay [#apple-pay] The Apple Pay button shows only on a domain registered with Apple. In **Merchant Tools** → **SEO** → **Static Mapping**, map `/.well-known/apple-developer-merchantid-domain-association` to the `PayDotCom-AppleDomain` controller. Then, under **Apple Pay** in **Merchant Tools** → **Pay.com** → **Settings and Connect**, check the **Domain** and click **Register for Apple Pay**. The storefront sends its domain to Pay.com, and Pay.com asks Apple to check the file. This registers the domain for the active environment, so register it again after you switch between sandbox and live. The storefront must be on HTTPS at the root of its domain. ## PWA Kit [#pwa-kit] For a PWA Kit storefront, put `int_pay_com_scapi:int_pay_com` on the site's cartridge path and turn on hook execution for the Commerce API in **Administration** → **Global Preferences** → **Feature Switches**. The `pay-com` Custom API then takes payments with the same rules. `Shopper Orders` creates the order, the Custom API ties the payment session to it, and only the cartridges place it once Pay.com confirms the payment. Its calls use the customer's SLAS token, so add the `c_pay_com_checkout` scope to the storefront's SLAS client. | Endpoint | What it does | | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `POST /baskets/{basketId}/payment-session` | The basket's payment session, to render Pay.com's payment form on, after `Shopper Baskets` adds a `PAY_COM` payment instrument. It also returns checkout settings, including the payment form, available payment options, and whether express buttons show at the top of checkout. | | `POST /orders/{orderNo}/payment-session` | Called after `createOrder` in `Shopper Orders` to bind the session to the order at its exact total, report when the form holds a different session, or report that the order is already paid. | | `POST /returns` | Called on the storefront's return page with the return URL's token to confirm the payment with Pay.com and return the next redirect target. | | `POST /baskets/{basketId}/express-quote`, `POST /baskets/{basketId}/express-payer` | Prices the basket for express checkout using the wallet's address, then populates the basket with the payer's details. | | `GET /saved-cards`, `POST /saved-cards/sync`, `DELETE /saved-cards/{cardId}`, `POST /saved-cards/setup`, and `POST /saved-cards/setup-result` | Lists, syncs, deletes, and adds saved cards for a registered customer. | Set **Headless: return page URL** and **Headless: card saved page URL** to the storefront's pages. ## Data the cartridges send [#data-the-cartridges-send] The cartridges communicate with Pay.com in three ways: * The checkout page loads Pay.com.js from `https://js.pay.com/v1`. Card details are entered in Pay.com frames and sent only to Pay.com. * The storefront's server calls the Pay.com API (`https://api.pay.com/v1`, or `https://api.sandbox.pay.com/v1` for the sandbox) to create payment sessions, to confirm, capture, and refund payments, to manage saved cards, and to read the payment methods your account offers. * For Apple Pay, the storefront downloads Apple's domain association file from Pay.com at most once a day, and sends its domain to the Pay.com API when a Business Manager user clicks **Register for Apple Pay**. API keys and webhook secrets are kept in password site preferences, and **Settings and Connect** never shows more than their last four characters. The service's logs carry only each call's method, path, and status. # Set up the Salesforce Commerce Cloud cartridges (/payments/plugins/salesforce-commerce-cloud/set-up) The Pay.com cartridges for Salesforce B2C Commerce add Pay.com as a payment method at your storefront's checkout. Install them, connect them to your Pay.com account, and take a test payment in the sandbox. What the cartridges do once they're running is in [Salesforce Commerce Cloud cartridges](/payments/plugins/salesforce-commerce-cloud). ## Requirements [#requirements] The cartridges work with the SFRA checkout, and with PWA Kit storefronts through a Custom API. | Requirement | Version | | ----------------------- | ---------------------------------------------------- | | Salesforce B2C Commerce | SFRA 6 or later, or PWA Kit through the Commerce API | | Cartridges | 0.1.0 | ## Install and connect [#install-and-connect] You connect the cartridges with an API key, created in the Pay.com dashboard, for each environment you use. ### Upload the cartridges [#upload-the-cartridges] Upload `int_pay_com`, `int_pay_com_sfra`, and `bm_pay_com` to a code version, with `int_pay_com_scapi` for a PWA Kit storefront, and activate it. Then set the cartridge paths in **Administration** → **Sites** → **Manage Sites**: | Site | Cartridge path | | -------------------- | ----------------------------------------------------------------------------------- | | An SFRA storefront | `int_pay_com_sfra:int_pay_com:app_storefront_base`, in front of your own cartridges | | A PWA Kit storefront | `int_pay_com_scapi:int_pay_com`, in front of your own cartridges | | Business Manager | `bm_pay_com:int_pay_com` | A storefront that runs both SFRA and PWA Kit takes both. ### Import the site metadata [#import-the-site-metadata] The cartridges include a site import archive containing the site preferences, order and profile attributes, custom objects, the `PAY_COM` payment processor and payment method, the Pay.com service, and the scheduled jobs. Rename its `sites/RefArch` folder, and the `site-id` in `jobs.xml`, to your site's ID, zip it, and import it in **Administration** → **Site Development** → **Site Import & Export**. ### Give Business Manager users access [#give-business-manager-users-access] In **Administration** → **Organization** → **Roles & Permissions**, give `PAY_COM_SETTINGS` to the roles that set up Pay.com and `PAY_COM_ORDERS` to the roles that capture, refund, and review payments. ### Enter your API keys [#enter-your-api-keys] Go to **Merchant Tools** → **Pay.com** → **Settings and Connect**. In the **Sandbox** section, paste an `sk-pay-com-sandbox-` key you created in the Pay.com dashboard into **API key** and click **Save**. Do the same with an `sk-pay-com-live-` key in the **Live** section when you take live payments. Each key is checked with Pay.com before it's saved. Saving it also reads [the payment methods your Pay.com account offers](/payments/plugins/salesforce-commerce-cloud/settings#your-payment-methods) in that environment, which the checkout shows. See [Settings](/payments/plugins/salesforce-commerce-cloud/settings#pay-com-account). ### Add the webhook [#add-the-webhook] In the Pay.com dashboard, add a webhook that sends events to the URL shown on **Settings and Connect**, then paste its signing secret into **Webhook secret** in the environment's section and click **Save**. Do this for each environment you use, and subscribe to the 12 [plugin webhook events](/payments/plugins#webhook-events). ### Turn on Pay.com [#turn-on-paycom] In **Merchant Tools** → **Site Preferences** → **Custom Preferences** → **Pay.com**, set **Enabled** to **Yes**, and check that the `PAY_COM` payment method is enabled in **Merchant Tools** → **Ordering** → **Payment Methods**. The import also schedules the cartridge jobs (**PayCom-ProcessWebhooks** every minute, **PayCom-Reconcile** and **PayCom-CaptureShipped** every 15 minutes, and **PayCom-RefreshPaymentMethods** once a day). If your storefront has its own versions of SFRA's payment option templates, `checkout/billing/paymentOptions/paymentOptionsContent.isml`, `paymentOptionsSummary.isml`, and `paymentOptionsTabs.isml`, or of `cart/checkoutButtons.isml` and `product/components/addToCartButtonExtension.isml`, merge the cartridges' versions into them. ### Take a test payment [#take-a-test-payment] **Sandbox mode** is on by default, so the storefront takes payments in the sandbox. Place an order with a [test card](/get-started/test-your-integration/test-cards), then turn **Sandbox mode** off to take live payments. ## Next steps [#next-steps] * [Apple Pay](/payments/plugins/salesforce-commerce-cloud#apple-pay): Map the domain association file and register your storefront's domain to show the Apple Pay button. * [Salesforce Commerce Cloud cartridges](/payments/plugins/salesforce-commerce-cloud): What the cartridges support, how orders stay in sync with Pay.com, and the data they send. * [Settings](/payments/plugins/salesforce-commerce-cloud/settings): Every setting with its default. # Salesforce Commerce Cloud cartridge settings (/payments/plugins/salesforce-commerce-cloud/settings) The settings are configured per site in two places in Business Manager. Manage keys and payment methods under **Merchant Tools** → **Pay.com** → **Settings and Connect**, and configure all other options under **Merchant Tools** → **Site Preferences** → **Custom Preferences** → **Pay.com**. ## Pay.com account [#pay-com-account] **Merchant Tools** → **Pay.com** → **Settings and Connect** shows the active environment, whether Pay.com is enabled, and the URL webhooks go to. It has a section for each environment, **Live** and **Sandbox**, with the key's and the webhook secret's last four characters, and [your payment methods](#your-payment-methods). If the active environment has no key, the top of the page names the missing site preference using its literal Business Manager label and section (for example, **Production sandbox API key** in the **Sandbox** section for a sandbox key). When the other environment has a key, it also says you can turn **Sandbox mode** on or off instead. **Register for Apple Pay** names the missing key the same way. Business Manager users need the `PAY_COM_SETTINGS` permission to open the page. | Setting | Description | | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **API key** | Paste an `sk-pay-com-live-` key in the **Live** section and an `sk-pay-com-sandbox-` key in the **Sandbox** section, from the Pay.com dashboard, then click **Save**. The key is checked with Pay.com before it's saved, and stored in a password site preference. | | **Webhook secret** | The signing secret of the webhook you added in the Pay.com dashboard for the environment, which sends events to the URL the page shows. When you replace it, the secret it replaces keeps verifying events for 24 hours. | | **Disconnect live**, **Disconnect sandbox** | Removes the environment's key, and its list of payment methods, from the site. | ## Payments [#payments] These settings turn Pay.com on, pick the environment, and control capture, saved cards, and late payments: | Setting | Type | Default | Description | | -------------------------------- | ------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Enabled** | Yes/No | No | Takes payments with Pay.com. The `PAY_COM` payment method in **Merchant Tools** → **Ordering** → **Payment Methods** must be enabled too. | | **Sandbox mode** | Yes/No | Yes | Takes payments in your Pay.com sandbox with the sandbox key, through `https://api.sandbox.pay.com/v1`. Turn it off to take live payments with the live key, through `https://api.pay.com/v1`. Live payments need a live key. | | **Capture** | Select | **Automatically when the shopper pays** | **Automatically when the shopper pays** charges at checkout. **Authorize only; capture later** places an authorization. Capture it in **Pay.com** → **Orders** before it expires. | | **Capture when the order ships** | Yes/No | Yes | With **Authorize only; capture later**, the **PayCom-CaptureShipped** job captures authorized orders once their shipping status is `SHIPPED`. | | **Order reference prefix** | Text | Empty | Shown in the Pay.com dashboard before the order number. Use a different prefix on each site that shares a Pay.com account. | | **Saved cards** | Yes/No | Yes | Registered customers can save cards with Pay.com in Universal checkout, which asks them, and pay with them. With card fields, there's no option to save a card at checkout. Customers add cards in **My Account**. Cards saved in the sandbox are offered only in the sandbox. | | **Late payments** | Select | Refund a payment the order can no longer take | A payment that completes after its order failed reopens the order when the stock is still there. Otherwise **Refund a payment the order can no longer take** refunds the payment, and **Keep it and hold the order for review** keeps it and holds the order. | ## Checkout [#checkout] These settings control the payment form and how payment methods show at checkout: | Setting | Type | Default | Description | | ---------------------------------------------------------------- | ------ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Payment form** | Select | Card fields styled like your checkout, with your payment methods listed | Card fields, the default, take the card in secure Pay.com fields that look like your checkout's own inputs, next to your storefront's list of payment methods. **Pay.com drop-in** shows Pay.com's Universal checkout, with every payment method in it. | | **Payment methods at checkout** | Select | Each payment method is its own option | With card fields. **Each payment method is its own option** shows each method as a payment option when Pay.com offers it for the order, and methods without an option of their own under **Other payment methods**. **One option, with the payment methods listed inside it** shows a single Pay.com option. Every option is the same `PAY_COM` payment method. | | **List Apple Pay and Google Pay with the other payment methods** | Yes/No | Yes | With card fields. Lists Apple Pay and Google Pay among the payment methods, in browsers that can pay with them. When a customer selects one, its button takes the place of **Place order** and pays with the details they entered at checkout. | The checkout falls back to Pay.com's Universal checkout if card fields aren't available or don't support any of the order's payment methods. With card fields, a payment method that requires additional details (such as a bank or code) shows inputs for them. Payment methods that require unsupported custom fields are omitted from checkout. ### Your payment methods [#your-payment-methods] Each environment's section of **Merchant Tools** → **Pay.com** → **Settings and Connect** lists the payment methods your Pay.com account offers there, and when they were read. With **Each payment method is its own option**, each of them gets an option at checkout, shown when Pay.com offers it for the order. The list is read when you save a key, and once a day by the **PayCom-RefreshPaymentMethods** job. After you change your methods in the Pay.com dashboard, click **Refresh**. If a read fails, the page says why and keeps the last list. **Other payment methods** is always among the options, and shows when the order offers a payment method that no other option is for. Until the list is first read, or if its first read fails, the methods other than the card, Apple Pay, and Google Pay show there. ## Express checkout [#express-checkout] These settings place Apple Pay and Google Pay buttons that pay without the checkout form. The wallets that show are the ones your Pay.com account offers. | Setting | Default | Description | | ---------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Express checkout on product pages** | Yes | Buys the product from a basket of its own. The customer's basket stays as it was. | | **Express checkout on the cart** | Yes | Pays for the whole basket. | | **Express checkout in the mini-cart** | Yes | Pays for the whole basket, as the cart does. | | **Express checkout at the top of the checkout page** | Yes | Shows the buttons above the customer's details. They pay for the whole basket. The wallet collects the customer's email, phone, and addresses, and the order is placed from them. | The wallet sheet asks for the customer's email and phone, and the buttons don't show for a product that can't be ordered. ## Limits [#limits] These settings limit payment sessions and unpaid orders: | Setting | Type | Default | Description | | ----------------------------------------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | **Payment sessions per visitor per 15 minutes** | Number | `20` | How many new payment sessions one visitor can start. | | **Fail unpaid orders after (minutes)** | Number | `60` | The reconciler blocks the payment session of an order unpaid this long, then fails the order. An order with a payment in flight is kept. | ## PWA Kit [#pwa-kit] These settings point the cartridges at your PWA Kit storefront's pages: | Setting | Type | Default | Description | | --------------------------------- | ---- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Headless: return page URL** | Text | Empty | Sets the HTTPS return page URL for PWA Kit storefronts after payment. It receives `?t=` and passes it to `POST /returns` on the `pay-com` Custom API. | | **Headless: card saved page URL** | Text | Empty | The account page customers come back to after adding a card, on HTTPS. It gets `?t=` too. | ## Business Manager permissions [#business-manager-permissions] Two permissions open the cartridges' Business Manager pages: | Permission | What it opens | | ------------------ | --------------------------------------------------------------------------------------------------------------------------- | | `PAY_COM_SETTINGS` | **Merchant Tools** → **Pay.com** → **Settings and Connect** (keys, webhook secrets, payment methods, and Apple Pay domain). | | `PAY_COM_ORDERS` | **Merchant Tools** → **Pay.com** → **Orders** (capture, void, refund, accept, and deny actions). | Give them to roles in **Administration** → **Organization** → **Roles & Permissions**. # commercetools connector (/payments/plugins/commercetools) The Pay.com connector for commercetools runs in commercetools Connect and adds Pay.com payments to a storefront built on Composable Commerce. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, in a payment form rendered in Pay.com-hosted frames, which your storefront mounts with the connector's browser component. The connector validates the cart and locks it before any payment is taken, and creates the commercetools order only once it has confirmed the payment with Pay.com on its server. To deploy the connector and connect it to your Pay.com account, see [Set up the commercetools connector](/payments/plugins/commercetools/set-up). Every setting and its default is in [Settings](/payments/plugins/commercetools/settings). ## Cart locking and order creation [#cart-locking-and-order-creation] On commercetools, an order is the signal that a purchase was placed. Subscriptions export it, send its confirmation, and reserve its stock. So the connector validates the cart instead of creating an unpaid order. When the customer places the order, it recalculates the cart, checks that it's complete, then freezes and locks it in one update, so your cart API Extensions can still refuse it before anything is charged. A locked cart can't change until the connector releases it, and the order is created from exactly that version of the cart once the payment is confirmed. commercetools still checks stock and runs order API Extensions when it creates the order, after the payment. If it refuses the order, the connector refunds the charge or releases the authorization, unlocks the cart, and tells the customer. With **Authorize, capture once the order exists**, a refused order only releases an authorization. ## Supported features [#supported-features] The connector supports these checkout and order management features. | Feature | Description | | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Checkout | Cards, wallets, and local payment methods. By default, the card is entered in secure fields in your storefront's layout, and your storefront lists the other payment methods, in one list or each as an option of its own. Apple Pay and Google Pay can be among them, each paid with its own button. Pay.com's Universal checkout can show every payment method instead. See [Checkout](/payments/plugins/commercetools/settings#checkout). | | Capture | Capture immediately, capture once the order exists, or authorize only and capture on fulfillment or from the order. | | Refunds | Refund a captured payment through commercetools' payment intents, from the Merchant Center or Checkout, in full or in part. Refunds made in the Pay.com dashboard reach the payment. Canceling the payment releases an authorization. | | Payment review | A payment that doesn't match its cart is held. **Accept** or **Deny** it under **Held payments** in the Pay.com application in the Merchant Center. | | Express checkout | Apple Pay and Google Pay buttons on the cart, on product pages, and at the top of the checkout, priced with your commercetools shipping methods. A product page button buys that one product. At the top of the checkout, the order is placed from the details the wallet collects, not from the checkout form. The wallet asks for a phone number when you list `phone` among the [checkout's required fields](/payments/plugins/commercetools/settings#payment-settings). | | Saved cards | Signed-in customers can save a card when they pay in Pay.com's Universal checkout, pay with it later, and add or delete cards from their account. With card fields, a card is saved at checkout only for a Recurring Order. Pay.com keeps the card. | | Recurring Orders | Each cycle of a commercetools Recurring Order is charged to the card saved with its first order. A first cycle that costs nothing saves the card without a charge. The card is saved even with saved cards turned off, and is then kept only for the Recurring Order. | | Apple Pay domain | The connector serves Apple's domain association file for your storefront to pass on, and registers your storefront's domains with Apple through Pay.com. | ## How orders stay in sync [#how-orders-stay-in-sync] The connector confirms each payment with Pay.com on its server. Webhooks, and the connector's job every 5 minutes, reconcile payments when a customer closes the browser before returning to your store. The connector records each outcome on the commercetools payment it adds to the cart. | Pay.com outcome | commercetools | | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | Paid | The order is created, with payment state **Paid**. The payment has a successful **Charge** transaction. | | Authorized (manual capture) | The order is created, with payment state **Pending**. The payment has a successful **Authorization** transaction to capture before it expires. | | Funds pending, for example a bank debit | The order is created, with payment state **Pending**, until the funds clear. If they don't, it's **Failed**. | | Failed | No order. The cart is unlocked, so the customer can pay again. | | Requires manual review | The order is created, with payment state **Pending**, and the payment moves to the `pay-com-review` state with the reason. | A customer who goes back to change the cart releases it. The connector blocks the payment session first, and keeps the cart locked while a payment is in flight. A cart that stays locked and unpaid for the pending timeout is released the same way. A payment that completes after its cart was released still creates the order when the cart is as it was. Otherwise it's refunded, or its authorization released. The connector subscribes to the 12 shared [plugin webhook events](/payments/plugins#webhook-events). ## Capture and refunds [#capture-and-refunds] Capture, refund, and cancel payments through commercetools' payment intents, as the Merchant Center and Checkout do, or add a transaction in the `Initial` state to the payment through the API. The connector runs it and sets its state. A refund after a manual capture goes through the capture's charge. With **Authorize only; capture on fulfilment or from the order**, the order's shipment state reaching **Shipped** or **Delivered**, or the order becoming **Complete**, captures the authorization. A capture that fails puts the payment in review. Canceling an authorized order releases its authorization. ## Apple Pay [#apple-pay] The Apple Pay button shows only on a domain registered with Apple. Proxy `/.well-known/apple-developer-merchantid-domain-association` on your storefront's domain to the same path on the connector's service, which serves Pay.com's file. Then, under **Apple Pay domains** in the Pay.com application, enter the domain in **Storefront domains** and click **Register**. Pay.com asks Apple to check the file. The sandbox and live register separately, and the storefront must be on HTTPS at the root of its domain. ## Data the connector sends [#data-the-connector-sends] The connector and its browser component communicate with Pay.com as follows: * The browser component loads Pay.com.js from `https://js.pay.com/v1`. Card details are entered in Pay.com frames and sent only to Pay.com. Details a payment method asks for, such as a BLIK code or a bank, are also sent only to Pay.com, not to the connector. * The connector calls the Pay.com API (`https://api.pay.com/v1`, or `https://api.sandbox.pay.com/v1` for the sandbox) to create payment sessions, to confirm, capture, and refund payments, to manage saved cards, and to read your account's payment methods. * For Apple Pay, the connector downloads Apple's domain association file from Pay.com at most once a day, and sends your domains to the Pay.com API when you register them. * Neither your storefront nor the Merchant Center gets a Pay.com key. They call the connector with the customer's commercetools session or a commercetools token. API keys and webhook secrets are kept in the deployment's secured configuration, and the Pay.com application never shows more than a key's last characters. # Set up the commercetools connector (/payments/plugins/commercetools/set-up) The Pay.com connector for commercetools adds Pay.com payments to a storefront built on Composable Commerce. Deploy it in commercetools Connect, connect it to your Pay.com account, mount its browser component in your storefront, and take a test payment in the sandbox. What the connector does once it's running is in [commercetools connector](/payments/plugins/commercetools). ## Requirements [#requirements] Your storefront's backend creates a commercetools session for each cart, with an API client that has the `manage_sessions` scope. | Requirement | Version | | ------------- | ------------------------------------------------------------------ | | commercetools | A Composable Commerce project with Connect and the Merchant Center | | Connector | 0.1.0 | ## Deploy and connect [#deploy-and-connect] The connector takes an API key, created in the Pay.com dashboard, for each environment you use. ### Deploy the connector [#deploy-the-connector] In commercetools Connect, deploy the Pay.com connector with the configuration in [Settings](/payments/plugins/commercetools/settings), and give its API client the scopes listed there. The deployment has five applications: `service` (the API your storefront and Pay.com call), `event`, `job`, `enabler` (the browser component), and `mc-app` (the Pay.com application for the Merchant Center). Once deployed, the connector creates its custom types and review states, and its subscription to your project's messages. ### Register the Pay.com application [#register-the-paycom-application] In the Merchant Center, register a custom application with the entry point `pay-com`, and enter the `mc-app` application's URL as its application URL. Give its ID to the `mc-app` application's `CUSTOM_APPLICATION_ID`, and the `service` application's URL to its `PAY_COM_SERVICE_URL`. Then give your teams the application's **View** permission, and **Manage** to those who change its settings and decide held payments. ### Enter your API keys [#enter-your-api-keys] In the deployment's secured configuration, set `PAY_COM_SANDBOX_API_KEY` to an `sk-pay-com-sandbox-` key you created in the Pay.com dashboard, and `PAY_COM_LIVE_API_KEY` to an `sk-pay-com-live-` key when you take live payments. Under **Connect with Pay.com**, the Pay.com application shows whether Pay.com accepts the key of the environment `PAY_COM_ENVIRONMENT` picks. When that environment has no key, it names the variable to set. See [Settings](/payments/plugins/commercetools/settings#pay-com-account). ### Add the webhook [#add-the-webhook] In the Pay.com dashboard, add a webhook that sends events to the `service` application's `/webhooks/pay-com` endpoint, then set its signing secret as `PAY_COM_SANDBOX_WEBHOOK_SECRET` or `PAY_COM_LIVE_WEBHOOK_SECRET`. Do this for each environment you use, and subscribe to the 12 [plugin webhook events](/payments/plugins#webhook-events). ### Create a session for the cart [#create-a-session-for-the-cart] When the customer reaches the payment step, your storefront's backend creates a commercetools session for their cart, with the `service` application's URL as `processorUrl`, and gives the browser its ID: ```bash curl -X POST "https://session.europe-west1.gcp.commercetools.com//sessions" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "cart": { "cartRef": { "id": "" } }, "metadata": { "processorUrl": "", "merchantReturnUrl": "https://shop.example.com/checkout/complete" } }' ``` `merchantReturnUrl` is where the customer lands after paying, and `futureOrderNumber` in `metadata` sets the order's number. ### Mount the payment form [#mount-the-payment-form] Load the browser component from the `enabler` application, `/pay-com-enabler.js`, and mount it with the session's ID: ```js const enabler = new PayComEnabler({ processorUrl: '', sessionId, onError: showMessage }) const payment = await enabler.mount({ dropIn: '#pay-com', fields: { inputs: { number: '#card-number', expiry: '#card-expiry', cvv: '#card-cvv' }, card: '#card', methods: '#methods', inheritStyleFrom: '#email' } }) placeOrderButton.onclick = () => payment.submit() backToCart.onclick = () => payment.release() ``` Configure how the browser component mounts and handles checkout events: * **Card fields vs. Universal checkout:** With card fields (the default **Payment form**), card details are entered in secure Pay.com frames styled to match your storefront. `inputs` defines the card field mount targets, `card` wraps them, `inheritStyleFrom` copies styling from an existing input, and `methods` renders the list of available payment methods. Payment methods that require extra inputs (such as a BLIK code or bank selection) render below the list, styled by `/pay-com-method-fields.css`. Mounting without `fields`, or selecting **Pay.com drop-in**, renders Pay.com's Universal checkout inside `dropIn`. See [Checkout](/payments/plugins/commercetools/settings#checkout). * **Submitting and releasing the cart:** Call `submit()` to validate and lock the cart before paying. Call `release()` before the customer edits the cart so the connector unlocks it. * **Separate payment method options:** Pass `separate: true` to show each payment method as its own option. Render the items returned by `await enabler.paymentOptions()` (each includes a `name` and optional `logo`) and call `payment.select(type)` when the customer picks one. The `other` option covers methods listed in `methods` (with Universal checkout, only the card option appears). If an option includes `fields` (such as BLIK), provide a mount element through `fields.methodFieldsFor(type)` or the method can't be selected. * **Wallets in the method list:** Add `wallets: { container: '#wallet-button', inList: true }` to `fields` to list Apple Pay and Google Pay with your payment methods. When a customer selects a wallet, its button renders in `container` in place of your place-order button. Pass `onMethodChange` to `mount()` and hide your button whenever it reports `wallet: true`. After shipping or coupon updates, call `payment.updateTotal(total)` to update the wallet total. * **Express checkout buttons:** Call `enabler.express('#express')` on the cart page, `enabler.express('#express', { product: { sku, quantity } })` on a product page, or `enabler.express('#checkout-express', { location: 'checkout' })` at the top of checkout (using the same `enabler` instance as the payment form). If express checkout is disabled or checkout requires a field the wallet can't supply, `express()` hides its container. * **Return URL parameters:** After payment, the customer returns to `merchantReturnUrl` with `paymentReference`, `result` (`succeeded`, `open`, `failed`, or `review`), and, once the order exists, `orderNumber`. Look up the order using your storefront's own credentials, as these query parameters aren't credentials. ### Take a test payment [#take-a-test-payment] `PAY_COM_ENVIRONMENT` is `sandbox` by default, so the connector takes payments in the sandbox. Place an order with a [test card](/get-started/test-your-integration/test-cards), then set `PAY_COM_ENVIRONMENT` to `live` and redeploy to take live payments. ## Next steps [#next-steps] * [Apple Pay](/payments/plugins/commercetools#apple-pay): Pass the domain association file on and register your storefront's domain to show the Apple Pay button. * [commercetools connector](/payments/plugins/commercetools): What the connector supports, how orders stay in sync with Pay.com, and the data the connector sends. * [Settings](/payments/plugins/commercetools/settings): Every setting with its default. # commercetools connector settings (/payments/plugins/commercetools/settings) The connector's settings are its deployment's configuration in commercetools Connect. Its `service`, `event`, and `job` applications each declare the same configuration. Give them the same values. The payment settings can also be changed in the Pay.com application in the Merchant Center, without a redeploy. ## Pay.com account [#pay-com-account] These settings are secured configuration, which Connect stores encrypted: | Setting | Description | | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `PAY_COM_SANDBOX_API_KEY` | An `sk-pay-com-sandbox-` key you created in the Pay.com dashboard. | | `PAY_COM_SANDBOX_WEBHOOK_SECRET` | The signing secret of the sandbox webhook you added in the Pay.com dashboard, which sends events to the service's `/webhooks/pay-com`. | | `PAY_COM_SANDBOX_WEBHOOK_SECRET_PREVIOUS` | While you rotate the sandbox webhook secret, keep the old one here until the new one works, then remove it. | | `PAY_COM_LIVE_API_KEY`, `PAY_COM_LIVE_WEBHOOK_SECRET`, `PAY_COM_LIVE_WEBHOOK_SECRET_PREVIOUS` | The same for live, with an `sk-pay-com-live-` key. | The Pay.com application's **Connect with Pay.com** section shows each environment's account, its key's last characters, and whether Pay.com accepts the key. When the environment `PAY_COM_ENVIRONMENT` picks has no key, it names the variable to set, for example "PAY\_COM\_ENVIRONMENT is live, but only a sandbox API key is saved. Enter PAY\_COM\_LIVE\_API\_KEY in the deployment's secured configuration, or set PAY\_COM\_ENVIRONMENT to sandbox." The `not_configured` error the connector returns to your storefront gives the same reason in its `message`, with `reason` set to `not_connected`, `no_sandbox_key`, or `no_live_key`. ### Environment [#environment] `PAY_COM_ENVIRONMENT` picks the environment the connector takes payments in: | Setting | Default | Description | | --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `PAY_COM_ENVIRONMENT` | `sandbox` | `sandbox` takes payments in your Pay.com sandbox with the sandbox key, through `https://api.sandbox.pay.com/v1`. `live` takes live payments with the live key, through `https://api.pay.com/v1`. | ## Payment settings [#payment-settings] The Pay.com application's **Payment settings** override these for every application within a minute. Anything not set there follows the deployment's configuration. | In the Pay.com application | Configuration | Default | Description | | -------------------------------------------------------- | --------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Capture** | `PAY_COM_CAPTURE_MODE` | `automatic` | **Capture at once** (`automatic`) charges when the customer pays. **Authorize, capture once the order exists** (`after_order`) authorizes, creates the order, then captures. **Authorize only; capture on fulfilment or from the order** (`manual`) places an authorization to capture before it expires. | | **Payment form** | `PAY_COM_PAYMENT_FORM` | `fields` | **Card fields and the shop's own method list** (`fields`) shows secure card fields with your storefront's own list of the other payment methods, where the browser component is mounted with `fields`. **Pay.com drop-in** (`dropin`) shows every payment method in Pay.com's Universal checkout. See [Checkout](#checkout). | | **Saved cards for signed-in customers** | `PAY_COM_SAVED_CARDS` | `true` | Signed-in customers can save cards and pay with them. Cards saved in the sandbox are offered only in the sandbox. With card fields, there's no option to save a card at checkout. A Recurring Order's card is saved without asking, for its later cycles, even with `false`. It then stays out of the customer's saved cards, even after you turn saved cards on. | | **Express checkout (Apple Pay, Google Pay) on the cart** | `PAY_COM_EXPRESS_CART` | `true` | Express checkout buttons on the cart and the mini-cart. | | **Express checkout on product pages** | `PAY_COM_EXPRESS_PRODUCT` | `true` | Express checkout buttons on product pages, which buy that one product. | | **Express checkout at the top of the checkout** | `PAY_COM_EXPRESS_CHECKOUT` | `true` | Express checkout buttons at the top of the checkout, above the customer's details. The wallet collects the customer's email, addresses, and shipping method, and the order is placed from them, not from the checkout form. | | **Checkout fields the wallet can't fill** | `PAY_COM_EXPRESS_REQUIRED_FIELDS` | Empty | The fields your storefront requires before an order, comma-separated, with `custom.` for a custom field. Express checkout hides while one is listed that the wallet can't fill. The wallet fills the name, email, addresses, and shipping method. With `phone` listed, it also asks the customer for a phone number, and an express order without one is refused. On product pages, express checkout also hides for a required custom field of the cart's type. | | **Fields the shop fills itself** | `PAY_COM_EXPRESS_FILLABLE_FIELDS` | Empty | Required fields that get a default or are set by an API Extension, so they don't hide express checkout. With `phone` listed here, the wallet doesn't ask for a phone number. | ## Checkout [#checkout] With card fields, the card is entered in secure Pay.com fields in your storefront's layout, next to a list of the cart's payment methods. A payment method that requires additional details (such as a BLIK code or bank) shows inputs for them. Payment methods that require unsupported custom fields are omitted from checkout. The browser component falls back to Pay.com's Universal checkout if card fields aren't available, don't support any of the cart's payment methods, or when your storefront mounts it without `fields`. A Recurring Order whose first cycle costs nothing also uses Universal checkout. Your storefront decides whether to display payment methods in one list or as separate options, and whether to list Apple Pay and Google Pay among them. When a customer selects a wallet, its button replaces your place-order button and pays with the details entered at checkout. See [Mount the payment form](/payments/plugins/commercetools/set-up#mount-the-payment-form). ### Your payment methods [#your-payment-methods] The Pay.com application's **Your payment methods** lists the payment methods your Pay.com account offers in the environment `PAY_COM_ENVIRONMENT` picks, and when they were read. When your storefront shows each payment method as an option of its own, each of them gets an option, shown when the cart's Pay.com session offers it. Apple Pay and Google Pay show when your account has them set up and the customer's browser can pay with them. The connector reads the list once it has the environment's key, then once a day. After you change your methods in the Pay.com dashboard, click **Refresh**. If a read fails, the last list stays and the section says why. Until the list is first read, the methods other than the card, Apple Pay, and Google Pay are in the `other` option. ## Orders and carts [#orders-and-carts] These settings cover the orders the connector creates and the carts it locks: | Setting | Default | Description | | --------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `PAY_COM_MERCHANT_RETURN_URL` | Required | Where customers land after paying, unless the commercetools session names `merchantReturnUrl`. | | `PAY_COM_REFERENCE_PREFIX` | Empty | Shown in the Pay.com dashboard before the order number. Use a different prefix on each storefront that shares a Pay.com account. | | `PAY_COM_ORDER_NUMBER_PREFIX` | Empty | The prefix of the order numbers the connector makes, when the commercetools session has no `futureOrderNumber`. | | `PAY_COM_CAPTURE_ON` | `Shipped,Delivered,Complete` | The shipment states, and the order state `Complete`, that capture an authorized payment. | | `PAY_COM_LOCK_CART` | `true` | Locks the cart while it's being paid, which needs the `manage_locked_carts` scope. | | `PAY_COM_PENDING_TIMEOUT_MINUTES` | `120` | How long an attached, unpaid cart stays locked before the connector releases it. | | `PAY_COM_SESSION_LIMIT` | `20` | How many new payment sessions one visitor can start in 15 minutes. | | `PAY_COM_ALLOWED_ORIGINS` | `*` | The storefront origins allowed to call the service, comma-separated. | ## commercetools [#commercetools] These settings connect the connector to your commercetools project: | Setting | Default | Description | | --------------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `CTP_PROJECT_KEY` | Required | Your commercetools project's key. | | `CTP_CLIENT_ID`, `CTP_CLIENT_SECRET` | Required | An API client with `manage_payments`, `manage_orders`, `manage_customers`, `view_sessions`, `manage_locked_carts`, `manage_key_value_documents`, `manage_payment_methods`, `manage_types`, `manage_states`, `manage_subscriptions`, `introspect_oauth_tokens`, and `view_shipping_methods`, and `manage_recurring_payment_jobs` for Recurring Orders. The secret is secured configuration. | | `CTP_AUTH_URL`, `CTP_API_URL`, `CTP_SESSION_URL`, `CTP_CHECKOUT_URL`, `CTP_CONNECT_URL` | The `europe-west1.gcp` region's | Your project's region's Auth, API, Session, Checkout, and Connect URLs. | | `CTP_JWKS_URL`, `CTP_JWT_ISSUER` | The `europe-west1.gcp` region's | The Merchant Center's JWKS URL and JWT issuer, for the Pay.com application's calls. | | `PAY_COM_SERVICE_URL` | Empty | The `service` application's URL. Connect gives the `service` application its own URL. Set this for the `event` and `job` applications. | | `PAY_COM_MC_APP_ENTRY_POINT` | `pay-com` | The Pay.com application's entry point, whose **View** and **Manage** permissions the connector checks. | ## The Pay.com application [#the-paycom-application] These settings are the `mc-app` application's configuration: | Setting | Default | Description | | ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------- | | `CUSTOM_APPLICATION_ID` | Required | The ID the Merchant Center gave the Pay.com application when you registered it. | | `ENTRY_POINT_URI_PATH` | `pay-com` | The application's entry point. Use the same value as `PAY_COM_MC_APP_ENTRY_POINT`. | | `CLOUD_IDENTIFIER` | `gcp-eu` | Your Merchant Center region (`gcp-eu`, `gcp-us`, `gcp-au`, `aws-eu`, or `aws-us`). | | `PAY_COM_SERVICE_URL` | Required | The connector's `service` application URL, which the application calls through the Merchant Center's proxy. | Teams need the application's **View** permission to see it, and **Manage** to change settings, refresh your payment methods, register domains, and decide held payments. # Smart Router commitments (/payments/routing/smart-router/commitments) If you've agreed to send an acquirer a minimum volume or number of payments each month, add it to Smart Router as a commitment. Smart Router then moves traffic to that settlement account where the move costs the least approval rate, and never goes past the approval-rate ceiling you set. ## Requirements [#requirements] Before you add a commitment, make sure you have: * Commitments enabled on your account. If **Commitments** doesn't appear under **Smart Router**, contact your Pay.com account team to enable it. * A dashboard user role that can edit Smart Router. * The committed settlement account included in a Smart Router configuration that routes your traffic. Smart Router can move only the payments it routes. See [Smart Router](/payments/routing/smart-router). ## Add a commitment [#add-a-commitment] You add commitments in the Pay.com dashboard. ### Open commitments [#open-commitments] In the Pay.com dashboard, go to **Smart Router** → **Commitments** and add a new commitment. ### Choose the account and the amount [#choose-the-account-and-the-amount] In **Commit volume to**, select the settlement account. In **What are you committing?**, choose one of these options: * **Settled volume:** a minimum approved amount, in US dollars. * **Approved charges:** a minimum number of approved authorizations and sales. Retries don't count, so this number can run below the count on your acquirer's invoice. Then enter the monthly minimum. ### Set the month [#set-the-month] Commitments run for a calendar month. In **Month boundary**, select the time zone that starts and ends each month. In **When does it start?**, choose **This month** or **Next month**. ### Set the approval-rate ceiling [#set-the-approval-rate-ceiling] In **Approval-rate ceiling**, set the maximum approval-rate drop Smart Router can accept to meet the commitment, from 0.05 to 3 percentage points. ### Check the preview and create it [#check-the-preview-and-create-it] The preview estimates the approval-rate impact using your recent traffic. Click **Create commitment** to save it. The dashboard doesn't create a commitment that the preview shows can't be met. A new commitment starts moving traffic within minutes from the start of the month you chose. The list shows each commitment's **Target**, **Monthly minimum**, **AR ceiling**, **Month boundary**, and **Status**. To change or remove one, open its menu and choose **Edit** or **Delete**. ## How Smart Router paces a commitment [#how-smart-router-paces-a-commitment] Smart Router spreads the commitment across the month and moves traffic gradually. How fast it makes up a shortfall depends on how much of your traffic Smart Router routes. When the account is ahead of target, Smart Router hands the extra traffic back to the top-ranked accounts. With more than one commitment, it works on the one furthest behind first, without taking traffic that another commitment needs to stay on pace. ## When a commitment falls behind [#when-a-commitment-falls-behind] Smart Router never goes past your approval-rate ceiling to meet a monthly minimum, so a commitment that would cost more approval rate than its ceiling isn't met. Smart Router reports a shortfall with its cause. When you preview a commitment, the dashboard shows which cause applies: * Meeting the target would cost more approval rate than your ceiling allows. Raising the ceiling buys more volume, at the cost of more approval rate. * There's too little traffic Smart Router can move to the account. Raising the ceiling changes nothing. * Smart Router could estimate the cost of only part of the traffic the account could take, so the target may still be reachable. * Another of your commitments needs the same traffic to stay on pace. ## Next steps [#next-steps] * [Smart Router](/payments/routing/smart-router): Create a configuration and route payments to it. * [Optimization models](/payments/routing/smart-router#optimization-models): Choose how Smart Router ranks your settlement accounts. * [Circuit breaker](/payments/routing/smart-router#circuit-breaker): Remove a settlement account from Smart Router traffic when its approval rate drops sharply. # Smart Router (/payments/routing/smart-router) Smart Router selects the settlement account for each card payment (including cards paid through Apple Pay and Google Pay) from the accounts in a configuration, based on how similar payments performed recently. You attach a Smart Router configuration as the target of a routing rule in the same place you select a settlement account, and Smart Router picks an account for each payment in milliseconds. ## Requirements [#requirements] Before you use Smart Router, make sure you have: * Smart Router enabled on your account. If **Smart Router** doesn't appear in the dashboard sidebar, contact your Pay.com account team to enable it. * A dashboard user role that can edit Smart Router, to create configurations. * Two or more settlement accounts that process cards. * Routing rules enabled on your account. Smart Router routes only the payments that a routing rule sends to it. See [Routing rules](/payments/routing/routing-rules). ## How Smart Router picks an account [#how-smart-router-picks-an-account] For each payment, Smart Router looks at how payments like it performed recently on each of the configuration's settlement accounts. It ranks the accounts with the configuration's [optimization model](#optimization-models) and favors the top-ranked account. Smart Router keeps learning as your traffic changes. It waits for enough history before it favors an account, and sends a small share of traffic to accounts it knows less about, so its picks stay current. A saved card can go back to the settlement account where it last succeeded. Smart Router never selects an account that the payment has already tried, or an account that's disabled for the payment's method or transaction type. ## Optimization models [#optimization-models] Each Smart Router configuration uses one optimization model to rank its settlement accounts. Pick the model in **Model** when you create or edit a configuration. | Model | Ranks accounts by | Best when | | :---------------------------- | :--------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------- | | Approval rate | The share of payments each account approves. | You want to maximize approved payments. | | Financial | The share of the requested amount that reaches you after fees and currency conversion. | You want to maximize net revenue after processing costs. | | Volume-weighted approval rate | The share of the requested amount each account approves, so larger payments count for more. | High-value payments matter more than small ones. | | Fraud | Approval rate, while keeping each account's fraud rate at or below the maximum you set for it. | You must keep each account under an acquirer or network fraud threshold. | ## Create a configuration [#create-a-configuration] A configuration defines the set of settlement accounts Smart Router can choose from and the optimization model it uses to rank them. ### Open configurations [#open-configurations] In the Pay.com dashboard, go to **Smart Router** → **Configurations** and click **New configuration**. ### Name it and pick the accounts [#name-it-and-pick-the-accounts] Enter a unique **Name** of up to 80 characters. In **Settlement accounts**, select up to 64 accounts that Smart Router can choose from, or leave it empty to let Smart Router choose from any eligible account. ### Choose the model [#choose-the-model] In **Model**, select the [optimization model](#optimization-models) Smart Router uses to rank the accounts. ### Save the configuration [#save-the-configuration] Save the configuration. It starts routing within an hour, and shows **Awaiting policy** until then. You can't delete a configuration while a routing rule references it. To restrict an account to specific card networks, go to **Smart Router** → **Overview**, click **Edit** on the account, and select its networks. This can only narrow what the account accepts, and takes effect within an hour. ## Route payments to Smart Router [#route-payments-to-smart-router] In a routing rule for cards, select the configuration under **Smart Router** in the list of targets. You can use a configuration in three ways: * **As the rule's target:** Smart Router routes every payment the rule matches. * **As one split of a percentage split:** Use this to compare Smart Router against a fixed settlement account. The split displays **Smart Router ·** followed by the configuration name. * **As a fallback:** Smart Router selects the account for the retry. A fallback chain can reference the same configuration more than once, up to its number of accounts. ## When Smart Router can't decide [#when-smart-router-cant-decide] If Smart Router can't pick an account in time, or a new configuration isn't ready yet, Pay.com picks one of the configuration's available accounts instead, skipping any account the payment already tried. If none is available, a payment routed directly to Smart Router falls through to your standard routing rules, and a Smart Router fallback moves on to the next fallback. ## Circuit breaker [#circuit-breaker] The circuit breaker stops Smart Router from sending payments to a settlement account whose approval rate drops sharply against its own recent performance. It watches every account, takes a failing account out of Smart Router traffic, and brings it back once it recovers. Processor errors and timeouts don't count as approvals or declines, so an unresponsive settlement account doesn't trip the circuit breaker. Add a [fallback](/payments/routing/fallbacks-and-retries) to retry those payments on another settlement account. ### While an account is out of service [#while-an-account-is-out-of-service] The breaker isolates as little traffic as it can: * **Smart Router traffic only:** Smart Router stops routing to the account and uses the next-best one. Payments that a routing rule sends straight to the account still go there. * **Narrowed when possible:** When the drop is limited to one BIN, card network, or issuing country, the breaker removes the account only for that traffic. * **Last route kept:** The breaker never removes the last available account for a payment. * **Wider outages:** When many of your accounts drop together, as in a card network outage, the breaker keeps them in service. A payment that Smart Router moved away from an out-of-service account lists that account under **Moved from** in the transaction details. ### Recovery and service history [#recovery-and-service-history] The breaker brings an account back once its approval rate recovers. It doesn't send test payments to an out-of-service account. Contact your Pay.com account team to override an account's circuit-breaker status. To view active and past breaker events, go to **Smart Router** → **Service history**. The page shows accounts that are **Out of service now** and logs each status change: * **Taken out of service:** Smart Router stopped sending any of its traffic to the account. * **Narrowed:** The breaker removed the account only for the affected BIN, card network, or issuing country. * **Back in service:** Smart Router resumed routing traffic to the account. To receive alerts when a settlement account's approval rate drops, configure [anomaly detection](/payments/routing/anomaly-detection). ## See Smart Router's decisions [#see-smart-routers-decisions] When processor details are enabled on your account and Smart Router selected the account, `underlying_processing_details.routing_details` includes three additional fields. When Smart Router didn't select the account, these fields are omitted rather than `false`. | Field | What it holds | | :-------------------------------- | :--------------------------------------------- | | `smart_router` | `true` when Smart Router selected the account. | | `smart_router_configuration_id` | The ID of the configuration that selected it. | | `smart_router_configuration_name` | The configuration's name. | ```json { "underlying_processing_details": { "settlement_account": "sa_296645958265997349", "routing_details": { "selected_methodology": "rule_engine", "rule_engine": { "rule_id": "rl_772846036363248640" }, "smart_router": true, "smart_router_configuration_id": "rc_6f1c2b8e-3d4a-4e9b-a7c5-2b8d9e0f1a34", "smart_router_configuration_name": "EU cards" } } } ``` In the dashboard, **Activity** → **Transactions** provides two Smart Router columns (hidden until you add them). **Smart Router** displays **Applied** or **Not applied**, and **Smart Router Configuration** identifies the configuration. To list payments by outcome, filter by **Smart Router** and choose **Routed by Smart Router** or **Asked, but not applied**. Open a payment to view its **Smart Router** details, including the **Configuration**, **Why this account**, and the account it **Moved from**. ## Next steps [#next-steps] * [Commitments](/payments/routing/smart-router/commitments): Meet monthly volume or charge minimums on a settlement account within an approval-rate ceiling. * [Anomaly detection](/payments/routing/anomaly-detection): Receive alerts in Slack, WhatsApp, or PagerDuty when approval rates or volumes change sharply. * [Routing rules](/payments/routing/routing-rules): Send card payments to a Smart Router configuration. * [Fallbacks and retries](/payments/routing/fallbacks-and-retries): Retry declined payments and processor timeouts on another settlement account. # ACH direct debit (/documentation/payment-methods/bank-debits/ach-direct-debit) ACH direct debit pulls USD from a customer's US checking or savings account. You create each charge from your server with the customer's bank details or a saved bank account, and send it over ACH or as a Request for Payment (RfP) over the RTP network. ## Payment method properties [#payment-method-properties] ACH direct debit takes USD from customers in the United States, and you accept it only through the API. | Property | Details | | --- | --- | | Type | Bank debit | | API type | `us_bank_account` | | Customer countries | United States | | Currencies | USD | | Recurring payments | Yes | | Integrations | API | ## How it works [#how-it-works] An ACH direct debit charge is asynchronous, so its outcome arrives after you create it. 1. You collect the customer's authorization to debit their account, and their routing number, account number, and account type. 2. You create the charge with [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge). Every ACH direct debit charge returns `201` with `status: "pending"`, including a charge that's declined later. 3. Pay.com sends the charge over the rail you chose. The charge moves to `succeeded` or `failed`, and Pay.com sends the `charge.succeeded` or `charge.failed` webhook event. 4. After a charge succeeds, the customer's bank can still return the debit. See [Returns](#returns). You must get the customer's authorization to debit their account before you create the charge, and send the notices the ACH rules require. Pay.com doesn't collect authorizations or send debit notices for you. ## Before you begin [#before-you-begin] Ask your account manager to enable ACH direct debit for your account. Request for Payment needs its own setup, so tell them if you plan to send charges over RTP. You also need: * Your [API keys](/get-started/api-keys). * A webhook endpoint that receives charge events. See [Webhooks](/developer-resources/webhooks). ## Charge a bank account [#charge-a-bank-account] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"us_bank_account"`, the customer's bank details in `source_data.us_bank_account`, and the rail in `payment_method_options.us_bank_account.network`. The example debits $100.00, because `amount` is in minor units. ```json { "amount": 10000, "currency": "usd", "customer_reference_id": "cust-001", "source_data": { "type": "us_bank_account", "us_bank_account": { "account_number": "000123456789", "routing_number": "021000021", "account_holder_name": "Jane Smith", "account_type": "checking", "account_holder_type": "individual" }, "billing_details": { "name": "Jane Smith", "email": "jane.smith@example.com", "address": { "line1": "1 Main Street", "city": "New York", "state": "NY", "postal_code": "10001", "country": "US" } } }, "payment_method_options": { "us_bank_account": { "network": "ach", "ach_type": "same_day" } } } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "status": "pending", "created": "2026-11-28T10:30:00Z", "paid": false, "refunded": false, "disputed": false } ``` `network` and `account_type` are required, and a charge without `network` is declined. `account_type` is `checking` or `savings`, and `account_holder_type` is `individual` or `company`. `billing_details` needs at least the customer's `name` and `email`. A Request for Payment also needs the full billing address, including the street in `address.line1`. ## Choose the rail [#choose-the-rail] Set these options in `payment_method_options.us_bank_account` on the charge. | Option | Values | Description | | -------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `network` | `ach`, `rtp` | Required. The rail the charge uses. `ach` debits the account over ACH. `rtp` sends a Request for Payment over the RTP network, and the customer approves it with their bank. A charge with `fednow` is declined. | | `ach_type` | `next_day`, `same_day` | How fast an ACH debit settles. `next_day`, the default, settles the next business day. `same_day` settles the same business day. | | `ach_entry` | `web`, `ppd`, `ccd`, `tel` | The ACH entry class, which matches how the customer authorized the debit. `web`, the default, is for authorization online. `ppd` is for a consumer's written authorization, `ccd` is for a business account, and `tel` is for authorization by phone. | | `ach_fallback` | `true`, `false` | For a Request for Payment. Set to `true` to send the charge as a same-day ACH debit when the customer's bank can't receive Request for Payment, or when the billing address has no street. Without it, those charges are declined. | ## Charge a saved bank account [#charge-a-saved-bank-account] To charge a bank account the customer saved before, pass its `pm_us_bank_account_…` ID as `payment_method`, an alias of `source`, with the same `customer_reference_id` it was saved for. Set `off_session` to `true` when the customer isn't in your checkout, such as for a recurring charge. Each charge's `network` decides its rail, so you can charge a saved account over ACH or RTP. ```json { "amount": 10000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method": "pm_us_bank_account_483260647404995584", "off_session": true, "payment_method_options": { "us_bank_account": { "network": "ach" } } } ``` ```json { "id": "chrg_702172234081976320", "resource": "charge", "amount": 10000, "amount_human_readable": "100.00", "currency": "usd", "status": "pending", "created": "2026-11-28T10:35:00Z", "paid": false, "refunded": false, "disputed": false } ``` To find a saved bank account's ID, list the customer's payment methods with [`GET /v1/customers/{reference_id}/payment_methods`](/api-reference/endpoints/customers/get-customer-payment-methods-by-reference). ## Track the outcome [#track-the-outcome] An ACH direct debit charge stays `pending` until its outcome arrives. Pay.com sends the outcome in a webhook event, and you can also retrieve the charge with [`GET /v1/charges/{id}`](/api-reference/endpoints/charges/get-charge). Don't fulfill an order while its charge is `pending`. | Rail | When the charge moves to `succeeded` | | ------------------- | ------------------------------------ | | ACH with `same_day` | The same business day | | ACH with `next_day` | The next business day | | Request for Payment | When the customer pays the request | A declined charge moves to `failed` within a few seconds, with a `failure_code` such as `processing_error`, or `issuer_not_available` when the customer's bank can't receive Request for Payment. See [Declines](/payments/concepts/declines) for what each code means. Subscribe to these events, and verify the `Pay-Signature` header before you act on one. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). | Event | When it fires | What to do | | ------------------ | ---------------------------------------------- | ----------------------------------------------------------------------------------------- | | `charge.succeeded` | The debit or the Request for Payment completed | Fulfill the order | | `charge.failed` | The charge was declined | Read the charge's `failure_code`, and ask the customer to pay again or use another method | ## Returns [#returns] An ACH debit isn't guaranteed. After a charge succeeds, the customer's bank can still return the debit: * An administrative return, such as R01 for insufficient funds, usually arrives within 2 business days. * A return for a debit the customer says they didn't authorize can arrive up to 60 days later. Pay.com records a return as a lost dispute, with the ACH return code as its reason, and takes back the charge's amount and a chargeback fee. See [Disputes](/risk/disputes). ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). Any account number works. The routing number decides whether the test bank can receive Request for Payment. | Routing number | Test bank | | -------------- | ------------------------------- | | `021000021` | Receives ACH only | | `271975391` | Can receive Request for Payment | Outcomes don't depend on the amount or the account number. In the sandbox, an ACH charge succeeds, and a Request for Payment is paid automatically about a minute after you create it. To test a decline, create one of these charges: * A charge without `network`. * A charge with `network` set to `"fednow"`. * A charge in a currency other than USD. * A Request for Payment to routing number `021000021` without `ach_fallback`. * A Request for Payment with no street in the billing address and without `ach_fallback`. Returns can't be simulated in the sandbox. ## Next steps [#next-steps] * [Disputes](/risk/disputes): Track returned debits, which Pay.com records as lost disputes. * [Refund a charge](/payments/refunds): Refund a succeeded charge, and review refund statuses. * [US bank account payouts](/payouts/methods/us-bank-account): Pay out to a customer's US bank account. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Neosurf (/documentation/payment-methods/vouchers/neosurf) Neosurf lets customers pay online with a 10-character prepaid voucher PIN bought with cash or online, or from a myNeosurf account balance. Payments confirm immediately and carry no chargebacks. ## Payment method properties [#payment-method-properties] Neosurf takes payments from customers in Europe, Australia, Canada, Mexico, New Zealand, and the United States, and settles monthly. | Property | Details | | --- | --- | | Type | Voucher | | API type | `neosurf` | | How customers pay | Redirect to the provider | | Customer countries | Andorra, Australia, Austria, Belgium, Canada, Croatia, Cyprus, Czechia, Denmark, Finland, France, Iceland, Ireland, Italy, Liechtenstein, Luxembourg, Malta, Mexico, Moldova, Netherlands, New Zealand, Poland, Portugal, Slovakia, Slovenia, Spain, Sweden, Switzerland, United Kingdom, United States | | Refunds | Full and partial | | Recurring payments | No | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | Global (excluding sanctioned countries). Availability in some countries also depends on your license type. See [Licensing requirements](#licensing-requirements) | | Payment confirmation | Immediate | | Settlement timing | Monthly. Settlement reports are issued on the 1st of the following month, and payouts are issued 30 days later (for example, the May settlement report is issued on 1 Jun and the May payout on 1 Jul) | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | AUD | 1 | 100000000 | | BGN | 1 | 100000000 | | BRL | 1 | 100000000 | | CAD | 1 | 100000000 | | CHF | 1 | 100000000 | | CNY | 1 | 100000000 | | CZK | 1 | 100000000 | | DKK | 1 | 100000000 | | EUR | 1 | 100000000 | | GBP | 1 | 100000000 | | HKD | 1 | 100000000 | | HUF | 1 | 100000000 | | IDR | 1 | 100000000 | | ILS | 1 | 100000000 | | INR | 1 | 100000000 | | JPY | 1 | 100000000 | | KRW | 1 | 100000000 | | MXN | 1 | 100000000 | | MYR | 1 | 100000000 | | NOK | 1 | 100000000 | | NZD | 1 | 100000000 | | PHP | 1 | 100000000 | | PLN | 1 | 100000000 | | RON | 1 | 100000000 | | RUB | 1 | 100000000 | | SEK | 1 | 100000000 | | SGD | 1 | 100000000 | | THB | 1 | 100000000 | | TRY | 1 | 100000000 | | USD | 1 | 100000000 | | XOF | 1 | 100000000 | | ZAR | 1 | 100000000 | ## Customer payment flow [#customer-payment-flow] When a customer selects Neosurf at checkout, Pay.com sends the customer to a Neosurf-hosted page to complete payment. No card or personal information is required. ### Select Neosurf and proceed [#select-neosurf-and-proceed] The customer selects Neosurf on your checkout page and clicks **Pay**. Pay.com sends the customer to the Neosurf-hosted payment page. ### Choose a payment option on the Neosurf page [#choose-a-payment-option-on-the-neosurf-page] The Neosurf-hosted page presents the customer with two options: Neosurf-hosted payment page * **Use my Neosurf account**: the customer clicks **Log in** to authenticate with their myNeosurf account and pay from their account balance. This option supports higher spending limits than a single voucher. * **I have a Neosurf Ticket**: the customer enters their voucher PIN into the split code field (three segments) and clicks **Pay**. The page also shows a **Find my local store** banner for customers who don't have a voucher yet and want to purchase one at a nearby retail outlet before completing the transaction. ### Neosurf verifies the payment [#neosurf-verifies-the-payment] Neosurf checks the PIN and available balance. On success, it shows a confirmation screen. On failure (invalid PIN, expired voucher, or insufficient balance), it shows an error and the charge status moves to `failed`. No funds are captured. ### Return to your site [#return-to-your-site] After the customer submits payment, Pay.com waits for Neosurf to confirm the result. Once confirmed, the customer is redirected back to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Do not fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] **Account prerequisites:** * You must have an active Pay.com merchant account with Neosurf enabled. Contact your account manager to enable Neosurf for your account. * You do not need a separate Neosurf merchant account. Pay.com manages the Neosurf integration on your behalf. **Technical prerequisites:** * No additional SDK or library is required beyond the standard Pay.com integration. ### Licensing requirements [#licensing-requirements] As a regulated Electronic Money Institution (EMI), Pay.com requires merchants to hold local licenses in countries where this is a regulatory requirement. Licensing requirements vary by your license type: | License | Countries requiring a local license | | ------------------------------------- | ----------------------------------------------------- | | Anjouan | New Zealand, Canada (excluding Ontario) | | Tobique | Australia, New Zealand, Canada (excluding Ontario) | | Curacao | Australia, New Zealand, Canada (excluding Ontario) | | Kahnawake | Australia, New Zealand, Canada (excluding Ontario) | | MGA License / Isle of Man / Gibraltar | Various countries (confirm with your account manager) | Local licenses are also required in Spain, Italy, Belgium, Netherlands, Ontario, Switzerland, USA, and Mexico regardless of gaming license type. Regulatory requirements are subject to change. Confirm your licensing status with your account manager before going live. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Neosurf for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Neosurf charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ------------------------------------------------------------------------------------------ | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Neosurf hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, Neosurf declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Neosurf payment in full or in part. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/vouchers/neosurf/integrate-at-checkout): Accept Neosurf payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/vouchers/neosurf/integrate-at-checkout) You can accept Neosurf payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Neosurf in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Neosurf payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Neosurf. Before you start, ask your account manager to enable Neosurf for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Neosurf in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"neosurf"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "neosurf"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Neosurf and clicks **Pay**, Pay.com.js opens Neosurf in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Neosurf payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"neosurf"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Neosurf is available [#check-that-neosurf-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Neosurf button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const neosurf = methods.find((method) => method.paymentMethodType === 'neosurf') ``` ### Start the payment [#start-the-payment] When the customer selects Neosurf, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'neosurf'`. ```javascript try { await checkout.headless('neosurf') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Neosurf in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Neosurf payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Neosurf. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"neosurf"`. Pay.com passes `source_data.billing_details` to Neosurf to prefill its page for the customer. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "neosurf", "billing_details": { "address": { "country": "FR" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "neosurf" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Neosurf redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). Pay.com provides the test PINs you need to simulate each scenario below. Contact your Pay.com account manager if you haven't received them. ### Test scenarios [#test-scenarios] Each scenario uses one of the test PINs from your account manager. | Scenario | Test action | Expected result | | -------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | Successful payment | Enter a valid test PIN with sufficient balance | Charge `status: "succeeded"`. `charge.succeeded` webhook fires. SDK `onSuccess` callback fires. | | Insufficient balance | Enter a test PIN whose balance is lower than the charge amount | Charge `status: "failed"` and `charge.failed` webhook fires. SDK `onFailure` callback fires. | | Invalid PIN | Enter an incorrect or malformed PIN | Charge `status: "failed"` and `charge.failed` webhook fires. SDK `onFailure` callback fires. | | Expired voucher | Enter a test PIN for an expired voucher | Charge `status: "failed"` and `charge.failed` webhook fires. SDK `onFailure` callback fires. | # MyBank (/documentation/payment-methods/bank-transfers/mybank) MyBank is a pan-European [account-to-account (A2A)](/documentation/payment-methods/bank-transfers/overview) payment method designed by EBA Clearing for domestic and cross-border e-commerce. Customers select their bank on the MyBank payment page and pay directly from their bank account with a real-time bank transfer. ## Payment method properties [#payment-method-properties] MyBank takes EUR payments from customers in five European countries, with immediate confirmation. | Property | Details | | --- | --- | | Type | Bank transfer | | API type | `mybank` | | How customers pay | Redirect to the provider | | Customer countries | Belgium, Spain, France, Italy, Portugal | | Refunds | Full and partial | | Recurring payments | No | | Disputes | No | | Integrations | Headless checkout, API, Universal checkout | | Merchant countries | EU | | Payment confirmation | Immediate | | Settlement timing | T+3 (business days). Subject to Pay.com risk review | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | EUR | 1 | 99999999999 | ## Customer payment flow [#customer-payment-flow] When a customer selects MyBank at checkout, they authorize a bank transfer through their bank's online environment. ### Select MyBank and proceed [#select-mybank-and-proceed] The customer selects MyBank on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the MyBank payment page. ### Choose a bank [#choose-a-bank] The customer is redirected to the MyBank payment page, where they can search for their bank or select it from a list of common banks. The page shows a payment summary with the amount and merchant name. MyBank bank selection page showing a search field and a list of Italian banks including Intesa Sanpaolo, Unicredit, BPM, and Banca Sella. ### Authorize the payment [#authorize-the-payment] The customer logs in to their bank's online environment, reviews the payment details, and confirms the transaction. The payment is debited from their bank account in real time. ### Return to your site [#return-to-your-site] After the customer authorizes payment, the result is posted back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] Check these account and technical requirements before you add MyBank to your checkout. **Account prerequisites:** * You must have an active Pay.com merchant account with MyBank enabled. Contact your account manager to enable MyBank for your account. * You don't need a separate MyBank account. Pay.com manages the MyBank integration for you. * Your business must operate in an accepted industry. See [Accepted and prohibited industries](#accepted-and-prohibited-industries). **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The MyBank payment page is served externally. Make sure your Content Security Policy allows the redirect. ### Dashboard configuration [#dashboard-configuration] After your account manager enables MyBank for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a MyBank charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ----------------------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and MyBank hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, MyBank declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a MyBank payment in full or in part. Refunded funds return to the customer's bank account. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Accepted and prohibited industries [#accepted-and-prohibited-industries] MyBank is available to merchants in the following industries. Risk levels vary by industry. **Low risk:** * Retail * Travel * Skill games * Digital goods * Forex (regulated) * Dating **High risk (additional review may apply):** * Financial services (licensed) **Restricted (case by case):** * Gambling (licensed) **Prohibited:** * Pharma (prescription drugs) * Adult content and services * Cryptocurrency The payment method provider sets these industry restrictions, and they may change. Contact your account manager if you're unsure whether your business qualifies. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/bank-transfers/mybank/integrate-at-checkout): Accept MyBank payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/bank-transfers/mybank/integrate-at-checkout) You can accept MyBank payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays MyBank in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the MyBank payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to MyBank. Before you start, ask your account manager to enable MyBank for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays MyBank in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"mybank"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "mybank"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects MyBank and clicks **Pay**, Pay.com.js opens MyBank in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the MyBank payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"mybank"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that MyBank is available [#check-that-mybank-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your MyBank button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const mybank = methods.find((method) => method.paymentMethodType === 'mybank') ``` ### Start the payment [#start-the-payment] When the customer selects MyBank, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'mybank'`. ```javascript try { await checkout.headless('mybank') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens MyBank in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a MyBank payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to MyBank. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"mybank"`. Pay.com passes `source_data.billing_details` to MyBank to prefill its page for the customer. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "mybank", "billing_details": { "name": "Marco Rossi", "address": { "country": "IT" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "mybank" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, MyBank redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, you can verify each step up to the redirect to MyBank's page. | Step | Expected result | | ------------------------------------ | --------------------------------------------------------------------------------------------------------- | | Create a charge | `POST /v1/charges` with `source_data.type` set to `"mybank"` returns `status: "requires_authentication"`. | | Get the redirect URL | `POST /v1/sessions/authentication/linked` with the charge's `id` returns a `url`. | | Reach MyBank | Opening the `url` in a browser loads MyBank's page with the payment's amount. | | Display MyBank in Universal checkout | A payment session with `"mybank"` in `payment_method_types` displays MyBank in the form. | | Find MyBank with Headless checkout | `checkout.getPaymentMethods()` returns an entry with `paymentMethodType: "mybank"`. | # iDEAL (/documentation/payment-methods/bank-transfers/ideal) iDEAL is a Dutch [account-to-account (A2A)](/documentation/payment-methods/bank-transfers/overview) bank transfer payment method. Customers select their bank at checkout, then confirm the payment in their bank's online environment or banking app. No card details are involved. iDEAL is transitioning to **iDEAL | Wero** under the European Payments Initiative (EPI). iDEAL will merge into the Wero pan-European digital wallet, which lets Dutch customers pay in Germany, France, and Belgium using the same infrastructure. ## Payment method properties [#payment-method-properties] iDEAL takes EUR payments from customers in the Netherlands, with immediate confirmation. | Property | Details | | --- | --- | | Type | Bank transfer | | API type | `ideal` | | How customers pay | Redirect to the provider | | Customer countries | Netherlands | | Refunds | Full and partial | | Recurring payments | Yes | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | Belgium | | Payment confirmation | Immediate | | Settlement timing | T+3 (business days). Subject to Pay.com risk review | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | EUR | 1 | No maximum | ## Customer payment flow [#customer-payment-flow] When a customer selects iDEAL at checkout, they authorize a bank transfer through their bank's online environment. ### Select iDEAL and a bank [#select-ideal-and-a-bank] The customer selects iDEAL and their bank on your checkout page (or in Universal checkout's radio layout) and clicks **Pay**. The bank must be chosen before the payment is submitted, because the server-to-server API requires it in `source_data.ideal`. ### Go to the bank [#go-to-the-bank] Pay.com generates a redirect URL and sends the customer to the selected bank. ### Authorize the payment [#authorize-the-payment] The customer logs in to their bank's online environment and confirms the payment, or approves it directly in their banking app. The payment is debited from their bank account in real time. ### Return to your site [#return-to-your-site] After the customer authorizes payment, the result is posted back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] Check these account and technical requirements before you add iDEAL to your checkout. **Account prerequisites:** * You must have an active Pay.com merchant account with iDEAL enabled. Contact your account manager to enable iDEAL for your account. * You don't need a separate iDEAL or banking account. Pay.com manages the iDEAL integration for you. * Your business must operate in an accepted industry. See [Accepted and prohibited industries](#accepted-and-prohibited-industries). **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The iDEAL payment page is served externally. Make sure your Content Security Policy allows the redirect. ### Dashboard configuration [#dashboard-configuration] After your account manager enables iDEAL for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as an iDEAL charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ---------------------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and iDEAL hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, iDEAL declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund an iDEAL payment in full or in part. Refunded funds return to the customer's bank account. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Recurring payments [#recurring-payments] After a successful iDEAL payment, the charge's `payment_method` is a `pm_eu_bank_account_…` payment method (see [Verifying the charge after authentication](/documentation/payment-methods/bank-transfers/ideal/integrate-at-checkout#verifying-the-charge-after-authentication)). Collecting later payments with it, without redirecting the customer again, is enabled per account. Contact your account manager to enable recurring payments with iDEAL and to get the request flow that applies to your integration. ## Accepted and prohibited industries [#accepted-and-prohibited-industries] iDEAL is available to merchants in the following industries. Risk levels vary by industry. **Low risk:** * Retail * Travel * Skill games * Digital goods **High risk (additional review may apply):** * Financial services (licensed) * Forex (regulated) * Gambling (licensed) * Adult content and services * Dating services * Cryptocurrency **Prohibited:** * Pharma (prescription drugs) The list of accepted and prohibited industries may change based on regulatory requirements and partner agreements. Contact your account manager for the most current eligibility information. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/bank-transfers/ideal/integrate-at-checkout): Accept iDEAL payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/bank-transfers/ideal/integrate-at-checkout) You can accept iDEAL payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays iDEAL in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the iDEAL payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to iDEAL. Before you start, ask your account manager to enable iDEAL for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays iDEAL in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"ideal"` in `payment_method_types`. ```json { "amount": 8000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "ideal"] } ``` Amounts are in the currency's minor unit, so `8000` is €80.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). iDEAL appears only in Universal checkout's radio layout, so set `alternatives` to `'radio'`. When the customer selects iDEAL, the form also displays **iDEAL Bank**. ```javascript checkout.universal({ container: '#pay-com-checkout', alternatives: 'radio', }) ``` ### Handle the result [#handle-the-result] When the customer selects iDEAL and clicks **Pay**, Pay.com.js opens iDEAL in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the iDEAL payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"ideal"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that iDEAL is available [#check-that-ideal-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your iDEAL button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const ideal = methods.find((method) => method.paymentMethodType === 'ideal') ``` ### Collect required customer fields [#collect-required-customer-fields] iDEAL's entry has a `fields` array. Render an input for each field, and use each field's `id` as its key when you start the payment. | Field | Checkout label | Required | Format | | --- | --- | --- | --- | | `bic` | iDEAL Bank | Yes | One of 14 options | ### Start the payment [#start-the-payment] When the customer selects iDEAL, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'ideal'` and the collected field values. ```javascript try { await checkout.headless('ideal', { bic: 'INGBNL2A' }) } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens iDEAL in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, an iDEAL payment takes four steps: collect the customer's choice, create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to iDEAL. ### Collect the customer's choice [#collect-the-customers-choice] The API has no call that lists iDEAL's choices, so build your own selector and send the selected value in `source_data.ideal.bic`. The table lists the values Pay.com's checkout offers today. The list changes as iDEAL changes, and with Headless checkout, `checkout.getPaymentMethods()` returns the current one. | iDEAL Bank | Value | | -------------------------- | ---------- | | Rabobank | `RABONL2U` | | ABN Amro | `ABNANL2A` | | Van Lanschot | `FVLBNL22` | | Triodos Bank | `TRIONL2U` | | ING Bank | `INGBNL2A` | | SNS Bank | `SNSBNL2A` | | ASN Bank | `ASNBNL21` | | RegioBank | `RBRBNL21` | | Knab | `KNABNL2H` | | bunq B.V | `BUNQNL2A` | | Revolut | `REVOLT21` | | Yoursafe | `BITSNL2A` | | N26 | `NTSBDEB1` | | Nationale-Nederlanden Bank | `NNBANL2G` | ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"ideal"`. `source_data.ideal` contains iDEAL-specific fields. Pay.com passes `source_data.billing_details` to iDEAL to prefill its page for the customer. ```json { "amount": 8000, "currency": "eur", "source_data": { "type": "ideal", "ideal": { "bic": "INGBNL2A" }, "billing_details": { "name": "Jan de Vries", "address": { "country": "NL" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 8000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "ideal" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, iDEAL redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). iDEAL must be enabled on your sandbox account before you can test. Contact your account manager if it isn't enabled yet. ### Test BIC for server-to-server testing [#test-bic-for-server-to-server-testing] In the live environment, you pass the real BIC of the customer's bank (for example, `INGBNL2A` for ING). In the sandbox, use the test BIC `TESTNL2A`. This is not a real bank. It routes to the **iDEAL | Wero test simulator**, which lets you choose the payment outcome (success, failure, cancellation, and so on) without interacting with a real bank. Use `TESTNL2A` in `source_data.ideal.bic` for all server-to-server test charges: ```json "ideal": { "bic": "TESTNL2A" } ``` The test BIC also works with Headless checkout. Pass it as `checkout.headless('ideal', { bic: 'TESTNL2A' })`. ### Sandbox behavior [#sandbox-behavior] In the sandbox with the `TESTNL2A` BIC (Headless checkout or server-to-server), Pay.com redirects to the iDEAL | Wero test simulator. The simulator shows the **iDEAL | Wero** logo and asks "Which test simulation to run?" with five options: * **Success**: simulates a completed payment * **Cancellation**: simulates the customer canceling after login * **Cancellation before login**: simulates the customer canceling before authenticating with their bank * **Expiration**: simulates the payment session expiring * **Failure**: simulates a bank-side failure After you select an outcome, the behavior depends on the scenario. For **Success**, **Cancellation**, **Cancellation before login**, and **Failure**, Pay.com shows an "Authorising your payment" processing screen and then redirects the customer to your `return_url`. For **Expiration**, the simulator shows "The transaction is expired" with a **Go back to iDEAL** button and redirects automatically after a countdown. * **SDK integration:** Pay.com.js opens the test simulator in a window over your page. After the simulation completes, Pay.com shows an "Authorising your payment" screen, and the SDK fires `onSuccess`, `onPending`, or `onFailure` on your page. * **Server-to-server integration:** the linked authentication session returns a redirect `url`. Opening this URL in a browser loads the test simulator as a full page. ### Test scenarios [#test-scenarios] Run each simulation and check that your integration handles the resulting charge status and webhook event. | Scenario | Test action | Expected result | | ------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Successful payment | Click **Success** | Charge moves to `succeeded`. `charge.succeeded` webhook fires. `payment_method_details.type` changes to `eu_bank_account` with `source: "ideal"`. | | Customer cancels | Click **Cancellation** | Charge moves to `failed` with `failure_code: "customer_cancellation"`. `charge.failed` webhook fires. | | Cancel before login | Click **Cancellation before login** | Charge moves to `failed` with `failure_code: "customer_cancellation"`. `charge.failed` webhook fires. | | Session expires | Click **Expiration** | The simulator shows "The transaction is expired" and redirects back. The charge stays in `requires_authentication` until the Pay.com authentication session expires, then moves to `failed` with `failure_code: "time_out"`. The session's `duration` is 60 minutes by default. | | Bank failure | Click **Failure** | Charge moves to `failed` with `failure_code: "do_not_honour"`. `charge.failed` webhook fires. | **Expiration compared with other failure scenarios:** Cancellation and Failure update the charge status to `failed` immediately. Expiration works differently. It simulates the bank-side session timing out, but the Pay.com authentication session remains open. The charge stays in `requires_authentication` until the Pay.com session itself expires, at which point it moves to `failed`. Don't treat `requires_authentication` as a final state. Always wait for a `charge.succeeded` or `charge.failed` webhook before updating your order status. ### Verifying the charge after authentication [#verifying-the-charge-after-authentication] After the customer completes the test simulator and is redirected to your `return_url`, retrieve the charge with [`GET /v1/charges/{id}`](/api-reference/endpoints/charges/get-charge) to verify its final state: ```bash curl -X GET "https://api.sandbox.pay.com/v1/charges/chrg_764827872052382720" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "chrg_764827872052382720", "resource": "charge", "amount": 8000, "amount_human_readable": "80.00", "currency": "eur", "status": "succeeded", "payment_method": "pm_eu_bank_account_764830713110331392", "payment_method_details": { "type": "eu_bank_account", "eu_bank_account": { "account_holder_name": "Jan de Vries", "country": "NL", "currency": "EUR", "last4": "9868", "source": "ideal" } }, "test_mode": true } ``` After successful authentication, `payment_method_details.type` changes from `"ideal"` to `"eu_bank_account"` and a `pm_eu_bank_account_...` payment method ID is assigned. This is expected. iDEAL is the payment flow, and `eu_bank_account` is the resulting payment instrument. # Paysafecard (/documentation/payment-methods/vouchers/paysafecard) Paysafecard lets customers pay online with a 16-digit prepaid voucher PIN bought at a retail outlet or online, or from a my paysafecard account balance. Every transaction is prepaid, confirms immediately, and carries no chargebacks. paysafecard is issued by Paysafe Prepaid Services Limited (regulated by the Central Bank of Ireland) in the EEA, and by Prepaid Services Company Limited (regulated by the FCA, FRN 900021) in the UK. ## Payment method properties [#payment-method-properties] Customers in Europe, the Americas, Australia, and New Zealand can pay with paysafecard, with transaction limits that vary by country. | Property | Details | | --- | --- | | Type | Voucher | | API type | `paysafecard` | | How customers pay | In-page | | Customer countries | Argentina, Australia, Austria, Belgium, Brazil, Canada, Croatia, Cyprus, Czechia, Denmark, Finland, France, Georgia, Germany, Gibraltar, Greece, Hungary, Ireland, Italy, Liechtenstein, Lithuania, Luxembourg, Malta, Mexico, Netherlands, New Zealand, Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, Switzerland, United Kingdom, Uruguay | | Currencies | ARS, AUD, BRL, CAD, CHF, CZK, DKK, EUR, GBP, HUF, INR, MXN, NOK, NZD, PLN, RON, SEK, TRY, USD, ZAR | | Refunds | Not supported | | Recurring payments | No | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | Global | | Settlement currencies | AUD, BRL, CAD, CHF, CZK, DKK, EUR, GBP, HUF, MXN, NOK, NZD, PLN, RON, SEK, TRY, USD, ZAR | | Payment confirmation | Immediate | ## Customer payment flow [#customer-payment-flow] When a customer selects paysafecard at checkout, Pay.com opens paysafecard's payment page, where the customer enters their voucher PIN. No card or bank information is required. ### Select paysafecard [#select-paysafecard] The customer selects paysafecard on your checkout page and clicks or taps to proceed. ### Enter the PIN [#enter-the-pin] paysafecard's payment page opens. The customer types their 16-digit PIN from their physical or digital voucher, or logs in to their my paysafecard account to use a stored balance. The my paysafecard account is a digital wallet that lets customers pool the balance of multiple vouchers and pay amounts that exceed the value of a single PIN. ### Instant verification [#instant-verification] paysafecard verifies the PIN and available balance in real time. If the voucher has sufficient funds, the payment is authorized immediately. If the PIN is invalid, expired, or has insufficient balance, the page shows an error and the customer can try another PIN. If they give up, the charge stays in `requires_authentication`. ### Payment complete [#payment-complete] The pop-up closes and the customer sees a confirmation on your checkout page. After the payment completes, the charge is immediately captured. There is no separate authorization-and-capture step. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication`. Do not fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] **Account prerequisites:** * You must have an active Pay.com merchant account with paysafecard enabled. Your account manager enables it on your account, and you then show it at checkout in your dashboard (see [Dashboard configuration](#dashboard-configuration)). * You don't need a separate paysafecard merchant account. Pay.com manages the paysafecard integration on your behalf. **Technical prerequisites:** * No additional SDK or library is required beyond the standard Pay.com integration. * The paysafecard PIN entry pop-up is served from paysafecard's servers. Make sure your Content Security Policy allows `*.paysafecard.com` in `frame-src`. ### Dashboard configuration [#dashboard-configuration] After your account manager enables paysafecard for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Paysafecard charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | -------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Paysafecard hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, or Paysafecard declined the payment | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Transaction limits by country [#transaction-limits-by-country] Transaction limits and available voucher denominations vary by country and currency. Amounts in this table are in major units (for example, `10` is €10.00). The **Flex range** column shows the minimum and maximum transaction amounts where paysafecard Flex is available. Where the Flex range is "None", only fixed voucher denominations are accepted. | Country | Currency | Flex range | Voucher denominations | | -------------- | -------- | --------------- | ---------------------------------------------- | | Argentina | ARS | None | 1,000 / 2,500 / 4,000 / 5,000 / 8,000 | | Australia | AUD | None | 10 / 20 / 50 / 100 | | Austria | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Belgium | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Canada | CAD | None | 10 / 30 / 50 / 100 / 150 / 250 | | Croatia | EUR | 10 to 150 | 5 / 10 / 25 / 50 / 75 / 100 | | Cyprus | EUR | 5 to 150 | 5 / 10 / 25 / 50 / 100 | | Czechia | CZK | 200 to 3,500 | 200 / 500 / 1,200 / 2,500 | | Denmark | DKK | 60 to 1,100 | 100 / 300 / 500 / 1,000 | | Finland | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | France | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Germany | EUR | 10 to 150 | 5 / 10 / 15 / 20 / 25 / 30 / 50 / 100 / 150 | | Gibraltar | GBP | None | 10 / 25 / 50 / 75 / 100 | | Greece | EUR | 10 to 150 | 5 / 10 / 25 / 50 / 100 | | Hungary | HUF | 5,000 to 50,000 | 2,000 / 5,000 / 10,000 / 15,000 / 25,000 | | Ireland | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Italy | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Liechtenstein | CHF | None | 25 / 75 / 150 | | Lithuania | EUR | 10 to 150 | 5 / 10 / 25 / 50 / 100 | | Luxembourg | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Malta | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Mexico | MXN | None | 100 / 250 / 500 / 1,000 | | Netherlands | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | New Zealand | NZD | None | 10 / 20 / 50 / 100 / 200 | | Norway | NOK | 100 to 1,650 | 100 / 250 / 450 / 500 / 1,000 | | Poland | PLN | 40 to 600 | 20 / 30 / 50 / 100 / 200 | | Portugal | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Romania | RON | 25 to 600 | 25 / 50 / 100 / 200 / 300 | | Slovakia | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Slovenia | EUR | None | 10 / 25 / 50 / 100 | | Spain | EUR | 10 to 150 | 10 / 25 / 50 / 100 | | Sweden | SEK | 100 to 1,650 | 100 / 250 / 500 / 1,000 | | Switzerland | CHF | 10 to 250 | 25 / 75 / 150 | | United Kingdom | GBP | None | 10 / 25 / 40 / 50 / 75 / 100 / 125 / 150 / 175 | | Uruguay | USD | None | 20 / 50 / 100 | These limits cover only the customer countries and processing currencies that Pay.com supports for paysafecard (see [Payment method properties](#payment-method-properties)). For limits in Brazil and Georgia, contact your account manager. Limits shown are from the paysafecard Availability of Products document (January 2026). Actual limits may vary based on your merchant configuration. Contact your account manager to confirm the limits that apply to your account. ## Refunds [#refunds] You can't refund a Paysafecard payment through Pay.com. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/vouchers/paysafecard/integrate-at-checkout): Accept Paysafecard payments with Pay.com.js or from your server, and test them in the sandbox. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/vouchers/paysafecard/integrate-at-checkout) You can accept Paysafecard payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Paysafecard in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Paysafecard payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Paysafecard. Before you start, ask your account manager to enable Paysafecard for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Paysafecard in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"paysafecard"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "paysafecard"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Paysafecard and clicks **Pay**, Pay.com.js opens Paysafecard in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Paysafecard payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"paysafecard"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Paysafecard is available [#check-that-paysafecard-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Paysafecard button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const paysafecard = methods.find((method) => method.paymentMethodType === 'paysafecard') ``` ### Start the payment [#start-the-payment] When the customer selects Paysafecard, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'paysafecard'`. ```javascript try { await checkout.headless('paysafecard') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Paysafecard in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Paysafecard payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Paysafecard. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"paysafecard"`. Paysafecard requires the customer's country in `source_data.billing_details.address.country`. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "paysafecard", "billing_details": { "address": { "country": "DE" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "paysafecard" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Paysafecard redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled or declined payment. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). ### Sandbox behavior [#sandbox-behavior] In the sandbox, Pay.com opens an **Alternate Payments Redirect Simulator** instead of the real paysafecard PIN entry page. The simulator displays the paysafecard logo, a pre-filled Payment ID, and a **Payment Status** dropdown that lets you choose the outcome before submitting. * **Pay.com.js**: the simulator opens in a window over your checkout page. * **Server-to-server integration**: the simulator opens as a full-page redirect at the `url` returned by the linked authentication session. In the live environment, the customer sees paysafecard's real PIN entry page instead of the simulator. ### Simulator payment statuses [#simulator-payment-statuses] The simulator provides five payment statuses to test different outcomes: | Payment status | Pay.com.js callback | Expected result | | -------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `SUCCESS` | `onSuccess` | Charge moves to `succeeded`. `charge.succeeded` webhook fires. | | `AUTHORIZED` | `onSuccess` | Charge moves to `succeeded`. Simulates a pre-authorized payment that is then captured. | | `CANCEL` | `onFailure` | Charge moves to `failed`. `charge.failed` webhook fires. Error message: "Something went wrong during paysafecard payment process". | | `EXPIRED` | `onFailure` | Charge moves to `failed`. `charge.failed` webhook fires. Error message: "Something went wrong during paysafecard payment process". | | `REDIRECTED` | Neither | Charge stays in `requires_authentication`. Simulates the customer being redirected but not completing payment. | ### Test scenarios [#test-scenarios] Run each scenario in the sandbox and check the charge status, the webhook, and the Pay.com.js callback. | Scenario | Test action | Expected result | | ------------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | Successful payment | Select `SUCCESS` in the simulator and click **Submit** | Charge `status: "succeeded"`. `charge.succeeded` webhook fires. Pay.com.js calls `onSuccess`. | | Customer cancels | Select `CANCEL` in the simulator and click **Submit** | Charge `status: "failed"`. `charge.failed` webhook fires. Pay.com.js calls `onFailure`. | | Expired voucher | Select `EXPIRED` in the simulator and click **Submit** | Charge `status: "failed"`. `charge.failed` webhook fires. Pay.com.js calls `onFailure`. | | Customer abandons | Close the simulator without submitting (close the window with Pay.com.js, or navigate away when you test from your server) | Charge stays in `requires_authentication`. With Pay.com.js, closing the window calls `onFailure`. | | Missing country | Omit `billing_details.address.country` from the charge request | Request rejected immediately with `400 invalid_parameters`. No charge is created. | # Trustly (/documentation/payment-methods/bank-transfers/trustly) Trustly is an open banking [payment method](/documentation/payment-methods/bank-transfers/overview) that lets customers pay directly from their bank account without sharing card details. Through Pay.com, it's available to UK merchants for GBP payments from UK customers, who don't need to install an app or create an account. ## Payment method properties [#payment-method-properties] Trustly takes GBP payments from customers in the United Kingdom and confirms them immediately. | Property | Details | | --- | --- | | Type | Bank transfer | | API type | `trustly` | | How customers pay | In-page or redirect | | Redirects | Mobile only (desktop stays in-page) | | Customer countries | United Kingdom | | Currencies | GBP | | Refunds | Full and partial | | Recurring payments | Yes | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | United Kingdom | | Payment confirmation | Immediate | ## Customer payment flow [#customer-payment-flow] When a customer selects Trustly at checkout, they authorize a bank transfer through their bank's online environment. ### Select Trustly and proceed [#select-trustly-and-proceed] The customer selects Trustly on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the Trustly payment page. ### Choose a bank [#choose-a-bank] The customer selects their bank from the list of supported banks on the Trustly payment page. ### Authorize the payment [#authorize-the-payment] The customer logs in to their bank's online banking environment, selects an account, and confirms the payment with a one-time code. The exact steps vary by bank. The payment is debited from their bank account in real time. ### Return to your site [#return-to-your-site] After the customer authorizes payment, the result is posted back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] Trustly works with the standard Pay.com integration after your account manager enables it for your account. **Account prerequisites:** * You must have an active Pay.com merchant account with Trustly enabled. Contact your account manager to enable Trustly for your account. * You don't need a separate Trustly account. Pay.com manages the Trustly integration for you. * Your business must operate in an industry that Trustly accepts. Contact your account manager to confirm eligibility. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The Trustly payment page is served externally. Make sure your Content Security Policy allows the redirect. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Trustly for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods) for the steps, and ask your account manager to enable Trustly if it isn't listed. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Trustly charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ------------------------------------------------------------------------------------------ | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Trustly hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, Trustly declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Trustly payment in full or in part. Refunded funds return to the customer's bank account. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Recurring payments [#recurring-payments] Trustly supports recurring payments through a Direct Debit mandate. The customer authorizes the mandate once during an initial payment. Pay.com stores it as a `pm_trustly_…` payment method, which you can then charge without redirecting the customer again. Recurring payments must be enabled on your account by your account manager. See [Set up recurring payments](/documentation/payment-methods/bank-transfers/trustly/set-up-recurring-payments) for the full integration guide. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/bank-transfers/trustly/integrate-at-checkout): Accept Trustly payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/bank-transfers/trustly/integrate-at-checkout) You can accept Trustly payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Trustly in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Trustly payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Trustly. Before you start, ask your account manager to enable Trustly for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Trustly in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"trustly"` in `payment_method_types`. ```json { "amount": 5000, "currency": "gbp", "customer_reference_id": "cust-001", "payment_method_types": ["card", "trustly"] } ``` Amounts are in the currency's minor unit, so `5000` is £50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Trustly and clicks **Pay**, Pay.com.js opens Trustly in a window over your page on desktop, and in a new tab on mobile. * In a window over your page: if the customer closes it, Pay.com.js calls `onFailure`. * In a new tab: your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Trustly payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"trustly"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Trustly is available [#check-that-trustly-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Trustly button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const trustly = methods.find((method) => method.paymentMethodType === 'trustly') ``` ### Start the payment [#start-the-payment] When the customer selects Trustly, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'trustly'`. ```javascript try { await checkout.headless('trustly') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Trustly in a window over your page on desktop, and in a new tab on mobile. * In a window over your page: if the customer closes it, Pay.com.js calls `onFailure`. * In a new tab: your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Trustly payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Trustly. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"trustly"`. Pay.com passes `source_data.billing_details` to Trustly to prefill its page for the customer. ```json { "amount": 5000, "currency": "gbp", "source_data": { "type": "trustly", "billing_details": { "name": "John Smith", "address": { "country": "GB" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "gbp", "status": "requires_authentication", "payment_method_details": { "type": "trustly" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Trustly redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). Trustly must be enabled on your sandbox account before you can test. Contact your account manager if it isn't enabled yet. ### Trustly test simulator [#trustly-test-simulator] In the sandbox, all Trustly payments redirect to the **Trustly test simulator** at `checkout.test.trustly.com`. The simulator presents three test banks: | Bank | Flow | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Barclays** | Full simulated flow: login, one-time code, account selection, and payment confirmation with a second one-time code. Includes **Set order options** to choose test scenarios. | | **HSBC UK** | Same flow as Barclays: login, one-time code, account selection, and payment confirmation with a second one-time code. | | **Mock Barclays** | Simplified flow through a QR code scan on your phone, which opens a mock bank redirect page at `mock.public.sbx.trustly.cloud`. Enter any credentials to complete. Includes **Set order options**. | Barclays and HSBC UK use the same simulated banking flow. This is the closest experience to what your customers see in the live environment. ### Select a bank [#select-a-bank] Choose **Barclays** or **HSBC UK** from the bank list. You're taken to the Trustly test system page. This page explains that all transactions are fictional and banks are simulated. To test specific failure scenarios, check **Set order options** before clicking **Continue**. See the [test scenarios](#test-scenarios) section for the options. ### Log in [#log-in] Enter any value in the **Login ID** field (for example, `1234`) and click **Continue**. ### Enter the first one-time code [#enter-the-first-one-time-code] The simulator displays a one-time code. Enter it in the field below and click **Continue**. ### Select an account [#select-an-account] Choose **Checking account** or **Savings account** and click **Continue**. ### Confirm the payment [#confirm-the-payment] Review the amount and selected account. Click **Continue** to proceed. ### Enter the second one-time code [#enter-the-second-one-time-code] The simulator displays a second one-time code along with the account number and amount. Enter the code and click **Confirm payment**. The customer is redirected to your `return_url`. Mock Barclays uses a simplified flow that authenticates through a QR code scan on your phone. This is faster for repeated testing. ### Select Mock Barclays [#select-mock-barclays] Choose **Mock Barclays** from the bank list. You're taken to the Trustly test system page. To test specific failure scenarios, check **Set order options** before clicking **Continue**. See the [test scenarios](#test-scenarios) section for the options. ### Scan the QR code [#scan-the-qr-code] A QR code appears on the desktop screen. Scan it with your phone to open the mock bank redirect page at `mock.public.sbx.trustly.cloud`. ### Complete the mock bank login [#complete-the-mock-bank-login] On your phone, enter any credentials in the mock bank form and tap **Login**. The phone shows "Bank session complete" and asks you to switch to your desktop to finish your order. On the desktop, the payment processes and the customer is redirected to your `return_url`. ### Test scenarios [#test-scenarios] When you check **Set order options** on the Trustly test system page, you can pick one of these test scenarios. They're available for Barclays and Mock Barclays. | Option | Description | Charge status | Failure code | | ------------------------------------------- | -------------------------------------------- | ------------- | -------------------------- | | **No test, process as normal** (default) | Completes the payment normally | `succeeded` | None | | **D4.** Fail payment before it is confirmed | Simulator shows "Signing is unavailable" | `failed` | `authentication_abandoned` | | **Customer closes window** (click X) | Customer abandons the flow before completing | `failed` | `authentication_abandoned` | For most integration testing, use the default **No test, process as normal** option to verify the happy path. Use **D4** to test your failure handling. ### Verifying the charge after authentication [#verifying-the-charge-after-authentication] After the customer completes the test simulator and is redirected to your `return_url`, retrieve the charge to verify its final state: ```bash curl -X GET "https://api.sandbox.pay.com/v1/charges/chrg_770257246822072320" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "chrg_770257246822072320", "resource": "charge", "amount": 5000, "amount_human_readable": "50.00", "currency": "gbp", "status": "succeeded", "payment_method": "pm_trustly_770258754074576896", "payment_method_details": { "trustly": { "account_number": "4081810167", "bank": "Barclays", "clearing_house": "UNITED_KINGDOM", "descriptor": "**926819", "last4": "6819", "name": "John Mockington" }, "type": "trustly" }, "test_mode": true } ``` After successful authentication, `payment_method_details` is populated with Trustly-specific fields, including the customer's `bank` name, `account_number`, and `clearing_house`. The `payment_method` ID uses the format `pm_trustly_...`. # Set up recurring payments (/documentation/payment-methods/bank-transfers/trustly/set-up-recurring-payments) When a customer completes a Trustly payment with recurring enabled, they authorize a **Direct Debit Instruction** with their bank. This mandate gives you permission to charge their bank account on an ongoing basis without redirecting them again. Contact your account manager to enable recurring payments with Trustly on your account before starting this integration. ## Before you begin [#before-you-begin] To set up Trustly recurring payments: * The mandate must be set up through a **payment session**. * The customer's **email address** is required in `billing_details`. Without it, the mandate cannot be created. * During the Trustly redirect, the customer authorizes a **Direct Debit Instruction**. This is a UK-regulated authorization that covers future charges. ## Set up the initial payment [#set-up-the-initial-payment] The first payment sets up the Direct Debit mandate and gives you a stored payment method for later charges. ### Create a payment session with mandate [#create-a-payment-session-with-mandate] On your server, send a `POST` request to [`/v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) with `setup_future_usage` set to `"off_session"`. Include the customer's email in `billing_details`. Amounts are in minor units, so `2500` is £25.00. ```json { "currency": "gbp", "amount": 2500, "customer_reference_id": "cust-001", "payment_method_types": ["trustly"], "setup_future_usage": "off_session", "return_url": "https://your-site.com/payment/complete", "billing_details": { "email": "customer@example.com", "name": "John Smith", "address": { "country": "GB" } } } ``` ```json { "id": "ps_771387817447132160", "resource": "payment_session", "amount": 2500, "amount_human_readable": "25.00", "currency": "gbp", "status": "open", "client_secret": "eyJhbGciOiJIUzUxMiJ9...", "customer": "cust_771387817447132161", "customer_reference_id": "cust-001", "payment_method_types": ["trustly"], "setup_future_usage": "off_session", "billing_details": { "email": "customer@example.com", "name": "John Smith", "address": { "country": "GB" } }, "created": "2026-10-30T15:02:13.752Z", "test_mode": true } ``` Pass the `client_secret` to your frontend to initialize the SDK. ### Customer authorizes the Direct Debit [#customer-authorizes-the-direct-debit] Use the SDK to render the checkout. When the customer selects Trustly, they are redirected to the Trustly payment page where they select their bank and authorize a Direct Debit Instruction. This authorization covers both the initial payment and future charges. ```javascript checkout.universal({ container: '#pay-com-checkout', }) ``` The customer selects their bank, logs in, and confirms the Direct Debit. After authorization, the customer is returned to your site, and the SDK fires `onSuccess` (or `onPending` if Trustly has not confirmed the payment yet, in which case wait for the `charge.succeeded` webhook event). ### Store the payment method [#store-the-payment-method] `onSuccess` gives the charge in `transaction` and the stored method in `paymentMethod` (`pm_trustly_...`). Store the payment method ID against the customer in your database. You will need this for future recurring charges. Retrieving the charge from your server is optional. Its `payment_method` is the same ID. Use the charge ID from `transaction`. ```bash curl -X GET "https://api.sandbox.pay.com/v1/charges/chrg_771388479263813632" \ -u ':sk-pay-com-sandbox-…' ``` ```json { "id": "chrg_771388479263813632", "resource": "charge", "amount": 2500, "amount_human_readable": "25.00", "currency": "gbp", "status": "succeeded", "payment_method": "pm_trustly_771388487130677248", "payment_method_details": { "setup_future_usage": "off_session", "type": "trustly", "trustly": { "account_number": "4469581408", "bank": "Barclays", "bank_code": "BARC", "clearing_house": "UNITED_KINGDOM", "country": "GB", "descriptor": "**** *5803", "last4": "5803", "name": "John Smith" } }, "test_mode": true } ``` ## Create recurring charges [#create-recurring-charges] Once you have the `pm_trustly_...` ID, you can use it to charge the customer without them being present. Trigger each charge using the stored `pm_trustly_...` ID with `"off_session": true`. See the [recurring charges guide](/payments/saved-cards/recurring-charges) for the full request format, response handling, and webhook events. Subscriptions take card payment methods (`pm_card_…`) only, so you can't attach a `pm_trustly_...` ID to a subscription. ## Requirements [#requirements] A Trustly mandate needs a payment session with `setup_future_usage` set to `"off_session"` and the customer's email. | Requirement | Details | | ------------------------ | -------------------------------------------------------------------------------------- | | **Integration path** | Payment session | | **`setup_future_usage`** | Must be `"off_session"`. Set on the payment session, not in `source_data`. | | **Customer email** | Required in `billing_details.email`. The mandate cannot be created without it. | | **Mandate type** | UK Direct Debit Instruction. The customer authorizes this during the Trustly redirect. | # UPI (/documentation/payment-methods/bank-transfers/upi) Unified Payments Interface (UPI) is India's real-time bank transfer system, built by the National Payments Corporation of India (NPCI). Customers pay from a bank account linked to their UPI app, by entering their UPI ID or scanning a QR code, with no card details. ## Payment method properties [#payment-method-properties] UPI takes payments in GBP and USD from customers in India and confirms them immediately. | Property | Details | | --- | --- | | Type | Bank transfer | | API type | `upi` | | How customers pay | Redirect to the provider | | Customer countries | India | | Refunds | Full and partial | | Recurring payments | Yes | | Authorize and capture later | Yes | | Disputes | Yes | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | United Arab Emirates, Australia, Bangladesh, Belgium, Canada, Switzerland, Czech Republic, Germany, Denmark, Spain, Finland, Fiji, France, United Kingdom, Georgia, Greece, Hungary, Ireland, Israel, Iceland, Italy, Japan, South Korea, Kuwait, Kazakhstan, Luxembourg, Morocco, Maldives, Malaysia, Netherlands, Norway, New Zealand, Philippines, Poland, Portugal, Qatar, Serbia, Saudi Arabia, Sweden, Singapore, Thailand, United States, Vietnam, South Africa | | Settlement currencies | EUR, GBP, USD | | Payment confirmation | Immediate | | Settlement timing | T+2 (business days). Subject to Pay.com risk review | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | GBP | 1 | 100000 | | USD | 1 | 100000 | ## Customer payment flow [#customer-payment-flow] When a customer selects UPI at checkout, they authorize a bank transfer using their UPI-enabled app or by entering their UPI ID. ### Select UPI and proceed [#select-upi-and-proceed] The customer selects UPI on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the UPI payment page. ### Choose payment method [#choose-payment-method] The customer can pay in one of two ways: * **QR code:** A QR code is displayed on screen. The customer opens their UPI app (such as Google Pay, PhonePe, or Paytm) and scans the code. * **UPI ID:** The customer enters their UPI ID (for example, `name@upi`) to receive a payment request in their UPI app. ### Authorize the payment [#authorize-the-payment] The customer opens the payment request in their UPI app and enters their UPI PIN to authorize the bank transfer. The payment is debited from their linked bank account in real time. ### Return to your site [#return-to-your-site] After the customer authorizes payment, the result is posted back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication`. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] UPI works with the standard Pay.com integration after your account manager enables it for your account. **Account prerequisites:** * You must have an active Pay.com merchant account with UPI enabled. Contact your account manager to enable UPI for your account. * You don't need a separate UPI or NPCI account. Pay.com manages the UPI integration for you. * Your business must operate in an accepted industry. See the [accepted and prohibited industries](#accepted-and-prohibited-industries) section below for details. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The UPI payment page is served externally. Make sure your Content Security Policy allows the redirect. * UPI charges require `billing_details.address.country` in `source_data`. Depending on your account configuration, the API can also require the customer's full name, and sometimes their email, phone, and full address (line, city, state, and postal code), so send every billing detail you have. ### Dashboard configuration [#dashboard-configuration] After your account manager enables UPI for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods) for the steps, and ask your account manager to enable UPI if it isn't listed. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a UPI charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ------------------------------------------------------------------ | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and UPI hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, or UPI declined the payment | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a UPI payment in full or in part. Refunded funds return to the customer's linked bank account. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Disputes [#disputes] UPI transactions carry chargeback risk. Customers can raise disputes through their bank or UPI app, and the dispute reaches Pay.com through the payment network. UPI's payment assurance feature adds a layer of protection for merchants, but doesn't eliminate dispute risk. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. Dispute simulation isn't available for UPI in the sandbox. [`POST /v1/charges/{transaction_id}/simulate/dispute`](/api-reference/endpoints/disputes/simulate-dispute) doesn't accept UPI charges. UPI transactions can receive disputes in the live environment, but you can't test the dispute flow in the sandbox. Make sure your webhook handler processes `dispute.open` events before you go live. ## Accepted and prohibited industries [#accepted-and-prohibited-industries] UPI is available to merchants in the following industries: * Retail * Travel * Skill games * Digital goods * Pharma The following industries are **not supported**: * Financial services (licensed) * Forex (regulated) * Gambling (licensed) * Adult content and services * Dating services * Cryptocurrency The lists of accepted and prohibited industries may change with regulatory requirements and partner agreements. Contact your account manager for current eligibility. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/bank-transfers/upi/integrate-at-checkout): Accept UPI payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/bank-transfers/upi/integrate-at-checkout) You can accept UPI payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays UPI in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the UPI payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to UPI. Before you start, ask your account manager to enable UPI for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays UPI in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"upi"` in `payment_method_types`. ```json { "amount": 5000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method_types": ["card", "upi"] } ``` Amounts are in the currency's minor unit, so `5000` is $50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects UPI and clicks **Pay**, Pay.com.js opens UPI in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the UPI payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"upi"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that UPI is available [#check-that-upi-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your UPI button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const upi = methods.find((method) => method.paymentMethodType === 'upi') ``` ### Start the payment [#start-the-payment] When the customer selects UPI, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'upi'`. ```javascript try { await checkout.headless('upi') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens UPI in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a UPI payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to UPI. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"upi"`. UPI requires the customer's country in `source_data.billing_details.address.country`. Depending on your account configuration, it can also require the customer's full name, and sometimes their email, phone, and full address (line, city, state, and postal code), so send every billing detail you have. ```json { "amount": 5000, "currency": "usd", "source_data": { "type": "upi", "billing_details": { "name": "Rahul Sharma", "address": { "country": "IN" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "usd", "status": "requires_authentication", "payment_method_details": { "type": "upi" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, UPI redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled or declined payment. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). UPI must be enabled on your sandbox account before you can test. Contact your account manager if it isn't enabled yet. ### Sandbox behavior [#sandbox-behavior] In the sandbox, Pay.com opens a mock authenticator instead of the real UPI payment page. The mock authenticator shows the payment details and two buttons: **Approve** and **Deny**. * **SDK integration:** the mock authenticator opens in a new tab. After you click **Approve** or **Deny**, a screen appears while Pay.com processes the result, and Pay.com.js then reports the outcome on your page. * **Server-to-server integration:** the linked authentication session returns a redirect `url`. Opening this URL in a browser loads the mock authenticator as a full page. The mock authenticator displays these details: * **Authentication required for** (amount and currency) * **Consumer** (the customer name from `billing_details.name`) * **Payment ID** (the internal charge reference) * **Payment method: UPI** In the live environment (sessions and API calls on `https://api.pay.com/v1` with an `sk-pay-com-live-` key), the customer is redirected to the real UPI payment page to scan a QR code or enter their UPI ID and authorize the payment. ### Test scenarios [#test-scenarios] Use the mock authenticator's buttons to simulate each outcome. | Scenario | Test action | Expected result | | ------------------ | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Successful payment | Click **Approve** in the mock authenticator | "Authorising your payment" processing screen appears, then charge moves to `succeeded`. `charge.succeeded` webhook fires. SDK `onSuccess` callback fires. | | Failed payment | Click **Deny** in the mock authenticator | "Authorising your payment" processing screen appears, then charge moves to `failed`. `charge.failed` webhook fires. SDK `onFailure` callback fires with the message: "Your payment method has been declined: The payment was declined by your bank. Please retry or use a different payment method." | | Customer abandons | Close the mock authenticator window without clicking either button | Charge stays in `requires_authentication`. | # Volt (/documentation/payment-methods/bank-transfers/open-banking-volt) Volt is an open banking payment method that lets customers pay directly from their bank account, with no card details. The customer selects their bank and authenticates in their banking app, and the payment settles in real time. ## Payment method properties [#payment-method-properties] Volt is available to merchants in the European Union and takes payments from customers across Europe, Brazil, and Australia. | Property | Details | | --- | --- | | Type | Bank transfer | | API type | `volt` | | How customers pay | Redirect to the provider | | Customer countries | Austria, Australia, Belgium, Bulgaria, Brazil, Croatia, Cyprus, Czechia, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Iceland, Ireland, Italy, Latvia, Liechtenstein, Luxembourg, Malta, Netherlands, Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, United Kingdom | | Currencies | AUD, BGN, BRL, CZK, DKK, EUR, GBP, HUF, NOK, PLN, RON, SEK | | Refunds | Full and partial | | Recurring payments | No | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | EU | | Settlement currencies | AUD, BRL, DKK, EUR, GBP, NOK, PLN, SEK | | Payment confirmation | Asynchronous | | Settlement timing | Instant settlements available. Custom schedules (daily, weekly, or monthly) also supported | ## Customer payment flow [#customer-payment-flow] When a customer selects Volt at checkout, they're taken to a Volt-hosted checkout page to select their bank and authenticate the payment. ### Select Volt and proceed [#select-volt-and-proceed] The customer selects Volt (shown as **Pay by bank**) on your checkout page and clicks **Pay**. The Volt-hosted checkout page opens. ### Select a country [#select-a-country] The customer selects the country where their bank is located from a grid of supported countries. This determines which banks appear in the next step. ### Select a bank [#select-a-bank] The customer searches for their bank by name, BIC, or National ID, or selects from the list shown for their country. A payment summary on the right shows the amount, merchant name, and a payment reference. ### Authenticate the payment [#authenticate-the-payment] The customer has two options to authenticate: * **Scan to pay:** A QR code is shown on screen. The customer scans it with their phone camera, which opens their banking app to approve the payment. * **Continue on desktop:** The customer authenticates directly through their bank's web interface on the same device. ### Return to your site [#return-to-your-site] After authentication, Volt shows a confirmation screen and redirects the customer back to your site. Pay.com sends a webhook event to confirm the outcome. If the customer closes the Volt checkout without completing authorization, the charge stays in `requires_authentication`. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] Volt works with the standard Pay.com integration after your account manager enables it for your account. **Account prerequisites:** * You must have an active Pay.com merchant account with Volt enabled. Contact your account manager to enable Volt for your account. * Your business must operate in an accepted industry. See [accepted industries](#accepted-industries) below for details. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * Include a unique `idempotency-key` header on every POST request. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Volt for your account, turn it on for checkout in the Pay.com dashboard, where its toggle is labeled **Pay by bank**. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods) for the steps, and ask your account manager to enable Volt if **Pay by bank** isn't listed. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Volt charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Volt hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, or Volt declined the payment | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Volt payment in full or in part. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Accepted industries [#accepted-industries] Volt is available to merchants in the following industries: * Airlines * Adult * Crypto * Dating * Digital content * eCommerce retail * Financial services (licensed) * Forex (regulated) * Gambling (licensed) * Skill games * Travel * Video games * Wallet top up The list of accepted industries may change with regulatory requirements and partner agreements. Contact your account manager for current eligibility. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/bank-transfers/open-banking-volt/integrate-at-checkout): Accept Volt payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/bank-transfers/open-banking-volt/integrate-at-checkout) You can accept Volt payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Volt in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Volt payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Volt. Before you start, ask your account manager to enable Volt for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Volt in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"volt"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "volt"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Volt and clicks **Pay**, Pay.com.js opens Volt in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Volt payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"volt"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Volt is available [#check-that-volt-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Volt button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const volt = methods.find((method) => method.paymentMethodType === 'volt') ``` ### Start the payment [#start-the-payment] When the customer selects Volt, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'volt'`. ```javascript try { await checkout.headless('volt') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Volt in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Volt payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Volt. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"volt"`. Pay.com passes `source_data.billing_details` to Volt to prefill its page for the customer. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "volt", "billing_details": { "address": { "country": "DE" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "volt" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Volt redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled or declined payment. ## Restrict available bank countries [#restrict-available-bank-countries] By default, the bank selection UI shows banks based on the customer's billing country, with a fallback to their IP-based country. To restrict which countries are available, pass `allowed_countries` under `payment_method_options.bank_account`. This option works with both the SDK and server-to-server integration paths. Add it to either the payment session or the charge request: ```json { "payment_method_options": { "bank_account": { "allowed_countries": ["GB", "DE", "FR"] } } } ``` ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). Volt must be enabled on your sandbox account before you can test. Contact your account manager if it isn't enabled yet. ### Sandbox behavior [#sandbox-behavior] In the sandbox, Pay.com opens the Volt-hosted sandbox checkout instead of the real Volt payment page. The sandbox checkout shows a list of countries. You select a country, then select a mock bank to open the Mock Manager, where you choose a payment outcome to simulate. * **SDK integration:** the SDK opens the Volt-hosted sandbox checkout page (in a new tab, or as a full-page redirect when inline redirects are enabled for your account). * **Server-to-server integration:** the linked authentication session returns a redirect `url`. Opening this URL in a browser loads the Volt-hosted sandbox checkout as a full page. In the live environment (sessions and API calls on `https://api.pay.com/v1` with an `sk-pay-com-live-` key), the customer is sent to the real Volt-hosted checkout page to select their bank and authenticate. ### How to reach the Mock Manager [#how-to-reach-the-mock-manager] To simulate an outcome, open the Mock Manager from the sandbox checkout: 1. Create a charge or payment session as described above. 2. Open the redirect URL (server-to-server) or click **Pay** in your SDK integration. The Volt-hosted sandbox checkout opens. 3. On the country selector, choose a country. 4. On the bank selection screen, select one of the available mock banks. 5. The checkout shows two authentication options: **Scan to pay** (QR code) and **Continue on desktop**. Click **Continue on desktop**. 6. On the mock bank page, click **Open** to open the Mock Manager. 7. In the Mock Manager, choose a payment outcome to simulate. ### Mock Manager outcomes [#mock-manager-outcomes] The Mock Manager simulates these outcomes: | Outcome | Result | | ------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | **Complete and Receive** | Charge moves to `succeeded`. `charge.succeeded` webhook fires. The customer is redirected to your `return_url`. | | **Complete and Receive (Legacy API)** | Same as above, using Volt's legacy API flow. | | **Complete** | Marks the payment as complete on Volt's side. The charge transitions based on the bank's response. | | **Delay** | Simulates a delayed bank response. The charge remains in `requires_authentication` until the bank responds. | | **Fail** | Charge moves to `failed`. `charge.failed` webhook fires. | | **Cancel** | Simulates the customer canceling the payment. Charge moves to `failed`. | ### Verifying the charge after authentication [#verifying-the-charge-after-authentication] After the customer completes the mock bank flow and is redirected to your `return_url`, retrieve the charge to verify its final state: ```bash curl -X GET "https://api.sandbox.pay.com/v1/charges/{charge_id}" \ -u ':sk-pay-com-sandbox-…' ``` On success, the charge status changes to `succeeded` and the response includes updated payment method details: ```json { "id": "chrg_758731980656347136", "status": "succeeded", "payment_method": "pm_eu_bank_account_758732768082397184", "payment_method_details": { "type": "eu_bank_account", "eu_bank_account": { "bank_name": "OBIE Mock bank", "account_holder_name": "Jane Smith", "country": "DE", "currency": "EUR", "last4": "1649", "source": "volt" } } } ``` After successful authentication, `payment_method_details.type` changes from `"volt"` to `"eu_bank_account"` and a `pm_eu_bank_account_...` payment method ID is assigned. This is expected. Volt is the payment flow, and `eu_bank_account` is the resulting payment instrument. # Fonix (/documentation/payment-methods/pay-by-mobile/fonix) Fonix is a UK carrier billing method that lets customers pay by charging purchases to their mobile phone bill. It works with all major UK mobile operators. Fonix is available through Pay.com.js only. The server-to-server API (`POST /v1/charges`) does not accept Fonix as a payment method. ## Payment method properties [#payment-method-properties] Fonix takes GBP payments from customers in the United Kingdom, up to £40 per transaction and £240 per month. | Property | Details | | --- | --- | | Type | Pay by mobile | | API type | `fonix` | | How customers pay | In-page | | Customer countries | United Kingdom | | Refunds | Full only | | Recurring payments | No | | Disputes | No | | Integrations | Universal checkout, Headless checkout | | Merchant countries | Global (excluding sanctioned countries) | | Payment confirmation | After the customer confirms the charge on their phone | | Settlement timing | 65 days after the month of transactions. For example, January transactions settle on 5 Apr. Vodafone has a follow-up balancing payment for clawbacks and recovered revenue on the 5th of the seventh month after transactions | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | GBP | No minimum | 4000 | ### Supported mobile operators [#supported-mobile-operators] Fonix processes payments through the following UK mobile operators: * Three UK * EE (Orange) UK * EE (T-Mobile) UK * Vodafone UK * O2 UK * Virgin Media UK ## Customer payment flow [#customer-payment-flow] When a customer selects Fonix at checkout, they authorize the charge with their mobile phone number. The payment amount is added to their next mobile phone bill or deducted from their prepaid balance. ### Select pay by mobile [#select-pay-by-mobile] The customer selects the pay-by-mobile option on your checkout page and clicks **Pay**. ### Enter mobile number [#enter-mobile-number] The customer enters their UK mobile phone number on Pay.com's mobile payment page. With Headless checkout, you collect the number in your own UI and pass it to the SDK. ### Confirm the payment on the phone [#confirm-the-payment-on-the-phone] The customer confirms the charge on their phone when prompted. Fonix checks the mobile number with the operator and processes the payment. ### Receive the result [#receive-the-result] Fonix posts the result back to Pay.com, which updates the charge and sends a webhook event to your endpoint. If the customer doesn't confirm the payment on their phone, the charge doesn't succeed. When the payment session expires (60 minutes by default), the charge fails and a `charge.failed` webhook event fires. Do not fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] **Account prerequisites:** * You must have an active Pay.com merchant account with Fonix enabled. Contact your account manager to enable Fonix for your account. * You do not need a separate Fonix merchant account. Pay.com manages the Fonix integration on your behalf. * Your business must operate in an accepted industry. Fonix supports merchants in licensed gaming, licensed gambling, charity, digital content, ticketing, media, and transport. Physical goods merchants are not supported. **Technical prerequisites:** * Integrate with Pay.com.js (`@pay-com/js`). No other SDK or library is needed. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Fonix for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Subscribe to the following webhook events to track Fonix charge outcomes. | Webhook event | Trigger condition | Recommended action | | ------------------ | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | `charge.succeeded` | The customer confirmed payment and the carrier accepted the charge | Fulfill the order and send a confirmation to the customer | | `charge.failed` | The payment was rejected by the carrier, the customer's account had insufficient credit, or the session expired | Notify the customer and prompt them to retry or use a different payment method | | `charge.pending` | The charge was created but the customer has not yet confirmed the payment on their phone | Wait for `charge.succeeded` or `charge.failed` before fulfilling the order | Verify the `Pay-Signature` header before you act on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). A `charge.succeeded` event is the only event you need to fulfill an order. ## Refunds [#refunds] You can refund a Fonix payment only in full. Refunded funds return to the customer's mobile account. Carrier billing refunds can take longer than card refunds. Ask your account manager how long each mobile operator takes. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and omit `amount_to_refund`. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Recurring payments [#recurring-payments] Recurring Fonix payments are not available as a self-service feature. Contact your Pay.com account manager to find out whether recurring payments or saved mobile numbers can be enabled for your account, including carrier authorization and charge frequency limits. ## Accepted and prohibited industries [#accepted-and-prohibited-industries] Fonix is available to merchants in the following industries: * Licensed gaming * Licensed gambling * Charity * Digital content * Ticketing * Media * Transport Physical goods merchants are not supported. Fonix is for digital goods, services, and donations only. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/pay-by-mobile/fonix/integrate-at-checkout): Accept Fonix payments with Pay.com.js, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/pay-by-mobile/fonix/integrate-at-checkout) Fonix is available through Pay.com.js only. You can let Universal checkout render it, or build your own button with Headless checkout. The server-to-server API (`POST /v1/charges`) does not accept Fonix as a payment method. Before starting, make sure Fonix is enabled on your Pay.com account. See the [Fonix overview](/documentation/payment-methods/pay-by-mobile/fonix) for prerequisites and dashboard configuration. ## Create a payment session [#create-a-payment-session] Create a payment session on your server with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"fonix"` in the `payment_method_types` array. ```json { "amount": 500, "currency": "gbp", "customer_reference_id": "cust-001", "payment_method_types": ["card", "fonix"] } ``` Amounts are in minor units (the smallest currency unit). For example, `500` is £5.00. Fonix has a maximum of £40 per transaction and £240 per month per customer. `customer_reference_id` is required and is your own identifier for the customer. Pass the `client_secret` from the response to your frontend to initialize the SDK. Pay.com renders the Fonix option automatically once the session is loaded. ## Universal checkout [#universal-checkout] Fonix renders automatically in Universal checkout when it is in the session's `payment_method_types`. No additional code is needed beyond the standard SDK initialization. See [Universal checkout](/payments/universal-checkout) for setup instructions. ## Headless checkout [#headless-checkout] Use [Headless checkout](/payments/headless-checkout) when you want to control the user interface and collect the customer's mobile number yourself. Check whether Fonix is available for the current session after initializing the checkout instance. [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods) returns the session's payment methods as objects (`{ paymentMethodType, name, redirect?, fields? }`): ```javascript const methods = await checkout.getPaymentMethods() const fonix = methods.find((m) => m.paymentMethodType === 'fonix') if (fonix) { // Show your Fonix payment option. // fonix.fields, when present, lists the inputs to collect. } ``` **Attach `handleFonix` to your Fonix button's click handler. Pass the values you collected as the second argument, keyed by each field's `id`:** ```javascript async function handleFonix(phone) { try { await checkout.headless('fonix', { phone }) } catch (error) { console.log('Payment failed:', error.message) } } ``` Fulfill the order only when you receive the `charge.succeeded` webhook event, and handle `charge.failed` if the customer doesn't confirm. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). ### Sandbox behavior [#sandbox-behavior] In the sandbox, Pay.com uses an **Alternate Payments Redirect Simulator** instead of a real mobile operator. The simulator displays a pre-filled Payment ID and lets you choose a **Payment Status** and **Result Code** before submitting. In the live environment (sessions and API calls on `https://api.pay.com/v1` with an `sk-pay-com-live-` key), the customer confirms the payment on their real mobile phone. Base your tests on the charge status and webhook events, not on SDK callbacks. ### Simulator payment statuses [#simulator-payment-statuses] The simulator provides four payment statuses to test different outcomes: | Payment status | Expected result | | -------------- | ------------------------------------------------------------------------ | | `COMPLETED` | Charge moves to `succeeded`. `charge.succeeded` webhook fires. | | `PROCESSING` | Charge is not final yet. Wait for `charge.succeeded` or `charge.failed`. | | `FAILED` | Charge moves to `failed`. `charge.failed` webhook fires. | | `ERROR` | Charge moves to `failed`. `charge.failed` webhook fires. | ### Test scenarios [#test-scenarios] Run each scenario in the sandbox and check the charge status and the webhook event. | Scenario | Test action | Expected result | | ------------------ | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | Successful payment | Select `COMPLETED` in the simulator and click **Submit** | Charge `status: "succeeded"`. `charge.succeeded` webhook fires. | | Failed payment | Select `FAILED` or `ERROR` in the simulator and click **Submit** | Charge `status: "failed"`. `charge.failed` webhook fires. | | Customer abandons | Close the simulator without submitting | The charge doesn't succeed. When the payment session expires (60 minutes by default), the charge fails and `charge.failed` fires. | # Apple Pay (/documentation/payment-methods/wallets/apple-pay) Apple Pay is a digital wallet payment method that lets customers pay at checkout using a card saved to their Apple Wallet. Customers authenticate with Face ID, Touch ID, or their device passcode and pay without entering card details. Apple Pay is available to cardholders whose banks support it in eligible countries. See Apple's list of [participating banks](https://support.apple.com/en-us/109524). ## Payment method properties [#payment-method-properties] Apple Pay takes payments in 25 currencies from customers in any country, and confirms them immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `applepay` | | How customers pay | In-page | | Customer countries | Global | | Refunds | Full and partial | | Recurring payments | Yes | | Authorize and capture later | Yes | | Disputes | Yes | | Integrations | Universal checkout, Headless checkout, API, Hosted checkout | | Merchant countries | Australia, Austria, Belgium, Brazil, Bulgaria, Canada, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Faroe Islands, Finland, France, Germany, Greece, Guernsey, Hong Kong, Hungary, Iceland, Ireland, Italy, Japan, Jersey, Latvia, Liechtenstein, Lithuania, Luxembourg, Malta, Monaco, Netherlands, New Zealand, Norway, Poland, Portugal, Romania, Singapore, Slovakia, Slovenia, Spain, Sweden, Switzerland, United Kingdom, United States, United Arab Emirates, Vatican City | | Payment confirmation | Immediate. The charge is authorized and captured when the customer authenticates | | Settlement timing | Next business day | | 3DS and SCA | Handled automatically. Cryptogram 3DS authentication is performed by the device at the time of payment | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | AUD | No minimum | No maximum | | BRL | No minimum | No maximum | | CAD | No minimum | No maximum | | CHF | No minimum | No maximum | | CNY | No minimum | No maximum | | CZK | No minimum | No maximum | | DKK | No minimum | No maximum | | EUR | No minimum | No maximum | | GBP | No minimum | No maximum | | HKD | No minimum | No maximum | | HUF | No minimum | No maximum | | INR | No minimum | No maximum | | JPY | No minimum | No maximum | | MXN | No minimum | No maximum | | MYR | No minimum | No maximum | | NOK | No minimum | No maximum | | NZD | No minimum | No maximum | | PHP | No minimum | No maximum | | PLN | No minimum | No maximum | | RON | No minimum | No maximum | | SEK | No minimum | No maximum | | SGD | No minimum | No maximum | | THB | No minimum | No maximum | | TWD | No minimum | No maximum | | USD | 1 | No maximum | ## Customer payment flow [#customer-payment-flow] Here's how Apple Pay authorizes a payment from your checkout page: ### Checkout page rendering [#checkout-page-rendering] When the customer reaches the checkout page, Pay.com detects Apple Pay availability in their browser and renders the Apple Pay button. ### Payment initiation [#payment-initiation] The customer taps or clicks the Apple Pay button. ### Sheet presentation [#sheet-presentation] An Apple Pay sheet appears, sliding up from the bottom on mobile, or as an overlay on desktop Safari. It displays the merchant name, order amount, and the customer's default Apple Wallet card. ### Card selection [#card-selection] The customer confirms their card or selects a different one from their wallet. ### Biometric authentication [#biometric-authentication] The customer authenticates the payment using Face ID, Touch ID, or their device passcode. ### Payment confirmation [#payment-confirmation] The Apple Pay sheet closes and the customer sees a payment confirmation on the page. If authentication fails or the customer cancels, the Apple Pay sheet closes without creating a charge. The customer remains on your checkout page. ## Before you begin [#before-you-begin] Make sure the following requirements are configured: * You must have an active Pay.com merchant account with Apple Pay enabled. Contact your account manager or enable Apple Pay in the **Payment methods** section of your Pay.com dashboard. * Serve Apple's domain association file over HTTPS on every domain that shows the Apple Pay button, at `https:///.well-known/apple-developer-merchantid-domain-association`. Download the file from your dashboard (see [Dashboard configuration](#dashboard-configuration)) or from `https://js.pay.com/.well-known/apple-developer-merchantid-domain-association`. Apple reads it when you register the domain. * Before going live, register every domain that shows the Apple Pay button with Pay.com. Register them in your dashboard, with [`POST /v1/payment_method_domains/register`](/api-reference/endpoints/paymentmethoddomains/register-payment-method-domain) and the domains in `domain_names`, or by asking your account manager. Pay.com registers the domain with Apple on your behalf. If Apple can't read the file, registration fails with `Domain check failed`, and `details` names each domain and the URL Apple tried. Serve the file at that URL and register again. List your registered domains with [`GET /v1/payment_method_domains`](/api-reference/endpoints/paymentmethoddomains/get-payment-method-domains). * Apple Pay on the web works in Safari on macOS and iOS. Support in other browsers depends on Apple and the customer's device, so don't assume the button is unavailable outside Safari. With Headless checkout, show your button only when `canMakePayments()` returns `applepay: true`. With Pay.com.js, or server-to-server when Pay.com decrypts the token, you don't need your own Apple merchant ID or Apple Developer account. Pay.com handles Apple merchant registration, certificate management, and merchant validation on your behalf. To decrypt Apple Pay tokens yourself, you need your own Apple merchant ID, certificates, and merchant validation. See [Add to checkout](/documentation/payment-methods/wallets/apple-pay/integrate-at-checkout). ### Dashboard configuration [#dashboard-configuration] Apple Pay is turned on and its domains are registered in the Pay.com dashboard. In some cases, Apple Pay is already turned on. #### Turn on Apple Pay [#turn-on-apple-pay] In the Pay.com dashboard, go to **Settings** → **Payment methods** and expand **Apple Pay**. If it isn't **Active**, click **Turn on**. #### Register your domains [#register-your-domains] Click **Configure**, then **Add a new domain** under **Web domains**, and enter every domain that shows the Apple Pay button. Download the domain association file with **Download file**, serve it at the path shown for each domain, then click **Verify domain**. #### Show Apple Pay at checkout [#show-apple-pay-at-checkout] Turn on Apple Pay for checkout in your payment methods configuration. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). If Apple Pay isn't listed in the dashboard, ask your account manager to enable it on your account first. ## Handling payment events [#handling-payment-events] Subscribe to the following webhook events to track Apple Pay charge outcomes. | Webhook event | Trigger condition | Recommended action | | ------------------ | ----------------------------------------------------- | ----------------------------------------------------------------------------- | | `charge.succeeded` | The charge was authorized and captured successfully | Fulfill the order and send a confirmation email | | `charge.failed` | The charge was declined by the issuer or by Apple Pay | Notify the customer and prompt them to use a different card or payment method | Because Apple Pay confirmation is immediate (synchronous), standard Apple Pay transactions don't enter a `charge.pending` state. The `charge.succeeded` event is the only event you need to fulfill an order. Verify the `Pay-Signature` header before you act on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] Apple Pay supports full and partial refunds. Refunds go to the underlying card, not the Apple Wallet, so the customer sees the refund on the card linked to their Apple Wallet. To refund a payment, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge ID. See [Refund a charge](/payments/refunds) for request and response examples, statuses, and webhook events. ## Disputes [#disputes] Apple Pay transactions are backed by the customer's underlying card and follow that card network's dispute and chargeback rules. Because Apple Pay uses a device-specific token (DPAN) rather than the customer's real card number, dispute records in Pay.com and on your card network statement reference the underlying card, not the Apple Pay wallet. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. ## Recurring payments [#recurring-payments] When Pay.com processes an Apple Pay transaction, it stores the underlying card used for the payment as a standard payment method (`pm_card_...`). This stored card behaves like any other saved card on Pay.com and can be used for both merchant-initiated charges and subscription billing. Apple Pay generates a new device-specific token on every transaction, so recurring charges are made against the underlying card that Pay.com extracts during the initial payment, not against the Apple Pay wallet itself. See [Set up recurring payments](/documentation/payment-methods/wallets/apple-pay/set-up-recurring-payments) for the step-by-step integration guide, including how to retrieve the stored payment method ID and create recurring charges or subscriptions. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/apple-pay/integrate-at-checkout): SDK and API integration guide with code examples and testing * [Set up recurring payments](/documentation/payment-methods/wallets/apple-pay/set-up-recurring-payments): retrieve the stored payment method and create recurring charges or subscriptions * [Webhooks](/developer-resources/webhooks): verify webhook signatures and handle delivery retries * [Create a charge](/api-reference/endpoints/charges/create-charge): full API reference for `POST /v1/charges` # Add to checkout (/documentation/payment-methods/wallets/apple-pay/integrate-at-checkout) Pay.com supports three integration paths for Apple Pay: Universal checkout, Headless checkout, and the server-to-server API. Choose based on how much control you need over the checkout experience. Before starting, make sure Apple Pay is enabled on your Pay.com account and your domain is registered. See the [Apple Pay overview](/documentation/payment-methods/wallets/apple-pay) for prerequisites and dashboard configuration. ## Integrate [#integrate] Integrate Apple Pay with Pay.com.js or directly with the API. ### Universal checkout [#universal-checkout] Apple Pay renders automatically in Universal checkout. No additional code is required beyond the standard SDK initialization. See [Universal checkout](/payments/universal-checkout) for setup instructions. Use Universal checkout when you want Pay.com to handle the entire payment flow, including the UI. ### Headless checkout [#headless-checkout] Use Headless checkout when you want to control the user interface and let Pay.com handle the payment logic. You render your own Apple Pay button and control when the payment sheet appears. Apple Pay is not available in all browsers. Call `canMakePayments()` after initializing the checkout instance, and show the button only if the result includes `applepay: true`. ```javascript const canMakePaymentsResult = await checkout.canMakePayments() // Example result: { applepay: true, googlepay: false } if (canMakePaymentsResult.applepay) { // Show your Apple Pay button } ``` **Trigger the payment when the customer taps the button.** ```javascript async function handleApplePay() { try { await checkout.headless('applepay') } catch (error) { console.log('Payment failed:', error.message) } } ``` Apple's Human Interface Guidelines require that you use the official Apple Pay button style. Use `-webkit-appearance: -apple-pay-button` in your CSS or Apple's [button guidelines](https://developer.apple.com/design/human-interface-guidelines/apple-pay) to render the button. Don't substitute a generic button styled to look like Apple Pay. Use this path when you render Apple Pay yourself with Apple's [Apple Pay JS API](https://developer.apple.com/documentation/apple_pay_on_the_web) instead of Pay.com.js. Your server creates the charge with [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge), and either Pay.com decrypts the Apple Pay token or you do: * **Pay.com decrypts:** your server validates the merchant with [`POST /v1/sessions/applepay`](/api-reference/endpoints/applepaysessions/create-applepay-session) and sends the encrypted token as `source_data.type: "applepay"`. You don't need your own Apple merchant ID. * **You decrypt:** you need your own Apple merchant ID, its payment processing and merchant identity certificates, and your own merchant validation with Apple. You send the decrypted values as `source_data.type: "network_token"`. Either way, your API key must be enabled for raw payment data. See [PCI compliant keys](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). See [Wallets](/payments/wallets/api) for both paths, with requests, responses, the billing address mapping, and how to test them. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). To test Apple Pay through Pay.com checkout, use a real Apple device with a card added to Apple Wallet. | Scenario | Test action | Expected result | | --------------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | Successful payment | Authenticate with Face ID, Touch ID, or the device passcode | `status: succeeded`, `wallet.type: "applepay"` in the response | | Customer cancels | Tap **Cancel** on the Apple Pay sheet | The sheet closes and no charge is created. | | Apple Pay unavailable | Open checkout in a browser or on a device where Apple Pay is not set up | `canMakePayments()` returns `applepay: false` and the Apple Pay button does not render. | # Set up recurring payments (/documentation/payment-methods/wallets/apple-pay/set-up-recurring-payments) When Pay.com processes an Apple Pay transaction, it stores the underlying card used for the payment as a standard payment method (`pm_card_...`). This stored card behaves identically to any other saved card on Pay.com and can be used for both merchant-initiated charges and subscription billing. To use the stored card for merchant-initiated charges, ask to save it on the initial Apple Pay payment. Set `setup_future_usage: "off_session"` on the payment session (Universal or Headless checkout), or `source_data.setup_future_usage: "off_session"` on the charge (server-to-server). The SDK includes `paymentMethod` in the `onSuccess` payload only when the session sets `setup_future_usage`. ## Retrieve the stored payment method ID [#retrieve-the-stored-payment-method-id] How you retrieve the `pm_card_...` ID depends on the integration path used for the initial Apple Pay payment. Create the payment session with `"setup_future_usage": "off_session"` so the card is stored for merchant-initiated use: ```json { "amount": 1000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method_types": ["applepay"], "setup_future_usage": "off_session" } ``` `1000` is $10.00 (amounts are in minor units). Then retrieve the `pm_card_...` ID from the `onSuccess` callback after the customer completes the initial Apple Pay payment. The SDK returns response keys in camelCase, so the ID is in `payment.paymentMethod`: ```js const checkout = pay.checkout({ clientSecret: '{client_secret}', onSuccess: (payment) => { const paymentMethodId = payment.paymentMethod // Store paymentMethodId against the customer in your database }, onFailure: (error) => { console.error(error.message) }, }) ``` On the initial Apple Pay charge request, include `"setup_future_usage": "off_session"` inside your `source_data` object. This tells the issuing bank that the card will be used for future merchant-initiated transactions. The charge response returns the values you need for all future recurring charges: ```json { "id": "chrg_687257433738839040", "payment_method": "pm_card_687257443142470656", "underlying_network_id": "2858e1b8-c453-4ef9-8940-18c2e159725b", "status": "succeeded" } ``` Store both the `payment_method` ID and the `underlying_network_id` against the customer record in your database. You will need these for future recurring charges. ## Create recurring charges or subscriptions [#create-recurring-charges-or-subscriptions] Once you have the `pm_card_...` ID, you can use it to charge the customer without them being present. There are two paths depending on your billing model: * **Recurring charges**: trigger each charge manually using the stored `pm_card_...` ID with `"off_session": true`. See the [recurring charges guide](/payments/saved-cards/recurring-charges) for the full request format, all targeting methods, response handling, and webhook events. * **Subscriptions**: attach the stored `pm_card_...` ID to a subscription package and let Pay.com manage the billing schedule automatically. See the [subscriptions guide](/commerce/create-a-subscription) for the full setup instructions. Apple Pay generates a new device-specific token on every transaction. Recurring charges are made against the underlying card that Pay.com extracts during the initial payment, not against the Apple Pay wallet itself. # Google Pay (/documentation/payment-methods/wallets/google-pay) Google Pay is a digital wallet payment method that lets customers pay at checkout using a card saved to their Google account. It is available on Android devices, iOS devices with the Google Pay app, and in supported desktop and mobile browsers. Customers who have Google Pay set up authenticate with their fingerprint, face scan, PIN, or screen lock and pay without entering card details. Google Pay is available to cardholders whose banks support it, and availability varies by country and device. ## Payment method properties [#payment-method-properties] Google Pay takes payments in 25 currencies from customers in any country, and confirms them immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `googlepay` | | How customers pay | In-page | | Customer countries | Global | | Refunds | Full and partial | | Recurring payments | Yes | | Authorize and capture later | Yes | | Disputes | Yes | | Integrations | Universal checkout, Headless checkout, API, Hosted checkout | | Merchant countries | Australia, Austria, Belgium, Brazil, Bulgaria, Canada, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hong Kong, Hungary, Ireland, Italy, Japan, Latvia, Lithuania, and more. Contact your account manager for the current list | | Payment confirmation | Immediate. The charge is authorized and captured when the customer authenticates | | Settlement timing | Next business day | | 3DS and SCA | `CRYPTOGRAM_3DS` cards are authenticated on the device and carry a cryptogram. By default, Pay.com.js accepts both `CRYPTOGRAM_3DS` and `PAN_ONLY` cards. Contact your account manager to accept `CRYPTOGRAM_3DS` only | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | AUD | No minimum | No maximum | | BRL | No minimum | No maximum | | CAD | No minimum | No maximum | | CHF | No minimum | No maximum | | CNY | No minimum | No maximum | | CZK | No minimum | No maximum | | DKK | No minimum | No maximum | | EUR | No minimum | No maximum | | GBP | No minimum | No maximum | | HKD | No minimum | No maximum | | HUF | No minimum | No maximum | | INR | No minimum | No maximum | | JPY | No minimum | No maximum | | MXN | No minimum | No maximum | | MYR | No minimum | No maximum | | NOK | No minimum | No maximum | | NZD | No minimum | No maximum | | PHP | No minimum | No maximum | | PLN | No minimum | No maximum | | RON | No minimum | No maximum | | SEK | No minimum | No maximum | | SGD | No minimum | No maximum | | THB | No minimum | No maximum | | TWD | No minimum | No maximum | | USD | 1 | No maximum | ## Customer payment flow [#customer-payment-flow] Here's how Google Pay authorizes a payment from your checkout page: ### Checkout page rendering [#checkout-page-rendering] When the customer reaches the checkout page, Pay.com detects Google Pay availability in their browser and renders the Google Pay button. ### Payment initiation [#payment-initiation] The customer taps or clicks the Google Pay button. ### Sheet presentation [#sheet-presentation] A Google Pay payment sheet appears, displaying the merchant name, order amount, the customer's default saved card, and billing information. ### Card selection [#card-selection] The customer can confirm their default card or tap to select a different card from their Google Wallet. ### Authentication [#authentication] If required, the customer authenticates using their device unlock method (fingerprint, face scan, PIN, pattern, or password). ### Payment confirmation [#payment-confirmation] The Google Pay sheet closes, Pay.com processes the tokenized payment data, and the customer sees a payment confirmation on the merchant's page. If authentication fails or the customer cancels, the Google Pay sheet closes without creating a charge. The customer remains on your checkout page. ## Before you begin [#before-you-begin] Make sure the following are in place before integrating Google Pay: * You must have an active Pay.com merchant account with Google Pay enabled. Contact your account manager or enable Google Pay in the **Payment methods** section of your Pay.com dashboard. * Google Pay is supported in Chrome on Android and desktop, in Safari on iOS (via the Google Pay app), and in other browsers where the customer has Google Pay set up. When you use Pay.com.js, you don't need a Google merchant account. Pay.com.js sets the Google Pay gateway details for you. If you integrate the Google Pay API yourself (server-to-server), register with the [Google Pay & Wallet Console](https://pay.google.com/business/console) and set `gateway` to `"paycom"` and `gatewayMerchantId` to your Pay.com merchant ID in the tokenization specification. ### Dashboard configuration [#dashboard-configuration] Google Pay is turned on in the Pay.com dashboard. In some cases, it's already turned on. #### Turn on Google Pay [#turn-on-google-pay] In the Pay.com dashboard, go to **Settings** → **Payment methods** and expand **Google Pay**. If it isn't **Active**, click **Turn on**. #### Show Google Pay at checkout [#show-google-pay-at-checkout] Turn on Google Pay for checkout in your payment methods configuration. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). If Google Pay isn't listed in your payment methods, ask your account manager to enable it on your account first. ## Handling payment events [#handling-payment-events] Subscribe to the following webhook events to track Google Pay charge outcomes. | Webhook event | Trigger condition | Recommended action | | ------------------ | ------------------------------------------------------ | ----------------------------------------------------------------------------- | | `charge.succeeded` | The charge was authorized and captured successfully | Fulfill the order and send a confirmation email | | `charge.failed` | The charge was declined by the issuer or by Google Pay | Notify the customer and prompt them to use a different card or payment method | Because Google Pay confirmation is immediate (synchronous), standard Google Pay transactions don't enter a `charge.pending` state. The `charge.succeeded` event is the only event you need to fulfill an order. Verify the `Pay-Signature` header before you act on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] Google Pay supports full and partial refunds. Refunds go to the underlying card, not the Google Pay wallet, so the customer sees the refund on the card used at checkout. To refund a payment, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge ID. See [Refund a charge](/payments/refunds) for request and response examples, statuses, and webhook events. ## Disputes [#disputes] Google Pay transactions are backed by the customer's underlying card and follow that card network's dispute and chargeback rules. Because Google Pay uses a payment token rather than the customer's real card number, dispute records in Pay.com and on your card network statement reference the underlying card, not the Google Pay wallet. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. ## Recurring payments [#recurring-payments] When Pay.com processes a Google Pay transaction, it stores the underlying card as a standard payment method (`pm_card_...`). This stored card behaves like any other saved card on Pay.com and can be used for both merchant-initiated charges and subscription billing. Google Pay generates a new payment token on every transaction, so recurring charges are made against the underlying card that Pay.com extracts during the initial payment, not against the Google Pay wallet itself. See [Set up recurring payments](/documentation/payment-methods/wallets/google-pay/set-up-recurring-payments) for the step-by-step integration guide, including how to retrieve the stored payment method ID and create recurring charges or subscriptions. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/google-pay/integrate-at-checkout): SDK and API integration guide with code examples and testing * [Set up recurring payments](/documentation/payment-methods/wallets/google-pay/set-up-recurring-payments): retrieve the stored payment method and create recurring charges or subscriptions * [Webhooks](/developer-resources/webhooks): verify webhook signatures and handle delivery retries * [Create a charge](/api-reference/endpoints/charges/create-charge): full API reference for `POST /v1/charges` # Add to checkout (/documentation/payment-methods/wallets/google-pay/integrate-at-checkout) Pay.com supports three integration paths for Google Pay: Universal checkout, Headless checkout, and the server-to-server API. Choose based on how much control you need over the checkout experience. Before starting, make sure Google Pay is enabled on your Pay.com account. See the [Google Pay overview](/documentation/payment-methods/wallets/google-pay) for prerequisites and dashboard configuration. ## Integrate [#integrate] Integrate Google Pay with Pay.com.js or directly with the API. ### Universal checkout [#universal-checkout] Google Pay renders automatically in Universal checkout. No additional code is needed beyond the standard SDK initialization. See [Universal checkout](/payments/universal-checkout) for setup instructions. Use Universal checkout when you want Pay.com to handle the entire payment flow, including the UI. ### Headless checkout [#headless-checkout] Use Headless checkout when you want to control the user interface and let Pay.com handle the payment logic. You render your own Google Pay button and control when the payment sheet appears. Google Pay is not available in all browsers. Call `canMakePayments()` after initializing the checkout instance, and show the button only if the result includes `googlepay: true`. ```javascript const canMakePaymentsResult = await checkout.canMakePayments() // Example result: { applepay: false, googlepay: true } if (canMakePaymentsResult.googlepay) { // Show your Google Pay button } ``` **Trigger the payment when the customer taps the button.** ```javascript async function handleGooglePay() { try { await checkout.headless('googlepay') } catch (error) { console.log('Payment failed:', error.message) } } ``` Google's brand guidelines require that you use the official Google Pay button. Follow the [Google Pay brand guidelines](https://developers.google.com/pay/api/web/guides/brand-guidelines) when rendering the button. Don't substitute a generic button styled to look like Google Pay. Use this path when you call the [Google Pay API](https://developers.google.com/pay/api/web/overview) yourself instead of Pay.com.js. Your server creates the charge with [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge), and either Pay.com decrypts the Google Pay token or you do: * **Pay.com decrypts:** you use the `paycom` gateway in your Google Pay tokenization specification and send the encrypted token as `source_data.type: "googlepay"`. A `PAN_ONLY` card can need 3D Secure, so send `authentication_context` too. * **You decrypt:** you use Google Pay's `DIRECT` tokenization with your own keys, and send the decrypted values as `source_data.type: "network_token"`. Either way, your API key must be enabled for raw payment data. See [PCI compliant keys](/developer-resources/authentication/scoped-api-keys#pci-compliant-keys). See [Wallets](/payments/wallets/api) for both paths, with requests, responses, the billing address mapping, the 3D Secure step, and how to test them. ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). To test Google Pay through Pay.com checkout, use a supported browser with a Google account that has a card saved to Google Pay. | Scenario | Test action | Expected result | | ---------------------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------------- | | Successful payment | Authenticate through the Google Pay sheet | `status: succeeded`, `wallet.type: "googlepay"` in the response | | Customer cancels | Dismiss the Google Pay sheet | The sheet closes and no charge is created. | | Google Pay unavailable | Open checkout in a browser without Google Pay set up | `canMakePayments()` returns `googlepay: false` and the Google Pay button does not render. | # Set up recurring payments (/documentation/payment-methods/wallets/google-pay/set-up-recurring-payments) When Pay.com processes a Google Pay transaction, it stores the underlying card as a standard payment method (`pm_card_...`). This stored card behaves identically to any other saved card on Pay.com and can be used for both merchant-initiated charges and subscription billing. To use the stored card for merchant-initiated charges, ask to save it on the initial Google Pay payment. Set `setup_future_usage: "off_session"` on the payment session (Universal or Headless checkout), or `source_data.setup_future_usage: "off_session"` on the charge (server-to-server). The SDK includes `paymentMethod` in the `onSuccess` payload only when the session sets `setup_future_usage`. ## Retrieve the stored payment method ID [#retrieve-the-stored-payment-method-id] How you retrieve the `pm_card_...` ID depends on the integration path used for the initial Google Pay payment. Create the payment session with `"setup_future_usage": "off_session"` so the card is stored for merchant-initiated use: ```json { "amount": 1000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method_types": ["googlepay"], "setup_future_usage": "off_session" } ``` `1000` is $10.00 (amounts are in minor units). Then retrieve the `pm_card_...` ID from the `onSuccess` callback after the customer completes the initial Google Pay payment. The SDK returns response keys in camelCase, so the ID is in `payment.paymentMethod`: ```js const checkout = pay.checkout({ clientSecret: '{client_secret}', onSuccess: (payment) => { const paymentMethodId = payment.paymentMethod // Store paymentMethodId against the customer in your database }, onFailure: (error) => { console.error(error.message) }, }) ``` On the initial Google Pay charge request, include `"setup_future_usage": "off_session"` inside your `source_data` object. This tells the issuing bank that the card will be used for future merchant-initiated transactions. The charge response returns the values you need for all future recurring charges: ```json { "id": "chrg_687257433738839041", "payment_method": "pm_card_687257443142470657", "underlying_network_id": "2858e1b8-c453-4ef9-8940-18c2e159725c", "status": "succeeded" } ``` Store both the `payment_method` ID and the `underlying_network_id` against the customer record in your database. You will need these for future recurring charges. ## Create recurring charges or subscriptions [#create-recurring-charges-or-subscriptions] Once you have the `pm_card_...` ID, you can use it to charge the customer without them being present. There are two paths depending on your billing model: * **Recurring charges**: trigger each charge manually using the stored `pm_card_...` ID with `"off_session": true`. See the [recurring charges guide](/payments/saved-cards/recurring-charges) for the full request format, all targeting methods, response handling, and webhook events. * **Subscriptions**: attach the stored `pm_card_...` ID to a subscription package and let Pay.com manage the billing schedule automatically. See the [subscriptions guide](/commerce/create-a-subscription) for the full setup instructions. Google Pay generates a new payment token on every transaction. Recurring charges are made against the underlying card that Pay.com extracts during the initial payment, not against the Google Pay wallet itself. # Neteller (/documentation/payment-methods/wallets/neteller) Neteller is a digital wallet that customers fund by bank transfer, card, or other local methods. At checkout, customers log in to Neteller and pay from their account balance. ## Payment method properties [#payment-method-properties] Neteller is available to customers worldwide, and payments are confirmed immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `neteller` | | How customers pay | Redirect to the provider | | Customer countries | Global | | Currencies | AED, ARS, AUD, BHD, BRL, CAD, CHF, CLP, CNY, COP, CRC, CZK, DKK, EUR, GBP, HKD, HUF, INR, JOD, JPY, KES, KRW, KWD, MAD, MXN, MYR, NGN, NOK, NZD, PEN, PLN, RON, RSD, RUB, SAR, SEK, SGD, THB, TND, TWD, USD, ZAR | | Refunds | Full only | | Recurring payments | No | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Settlement currencies | EUR, GBP, USD | | Payment confirmation | Immediate | ## Customer payment flow [#customer-payment-flow] When a customer selects Neteller at checkout, Pay.com redirects them to a Neteller-hosted page where they log in and confirm the payment from their account balance. ### Select Neteller and proceed [#select-neteller-and-proceed] The customer selects Neteller on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the Neteller-hosted payment page. ### Log in to Neteller [#log-in-to-neteller] The customer enters their Neteller account email and password on the Neteller-hosted page. ### Confirm the payment [#confirm-the-payment] The customer reviews the payment amount and confirms. Neteller deducts the funds from the customer's account balance. ### Return to your site [#return-to-your-site] After the customer confirms payment, Neteller posts the result back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication`. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] To accept Neteller, you need a Pay.com account with Neteller enabled, a business in an accepted industry, and a Content Security Policy that allows the Neteller payment page. **Account prerequisites:** * You must have an active Pay.com merchant account with Neteller enabled. Contact your account manager to enable Neteller for your account. * You don't need a separate Neteller merchant account. Pay.com manages the Neteller integration for you. * Your business must operate in an accepted industry. Neteller supports merchants in licensed gambling, regulated forex, crypto, adult, travel, e-commerce retail, and video games. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The Neteller payment page is served by Neteller's servers. Make sure your Content Security Policy allows `*.neteller.com` as a `frame-src` directive value. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Neteller for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). If Neteller isn't listed in the dashboard, ask your account manager to enable it first. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Neteller charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ----------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Neteller hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, or Neteller declined the payment | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Neteller payment only in full. Refunded funds return to the customer's Neteller balance. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and omit `amount_to_refund`. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Recurring payments [#recurring-payments] You can't charge a saved Neteller account later without the customer. After a Neteller payment, Pay.com saves the customer's account (`pm_neteller_...`), and you can [pay out to it](/payouts/methods/neteller), but you can't take another payment with it. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/neteller/integrate-at-checkout): Accept Neteller payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/neteller/integrate-at-checkout) You can accept Neteller payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Neteller in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Neteller payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Neteller. Before you start, ask your account manager to enable Neteller for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Neteller in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"neteller"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "neteller"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Neteller and clicks **Pay**, Pay.com.js opens Neteller in a window over your page or in a new tab, depending on your account configuration. * In a window over your page: if the customer closes it, Pay.com.js calls `onFailure`. * In a new tab: your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Neteller payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"neteller"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Neteller is available [#check-that-neteller-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Neteller button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const neteller = methods.find((method) => method.paymentMethodType === 'neteller') ``` ### Start the payment [#start-the-payment] When the customer selects Neteller, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'neteller'`. ```javascript try { await checkout.headless('neteller') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Neteller in a window over your page or in a new tab, depending on your account configuration. * In a window over your page: if the customer closes it, Pay.com.js calls `onFailure`. * In a new tab: your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Neteller payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Neteller. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"neteller"`. Pay.com sends `source_data.billing_details.email` to Neteller as the email of the customer's Neteller account. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "neteller", "billing_details": { "email": "jane.smith@example.com" } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "neteller" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Neteller redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled or declined payment. ## Neteller options [#neteller-options] Set these in `payment_method_options.neteller` on the payment session or the charge. | Option | Type | Description | | ------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------- | | `verification.enabled` | boolean | Whether the verification feature is enabled. | | `verification.accepted_verification_level_values` | array of string | List of accepted verification levels. | | `verification.require_match_for_customer_details.first_name` | boolean | Whether to require an exact match on the customer's first name. | | `verification.require_match_for_customer_details.last_name` | boolean | Whether to require an exact match on the customer's last name. | | `verification.require_match_for_customer_details.country` | boolean | Whether to require an exact match on the customer's country/region. | | `verification.require_match_for_customer_details.postal_code` | boolean | Whether to require an exact match on the customer's postal/ZIP code. | | `verification.require_match_for_customer_details.line1` | boolean | Whether to require an exact match on the first line of the street address. | | `verification.require_match_for_customer_details.dob` | boolean | Whether to require an exact match on the customer's date of birth. | ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, Pay.com displays a payment simulator instead of Neteller's page. It shows the payment's ID and lets you choose a **Payment Status** and a **Result Code** before clicking **Submit**. With Pay.com.js, the simulator opens in place of Neteller's page. From your server, open the authentication session's `url` in a browser. | Payment status | Result | | ------------------- | ------------------------------------------------------------------------------------------------------ | | `COMPLETED` | The charge moves to `succeeded`, the `charge.succeeded` event fires, and Pay.com.js calls `onSuccess`. | | `PROCESSING` | The charge stays `pending`, and Pay.com.js calls `onPending`. | | `FAILED` or `ERROR` | The charge moves to `failed`, the `charge.failed` event fires, and Pay.com.js calls `onFailure`. | To test a customer who leaves without paying, close the simulator without submitting. The charge stays `requires_authentication`. # BANCOMAT Pay (/documentation/payment-methods/wallets/bancomat-pay) BANCOMAT Pay is an Italian mobile payment service from BANCOMAT, available to all PagoBANCOMAT cardholders in their bank's app or the BANCOMAT Pay app, which links to their bank account by phone number and IBAN. Customers enter their mobile number on the BANCOMAT Pay payment page and confirm the payment in the app with a PIN, fingerprint, or face recognition. ## Payment method properties [#payment-method-properties] BANCOMAT Pay takes EUR payments from customers in Italy, and confirms them immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `bancomatpay` | | How customers pay | Redirect to the provider | | Customer countries | Italy | | Refunds | Full and partial | | Recurring payments | No | | Disputes | Yes | | Integrations | Headless checkout, API, Universal checkout | | Merchant countries | EU | | Payment confirmation | Immediate | | Settlement timing | T+3 (business days). Subject to Pay.com risk review | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | EUR | 1 | No maximum | ## Customer payment flow [#customer-payment-flow] When a customer selects BANCOMAT Pay at checkout, they receive a payment request notification on their mobile device and confirm it in their banking app. ### Select BANCOMAT Pay and proceed [#select-bancomat-pay-and-proceed] The customer selects BANCOMAT Pay on your checkout page and clicks **Pay**. Pay.com redirects the customer to the BANCOMAT Pay payment page. ### Enter phone number [#enter-phone-number] On the BANCOMAT Pay payment page, the customer enters their Italian mobile phone number (+39) linked to their BANCOMAT Pay account and clicks **Continue**. The page shows a countdown timer for the session. ### Receive the payment request [#receive-the-payment-request] On their mobile device, the customer receives a payment request notification from their bank's app or the BANCOMAT Pay app. ### Review the transaction [#review-the-transaction] The customer opens the BANCOMAT Pay app or their bank's app to review the payment details, including the amount and merchant name. ### Approve the payment [#approve-the-payment] The customer confirms the transaction using their fingerprint, face recognition, or PIN code. The payment is debited from their linked bank account. ### Receive confirmation [#receive-confirmation] The customer receives a transaction confirmation on their mobile device. A confirmation message appears on your checkout page. If the customer closes the payment page or doesn't approve the payment request in their app, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] BANCOMAT Pay works with your standard Pay.com integration once it's enabled on your account. **Account prerequisites:** * You must have an active Pay.com merchant account with BANCOMAT Pay enabled. Contact your account manager to enable BANCOMAT Pay for your account. * You don't need a separate BANCOMAT Pay merchant account. Pay.com manages the integration for you. * Your business must operate in an accepted industry. See the [accepted and prohibited industries](#accepted-and-prohibited-industries) section for details. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The BANCOMAT Pay payment flow involves a redirect. Make sure your Content Security Policy allows the redirect. ### Dashboard configuration [#dashboard-configuration] After your account manager enables BANCOMAT Pay for your account, turn it on for checkout in the Pay.com dashboard. If BANCOMAT Pay isn't listed in the dashboard, ask your account manager to enable it first. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a BANCOMAT Pay charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ----------------------------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and BANCOMAT Pay hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, BANCOMAT Pay declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a BANCOMAT Pay payment in full or in part. Refunded funds return to the customer's bank account. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Disputes [#disputes] BANCOMAT Pay transactions carry chargeback risk. Customers can raise disputes through their bank, and the dispute reaches Pay.com through the payment network. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. ## Accepted and prohibited industries [#accepted-and-prohibited-industries] BANCOMAT Pay is available to merchants in the following industries. **Low risk:** * E-commerce retail * Travel * Skill games * Digital goods * Forex (regulated) **Restricted (case by case):** * Gambling (licensed) **Prohibited:** * Financial services (regulated) * Pharma (prescription drugs) * Adult content and services * Dating services * Cryptocurrency Industry restrictions are set by the payment method provider and may change. Contact your account manager if you're unsure whether your business qualifies. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/bancomat-pay/integrate-at-checkout): Accept BANCOMAT Pay payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/bancomat-pay/integrate-at-checkout) You can accept BANCOMAT Pay payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays BANCOMAT Pay in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the BANCOMAT Pay payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to BANCOMAT Pay. Before you start, ask your account manager to enable BANCOMAT Pay for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays BANCOMAT Pay in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"bancomatpay"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "bancomatpay"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects BANCOMAT Pay and clicks **Pay**, Pay.com.js opens BANCOMAT Pay in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the BANCOMAT Pay payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"bancomatpay"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that BANCOMAT Pay is available [#check-that-bancomat-pay-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your BANCOMAT Pay button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const bancomatpay = methods.find((method) => method.paymentMethodType === 'bancomatpay') ``` ### Start the payment [#start-the-payment] When the customer selects BANCOMAT Pay, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'bancomatpay'`. ```javascript try { await checkout.headless('bancomatpay') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens BANCOMAT Pay in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a BANCOMAT Pay payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to BANCOMAT Pay. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"bancomatpay"`. Pay.com passes `source_data.billing_details` to BANCOMAT Pay to prefill its page for the customer. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "bancomatpay", "billing_details": { "name": "Marco Rossi", "address": { "country": "IT" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "bancomatpay" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, BANCOMAT Pay redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, you can verify each step up to the redirect to BANCOMAT Pay's page. | Step | Expected result | | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------- | | Create a charge | `POST /v1/charges` with `source_data.type` set to `"bancomatpay"` returns `status: "requires_authentication"`. | | Get the redirect URL | `POST /v1/sessions/authentication/linked` with the charge's `id` returns a `url`. | | Reach BANCOMAT Pay | Opening the `url` in a browser loads BANCOMAT Pay's page with the payment's amount. | | Display BANCOMAT Pay in Universal checkout | A payment session with `"bancomatpay"` in `payment_method_types` displays BANCOMAT Pay in the form. | | Find BANCOMAT Pay with Headless checkout | `checkout.getPaymentMethods()` returns an entry with `paymentMethodType: "bancomatpay"`. | # Revolut Pay (/documentation/payment-methods/wallets/revolut-pay) Revolut Pay is a digital wallet and checkout method operated by Revolut. Customers confirm the payment in the Revolut app or by scanning a QR code, and customers without a Revolut account can pay with a credit or debit card in the same checkout. ## Payment method properties [#payment-method-properties] Revolut Pay takes payments from customers in the EU and the UK, confirms them immediately, and settles within 24 hours. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `revolut` | | How customers pay | Redirect to the provider | | Customer countries | Austria, Belgium, Bulgaria, Croatia, Cyprus, Czechia, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, United Kingdom | | Currencies | GBP, EUR, USD, AUD, CAD, CHF, CZK, DKK, HKD, HUF, ILS, MXN, NOK, NZD, PLN, JPY, RON, SEK, SGD, THB, TRY, ZAR, AED, BGN, CLP, COP, INR, ISK, KRW, PHP, QAR, RSD, SAR | | Refunds | Full and partial | | Recurring payments | Yes | | Disputes | Yes | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | United Kingdom, Australia, Singapore, Austria, Belgium, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Iceland, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Norway, Poland, Romania, Slovakia, Slovenia, Spain, Sweden | | Settlement currencies | GBP, EUR, USD, AUD, CAD, CHF, DKK, HKD, HUF, ILS, MXN, NOK, NZD, PLN, JPY, RON, SEK, SGD, THB, TRY, ZAR, AED, BGN, CLP, COP, INR, ISK, KRW, PHP, QAR, RSD, SAR | | Payment confirmation | Immediate | | Settlement timing | Within 24 hours (T+1) | ## Customer payment flow [#customer-payment-flow] When a customer selects Revolut Pay at checkout, the payment flow depends on the customer's device and whether they have a Revolut account. ### Revolut account holders [#revolut-account-holders] Customers with a Revolut account confirm the payment in the Revolut app. #### Select Revolut Pay and proceed [#select-revolut-pay-and-proceed] The customer selects Revolut Pay on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the Revolut Pay payment page. #### Authenticate the payment [#authenticate-the-payment] The authentication method depends on the customer's device: * **Mobile (app installed):** The Revolut app opens automatically and prompts the customer to confirm the payment with biometrics (Face ID, Touch ID, or fingerprint) or a passcode. * **Mobile (app not installed):** A WebView-based guest checkout flow opens in the browser, where the customer signs in to their Revolut account and confirms the payment. * **Desktop:** A QR code appears on screen. The customer scans it with their phone camera, which opens the Revolut app for biometric or passcode confirmation. #### Confirm the payment [#confirm-the-payment] The Revolut app shows the final payment amount. The customer taps **Pay** to confirm. The payment is processed as a card transaction through the card network. #### Return to your site [#return-to-your-site] After the customer confirms payment, Revolut posts the result back to Pay.com. The customer is redirected to your site. ### Customers without a Revolut account [#customers-without-a-revolut-account] Customers without a Revolut account can also pay through Revolut Pay. #### Enter payment details [#enter-payment-details] The customer clicks Revolut Pay and enters their email address and any major credit or debit card number in the guest checkout form. #### Save details (optional) [#save-details-optional] After the first purchase, the customer can save their payment details in the Revolut Pay checkout for faster one-click payments later. #### Complete payment [#complete-payment] The card payment is processed through the card network. The customer is redirected to your site once the payment is confirmed. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] To accept Revolut Pay, you need a Pay.com account with Revolut Pay enabled, a business in a supported industry, and a Content Security Policy that allows the Revolut Pay payment page. **Account prerequisites:** * You must have an active Pay.com merchant account with Revolut Pay enabled. Contact your account manager to enable Revolut Pay for your account. * You don't need a separate Revolut merchant account. Pay.com manages the Revolut Pay integration for you. * Your business must operate in an accepted industry. See [Prohibited and restricted industries](#prohibited-and-restricted-industries). **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The Revolut Pay payment page is served by Revolut's servers. Make sure your Content Security Policy allows `*.revolut.com` as a `frame-src` directive value. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Revolut Pay for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). If Revolut Pay isn't listed in the dashboard, ask your account manager to enable it first. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Revolut Pay charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Revolut Pay hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, Revolut Pay declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Revolut Pay payment in full or in part. Refunded funds return to the card the customer paid with. You can refund a payment more than once, up to 180 days after the payment. Each refund starts as `pending` and usually completes within 5 minutes, so wait for the `refund.succeeded` or `refund.failed` event. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Disputes [#disputes] Revolut Pay transactions are processed as card payments behind the Revolut login and follow standard card network (Visa, Mastercard) dispute and chargeback rules. ### How a dispute starts [#how-a-dispute-starts] The dispute process depends on how the customer paid: * **Revolut account holders:** Revolut is the card issuer. The customer opens the Revolut app, goes to the transaction, and reports a problem. Revolut then starts a chargeback through the card network for the customer. * **Customers without a Revolut account (guest checkout):** The customer used their own credit or debit card. They contact their card issuer directly (for example, their bank) to dispute the charge, like any standard card dispute. In both cases, the dispute reaches Pay.com the same way, through the card network, and you handle it the same way. Because Revolut Pay uses a tokenized card rather than the customer's real card number, dispute records in Pay.com and on your card network statement reference the underlying card, not the Revolut Pay wallet. The Revolut login helps reduce fraud, but it doesn't eliminate dispute risk. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. ## Recurring payments [#recurring-payments] Contact your account manager to check whether recurring Revolut Pay payments are available on your account before you build a recurring flow. Revolut Pay supports recurring payments through saved payment methods. The customer gives the merchant permission to start future transactions without further action from the customer. If recurring payments are enabled on your account, these Revolut limits apply: * Only merchant-initiated transactions are supported for recurring Revolut Pay payments. * Subscription contracts can't extend beyond 12 months without renewal (see [prohibited and restricted industries](#prohibited-and-restricted-industries)). ## Prohibited and restricted industries [#prohibited-and-restricted-industries] Revolut Pay inherits the industry restrictions that apply to Revolut merchant accounts. These industries are **not supported**: * Adult content and services * Dating services (dating apps, matchmaking sites, coaching or advice providers) * Digital games (merchants distributing game keys, in-app purchases within games) * Gambling (licensed and unlicensed) * Unregulated financial services (loan lenders, payday loan companies, debt or credit consolidation, debt collection agencies) * Cryptocurrency exchanges, brokers, mining, and trading firms * Weapons, defense, and armaments * Drop-shipping business models * Marketplaces (may be restricted rather than prohibited) * Nicotine and tobacco products * Multi-level marketing * Illegal or counterfeit goods Some industries are **restricted** and may be onboarded with different terms, including reserve requirements: * Airlines and air carriers * Alcohol sales * Travel providers, agencies, and tour operators * Digital goods and applications * Electronics, computer equipment, and software services * High-value goods (jewelry, precious metals, and stones) * Subscription models (contracts can't extend beyond 12 months without renewal) * Medical and dental services (where not prohibited) The full list of prohibited and restricted industries changes with Revolut's offerings and partner agreements. Contact your account manager for the current eligibility rules. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/revolut-pay/integrate-at-checkout): Accept Revolut Pay payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/revolut-pay/integrate-at-checkout) You can accept Revolut Pay payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Revolut Pay in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Revolut Pay payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Revolut Pay. Before you start, ask your account manager to enable Revolut Pay for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Revolut Pay in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"revolut"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "revolut"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Revolut Pay and clicks **Pay**, Pay.com.js opens Revolut Pay in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Revolut Pay payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"revolut"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Revolut Pay is available [#check-that-revolut-pay-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Revolut Pay button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const revolut = methods.find((method) => method.paymentMethodType === 'revolut') ``` ### Start the payment [#start-the-payment] When the customer selects Revolut Pay, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'revolut'`. ```javascript try { await checkout.headless('revolut') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Revolut Pay in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Revolut Pay payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Revolut Pay. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"revolut"`. Pay.com passes `source_data.billing_details` to Revolut Pay to prefill its page for the customer. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "revolut", "billing_details": { "address": { "country": "DE" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "revolut" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Revolut Pay redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, Pay.com displays a payment simulator instead of Revolut Pay's page. It shows the payment's ID and lets you choose a **Payment Status** and a **Result Code** before clicking **Submit**. With Pay.com.js, the simulator opens in place of Revolut Pay's page. From your server, open the authentication session's `url` in a browser. | Payment status | Result | | ------------------- | ------------------------------------------------------------------------------------------------------ | | `COMPLETED` | The charge moves to `succeeded`, the `charge.succeeded` event fires, and Pay.com.js calls `onSuccess`. | | `PROCESSING` | The charge stays `pending`, and Pay.com.js calls `onPending`. | | `FAILED` or `ERROR` | The charge moves to `failed`, the `charge.failed` event fires, and Pay.com.js calls `onFailure`. | To test a customer who leaves without paying, close the simulator without submitting. The charge stays `requires_authentication` until the authentication session expires, then moves to `failed`. # PayPal (/documentation/payment-methods/wallets/paypal) PayPal is a digital wallet. Customers log in to PayPal and pay from their PayPal balance, a linked bank account, or a saved card. ## Payment method properties [#payment-method-properties] PayPal takes payments in 24 currencies from customers in every country except sanctioned ones, and confirms them immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `paypal` | | How customers pay | Redirect to the provider | | Customer countries | Global | | Currencies | AUD, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HKD, HUF, ILS, JPY, MXN, MYR, NOK, NZD, PHP, PLN, SEK, SGD, THB, TWD, USD | | Refunds | Full and partial | | Recurring payments | Yes | | Authorize and capture later | Yes | | Disputes | Yes | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | Global (excluding sanctioned countries) | | Payment confirmation | Immediate | ## Customer payment flow [#customer-payment-flow] When a customer selects PayPal at checkout, they're redirected to PayPal to log in and confirm the payment. The exact flow depends on the customer's PayPal account setup and funding source. ### Select PayPal and proceed [#select-paypal-and-proceed] The customer selects PayPal on your checkout page and clicks **Pay**. Pay.com creates a charge and generates a redirect URL to the PayPal authorization page. ### Log in to PayPal [#log-in-to-paypal] The customer is redirected to PayPal and logs in with their email and password. If the customer has two-factor authentication turned on, they complete that step as well. ### Choose a funding source and confirm [#choose-a-funding-source-and-confirm] PayPal displays the payment amount and available funding sources (balance, linked bank account, or saved card). The customer selects a funding source and clicks **Complete Purchase** to authorize the payment. ### Return to your site [#return-to-your-site] After the customer confirms payment, PayPal posts the result back to Pay.com. The customer is redirected to your `return_url` and the charge moves to `succeeded`. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] PayPal works with your standard Pay.com integration once it's enabled on your account. **Account prerequisites:** * You must have an active Pay.com merchant account with PayPal enabled. Contact your account manager to enable PayPal for your account. * You don't need a separate PayPal merchant account. Pay.com manages the PayPal integration on your behalf. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * If you use an iframe-based checkout, make sure your Content Security Policy allows `*.paypal.com` as a `frame-src` directive value. ### Dashboard configuration [#dashboard-configuration] After your account manager enables PayPal for your account, turn it on for checkout in the Pay.com dashboard. If PayPal isn't listed in the dashboard, ask your account manager to enable it first. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a PayPal charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ----------------------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and PayPal hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, PayPal declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a PayPal payment in full or in part. You can refund a payment more than once, up to 180 days after the payment. Refunds in BRL, CNY, and MYR are available only for in-country accounts. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Disputes [#disputes] Customers can dispute PayPal transactions either through PayPal's own protection program or, for card-funded payments, through the card network chargeback process. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. ## Recurring payments [#recurring-payments] PayPal supports recurring payments through saved payment methods. When a customer completes the initial payment with `setup_future_usage: "off_session"` (inside `source_data` on `POST /v1/charges`, or on the payment session for the SDK), their PayPal account is saved as a reusable `pm_paypal_…` payment method. You can then charge the saved payment method for future transactions, and the customer doesn't need to log in to PayPal again. When its `flow_directions.payout` is `true`, you can also pay out to it. See [Pay out to a saved PayPal account](/payouts/methods/paypal#pay-out-to-a-saved-paypal-account). Contact your account manager to verify that recurring PayPal payments are available on your account. ## Accepted industries [#accepted-industries] PayPal classifies restricted and high-risk verticals by Merchant Category Code (MCC). See the [PayPal acceptable use policy](https://www.paypal.com/us/legalhub/acceptableuse-full) for the full list of prohibited and restricted activities. Industry restrictions are set by PayPal and may change. Contact your account manager if you're unsure whether your business qualifies. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/paypal/integrate-at-checkout): Accept PayPal payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/paypal/integrate-at-checkout) You can accept PayPal payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays PayPal in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the PayPal payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to PayPal. Before you start, ask your account manager to enable PayPal for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays PayPal in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"paypal"` in `payment_method_types`. ```json { "amount": 5000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method_types": ["card", "paypal"] } ``` Amounts are in the currency's minor unit, so `5000` is $50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects PayPal and clicks **Pay**, Pay.com.js opens PayPal in a window over your page or in a new tab, depending on your account configuration. * In a window over your page: if the customer closes it, Pay.com.js calls `onFailure`. * In a new tab: your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the PayPal payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"paypal"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that PayPal is available [#check-that-paypal-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your PayPal button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const paypal = methods.find((method) => method.paymentMethodType === 'paypal') ``` ### Start the payment [#start-the-payment] When the customer selects PayPal, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'paypal'`. ```javascript try { await checkout.headless('paypal') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens PayPal in a window over your page or in a new tab, depending on your account configuration. * In a window over your page: if the customer closes it, Pay.com.js calls `onFailure`. * In a new tab: your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a PayPal payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to PayPal. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"paypal"`. Pay.com passes `source_data.billing_details` to PayPal to prefill its page for the customer. ```json { "amount": 5000, "currency": "usd", "source_data": { "type": "paypal", "billing_details": { "name": "Jane Smith", "email": "jane.smith@example.com", "address": { "country": "US" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "usd", "status": "requires_authentication", "payment_method_details": { "type": "paypal" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, PayPal redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## PayPal options [#paypal-options] Set these in `payment_method_options.paypal` on the payment session or the charge. | Option | Type | Description | | ------------------- | ------- | ---------------------------------------------- | | `name_verification` | boolean | Whether to perform customer name verification. | ## More PayPal options [#more-paypal-options] These options change the server-to-server flow. | Option | Effect | | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Authorize only (hold) | `POST /v1/charges` has no `capture` field. Send the same body to [`POST /v1/holds`](/api-reference/endpoints/holds/create-hold) instead, and create the linked authentication session with the `hld_…` ID. After approval, capture with [`POST /v1/holds/{id}/capture`](/api-reference/endpoints/holds/create-capture) (optionally with `amount_to_capture`) or void with [`POST /v1/holds/{id}/cancel`](/api-reference/endpoints/holds/hold-cancel). | | `source_data.setup_future_usage: "off_session"` | Saves the customer's PayPal account as a reusable `pm_paypal_…` payment method on approval. On the SDK path, set `setup_future_usage` on the payment session instead. | ## Testing [#testing] Test against `https://api.sandbox.pay.com/v1` with your `sk-pay-com-sandbox-` API key. Test transactions never move real funds. See [Environments](/get-started/environments). ### PayPal sandbox account [#paypal-sandbox-account] In the sandbox, PayPal payments complete in PayPal's own sandbox, so you need a PayPal sandbox personal account. Create one in the [PayPal Developer Dashboard](https://developer.paypal.com/dashboard/accounts) under PayPal's **Testing tools** → **Sandbox accounts**, or ask your Pay.com account manager for the personal account set up for your sandbox merchant. When you choose a funding source in PayPal's sandbox, select **PayPal balance**. Cards linked to PayPal sandbox accounts may be declined by the card issuer. ### Sandbox behavior [#sandbox-behavior] In the sandbox, Pay.com redirects to the **PayPal sandbox** environment (PayPal's `sandbox.paypal.com` site) instead of the live PayPal site. PayPal's sandbox is a full replica of the PayPal checkout experience, including the login page, funding source selection, and payment confirmation. * **SDK integration:** the PayPal sandbox login opens in a window over your page or in a new tab, depending on your account configuration. * **Server-to-server integration:** the linked authentication session returns a redirect `url`. Opening this URL in a browser redirects to the PayPal sandbox login page. Log in with your PayPal sandbox personal account, select **PayPal balance** as the funding source, and click **Complete Purchase** to complete the test payment. After approval, PayPal redirects back to your `return_url` and the charge moves to `succeeded`. ### Test scenarios [#test-scenarios] Run each scenario against the PayPal sandbox. | Scenario | Test action | Expected result | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Successful payment | Log in to the PayPal sandbox, select **PayPal balance**, and click **Complete Purchase** | Charge `status: "succeeded"`. `charge.succeeded` webhook fires. SDK `onSuccess` callback fires. | | Customer abandons | Close the PayPal sandbox window or click **Cancel and return to store** | Charge stays in `requires_authentication` until the authentication session expires (60 minutes by default), then moves to `failed`. `charge.failed` webhook fires. | | Hold and capture | Create a hold with `POST /v1/holds`, complete the PayPal sandbox flow, then capture the `hld_…` ID with `POST /v1/holds/{id}/capture` | The hold is captured and `hold.succeeded` fires. | | Save payment method | Create a charge with `source_data.setup_future_usage: "off_session"` and complete the PayPal sandbox flow | A reusable `pm_paypal_…` payment method is saved. | # Skrill (/documentation/payment-methods/wallets/skrill) Skrill is a digital wallet. Customers store funds in their Skrill account and pay from their balance on a Skrill-hosted page, without sharing card or bank details. ## Payment method properties [#payment-method-properties] Skrill is available to customers worldwide, settles in EUR, GBP, or USD, and confirms payments immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `skrill` | | How customers pay | Redirect to the provider | | Customer countries | Global | | Currencies | AED, ARS, AUD, BGN, BHD, BRL, CAD, CHF, CLP, CNY, COP, CRC, CZK, DKK, EUR, GBP, HKD, HUF, ILS, INR, ISK, JOD, JPY, KES, KRW, KWD, MAD, MXN, MYR, NGN, NOK, NZD, OMR, PEN, PLN, QAR, RON, RSD, RUB, SAR, SEK, SGD, THB, TND, TRY, TWD, USD, ZAR | | Refunds | Full only | | Recurring payments | No | | Disputes | No | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | Global | | Settlement currencies | EUR, GBP, USD | | Payment confirmation | Immediate | ## Customer payment flow [#customer-payment-flow] When a customer selects Skrill at checkout, Pay.com redirects them to a Skrill-hosted page where they log in and confirm the payment from their account balance. ### Select Skrill and proceed [#select-skrill-and-proceed] The customer selects Skrill on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the Skrill-hosted payment page. ### Log in to Skrill [#log-in-to-skrill] The customer enters their Skrill account email and password on the Skrill-hosted page. ### Confirm the payment [#confirm-the-payment] The customer reviews the payment amount and confirms. If the payment currency differs from the customer's Skrill account currency, Skrill shows the converted amount before the customer confirms. Skrill deducts the funds from the customer's account balance. ### Return to your site [#return-to-your-site] After the customer confirms payment, Skrill posts the result back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication`. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] To accept Skrill, you need a Pay.com account with Skrill enabled, a business in an accepted industry, and a Content Security Policy that allows the Skrill payment page. **Account prerequisites:** * You must have an active Pay.com merchant account with Skrill enabled. Contact your account manager to enable Skrill for your account. * You don't need a separate Skrill merchant account. Pay.com manages the Skrill integration for you. * Your business must operate in an accepted industry. Skrill supports merchants in licensed gambling, regulated forex, crypto, adult, travel, e-commerce retail, and video games. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The Skrill payment page is served by Skrill's servers. Make sure your Content Security Policy allows `*.skrill.com` as a `frame-src` directive value. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Skrill for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). If Skrill isn't listed in the dashboard, ask your account manager to enable it first. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Skrill charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | --------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Skrill hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, or Skrill declined the payment | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Skrill payment only in full. Refunded funds return to the customer's Skrill balance. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and omit `amount_to_refund`. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Recurring payments [#recurring-payments] You can't charge a saved Skrill account later without the customer. After a Skrill payment, Pay.com saves the customer's account (`pm_skrill_...`), and you can [pay out to it](/payouts/methods/skrill), but you can't take another payment with it. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/skrill/integrate-at-checkout): Accept Skrill payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/skrill/integrate-at-checkout) You can accept Skrill payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Skrill in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Skrill payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Skrill. Before you start, ask your account manager to enable Skrill for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Skrill in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"skrill"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "skrill"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Skrill and clicks **Pay**, Pay.com.js opens Skrill in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Skrill payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"skrill"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Skrill is available [#check-that-skrill-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Skrill button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const skrill = methods.find((method) => method.paymentMethodType === 'skrill') ``` ### Start the payment [#start-the-payment] When the customer selects Skrill, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'skrill'`. ```javascript try { await checkout.headless('skrill') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Skrill in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Skrill payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Skrill. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"skrill"`. Pay.com sends `source_data.billing_details.email` to Skrill as the email of the customer's Skrill account. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "skrill", "billing_details": { "email": "jane.smith@example.com" } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "skrill" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Skrill redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled or declined payment. ## Skrill options [#skrill-options] Set these in `payment_method_options.skrill` on the payment session or the charge. | Option | Type | Description | | ------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------- | | `verification.enabled` | boolean | Whether the verification feature is enabled. | | `verification.accepted_verification_level_values` | array of string | List of accepted verification levels. | | `verification.require_match_for_customer_details.first_name` | boolean | Whether to require an exact match on the customer's first name. | | `verification.require_match_for_customer_details.last_name` | boolean | Whether to require an exact match on the customer's last name. | | `verification.require_match_for_customer_details.country` | boolean | Whether to require an exact match on the customer's country/region. | | `verification.require_match_for_customer_details.postal_code` | boolean | Whether to require an exact match on the customer's postal/ZIP code. | | `verification.require_match_for_customer_details.line1` | boolean | Whether to require an exact match on the first line of the street address. | | `verification.require_match_for_customer_details.dob` | boolean | Whether to require an exact match on the customer's date of birth. | ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, Pay.com displays a payment simulator instead of Skrill's page. It shows the payment's ID and lets you choose a **Payment Status** and a **Result Code** before clicking **Submit**. With Pay.com.js, the simulator opens in place of Skrill's page. From your server, open the authentication session's `url` in a browser. | Payment status | Result | | ------------------- | ------------------------------------------------------------------------------------------------------ | | `COMPLETED` | The charge moves to `succeeded`, the `charge.succeeded` event fires, and Pay.com.js calls `onSuccess`. | | `PROCESSING` | The charge stays `pending`, and Pay.com.js calls `onPending`. | | `FAILED` or `ERROR` | The charge moves to `failed`, the `charge.failed` event fires, and Pay.com.js calls `onFailure`. | To test a customer who leaves without paying, close the simulator without submitting. The charge stays `requires_authentication`. # Venmo (/documentation/payment-methods/wallets/venmo) Venmo is a US digital wallet from PayPal. Customers pay from their Venmo account by approving the payment in Venmo or by scanning a QR code with the Venmo app. ## Payment method properties [#payment-method-properties] Venmo takes USD payments from customers in the United States, and confirms them immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `venmo` | | How customers pay | Redirect to the provider | | Customer countries | United States | | Currencies | USD | | Refunds | Full and partial | | Recurring payments | Yes | | Authorize and capture later | Yes | | Disputes | Yes | | Integrations | Universal checkout, Headless checkout, API | | Merchant countries | United States | | Payment confirmation | Immediate | ## Customer payment flow [#customer-payment-flow] When a customer selects Venmo at checkout, Pay.com redirects them to Venmo to confirm the payment. ### Select Venmo at checkout [#select-venmo-at-checkout] The customer selects Venmo on your checkout page and clicks **Pay**. Pay.com redirects the customer to Venmo to authorize the payment. ### Authorize the payment [#authorize-the-payment] The customer logs in to Venmo and confirms the payment. ### Return to your site [#return-to-your-site] After authorization, Venmo posts the result back to Pay.com. The customer is redirected to your `return_url` and the charge moves to `succeeded`. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication`. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] Venmo works with your standard Pay.com integration once it's enabled on your account. **Account prerequisites:** * You must have an active Pay.com merchant account with Venmo enabled. Contact your account manager to enable Venmo for your account. * You don't need a separate Venmo or PayPal merchant account. Pay.com manages the Venmo integration on your behalf. * Your business must be based in the United States. **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Venmo for your account, turn it on for checkout in the Pay.com dashboard. If Venmo isn't listed in the dashboard, ask your account manager to enable it first. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Venmo charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | -------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Venmo hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, or Venmo declined the payment | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Venmo payment in full or in part. You can refund a payment more than once, up to 180 days after the payment. Processing fees aren't refunded. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Disputes [#disputes] Venmo transactions can be disputed through PayPal's protection program for customers. To be eligible for a dispute, a payment from a customer to a business must be identified as a goods and services payment. See [Disputes](/risk/disputes) for the dispute lifecycle, evidence, and webhook events. ## Recurring payments [#recurring-payments] Venmo supports recurring payments through saved payment methods. When a customer completes the initial payment with `setup_future_usage: "off_session"` (inside `source_data` on `POST /v1/charges`, or on the payment session for the SDK), their Venmo account is saved as a reusable `pm_venmo_…` payment method. You can then charge the saved payment method for future transactions, and the customer doesn't need to authorize in the Venmo app again. When its `flow_directions.payout` is `true`, you can also pay out to it. See [Pay out to a saved Venmo account](/payouts/methods/venmo#pay-out-to-a-saved-venmo-account). Contact your account manager to verify that recurring Venmo payments are available on your account. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/venmo/integrate-at-checkout): Accept Venmo payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/venmo/integrate-at-checkout) You can accept Venmo payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Venmo in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Venmo payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Venmo. Before you start, ask your account manager to enable Venmo for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Venmo in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"venmo"` in `payment_method_types`. ```json { "amount": 5000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method_types": ["card", "venmo"] } ``` Amounts are in the currency's minor unit, so `5000` is $50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Venmo and clicks **Pay**, Pay.com.js opens Venmo in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Venmo payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"venmo"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Venmo is available [#check-that-venmo-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Venmo button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const venmo = methods.find((method) => method.paymentMethodType === 'venmo') ``` ### Start the payment [#start-the-payment] When the customer selects Venmo, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'venmo'`. ```javascript try { await checkout.headless('venmo') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Venmo in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Venmo payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Venmo. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"venmo"`. Pay.com passes `source_data.billing_details` to Venmo to prefill its page for the customer. ```json { "amount": 5000, "currency": "usd", "source_data": { "type": "venmo", "billing_details": { "name": "Jane Smith", "email": "jane.smith@example.com", "address": { "country": "US" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "usd", "status": "requires_authentication", "payment_method_details": { "type": "venmo" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Venmo redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled or declined payment. ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, you can verify each step up to the redirect to Venmo's page. | Step | Expected result | | ----------------------------------- | -------------------------------------------------------------------------------------------------------- | | Create a charge | `POST /v1/charges` with `source_data.type` set to `"venmo"` returns `status: "requires_authentication"`. | | Get the redirect URL | `POST /v1/sessions/authentication/linked` with the charge's `id` returns a `url`. | | Reach Venmo | Opening the `url` in a browser loads Venmo's page with the payment's amount. | | Display Venmo in Universal checkout | A payment session with `"venmo"` in `payment_method_types` displays Venmo in the form. | | Find Venmo with Headless checkout | `checkout.getPaymentMethods()` returns an entry with `paymentMethodType: "venmo"`. | # Satispay (/documentation/payment-methods/wallets/satispay) Satispay is a mobile payment app for customers in Italy that works independently of the card networks. Customers link their bank account to the app and pay by entering their mobile number or scanning a QR code at checkout. Satispay includes payment assurance, so confirmed payments are guaranteed. ## Payment method properties [#payment-method-properties] Satispay takes EUR payments from customers in Italy and confirms them immediately. | Property | Details | | --- | --- | | Type | Digital wallet | | API type | `satispay` | | How customers pay | Redirect to the provider | | Customer countries | Italy | | Refunds | Full and partial | | Recurring payments | No | | Disputes | No | | Integrations | Headless checkout, API, Universal checkout | | Merchant countries | Austria, Belgium, Bulgaria, Switzerland, Cyprus, Czech Republic, Germany, Denmark, Estonia, Spain, Finland, France, Greece, Croatia, Hungary, Ireland, Italy, Liechtenstein, Lithuania, Luxembourg, Latvia, Monaco, Malta, Netherlands, Norway, Poland, Portugal, Romania, Sweden, Slovenia, Slovakia, San Marino, United Kingdom | | Payment confirmation | Immediate | | Settlement timing | T+3 (business days). Subject to Pay.com risk review | You can charge in these currencies. Amounts are in each currency's minor unit, such as cents. | Currency | Minimum amount | Maximum amount | | --- | --- | --- | | EUR | 1 | 9999999 | ## Customer payment flow [#customer-payment-flow] When a customer selects Satispay at checkout, they confirm the payment in their Satispay mobile app. ### Select Satispay and proceed [#select-satispay-and-proceed] The customer selects Satispay on your checkout page and clicks **Pay**. Pay.com generates a redirect URL and sends the customer to the Satispay-hosted payment page. ### Enter mobile number or scan QR code [#enter-mobile-number-or-scan-qr-code] The customer is redirected to a hosted payment page where they enter their mobile number linked to Satispay, or scan a QR code with their Satispay app. ### Confirm in the Satispay app [#confirm-in-the-satispay-app] The customer opens a payment notification in their Satispay app and confirms the transaction. The payment is debited from their linked bank account. ### Return to your site [#return-to-your-site] After the customer confirms payment, the result is posted back to Pay.com. The customer is redirected to your site. If the customer closes the payment page without completing authorization, the charge stays in `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed` and a `charge.failed` webhook event fires. Don't fulfill the order until you receive a `charge.succeeded` event. ## Before you begin [#before-you-begin] To accept Satispay, you need a Pay.com account with Satispay enabled, a business in an accepted industry, and a Content Security Policy that allows the Satispay payment page. **Account prerequisites:** * You must have an active Pay.com merchant account with Satispay enabled. Contact your account manager to enable Satispay for your account. * You don't need a separate Satispay merchant account. Pay.com manages the Satispay integration for you. * Your business must operate in an accepted industry. See [Accepted and prohibited industries](#accepted-and-prohibited-industries). **Technical prerequisites:** * No additional SDK or library is needed beyond the standard Pay.com integration. * The Satispay payment page is served externally. Make sure your Content Security Policy allows the redirect. ### Dashboard configuration [#dashboard-configuration] After your account manager enables Satispay for your account, turn it on for checkout in the Pay.com dashboard. See [Turn on payment methods](/payments/alternative-payment-methods#turn-on-payment-methods). If Satispay isn't listed in the dashboard, ask your account manager to enable it first. ## Handling payment events [#handling-payment-events] Pay.com sends these webhook events as a Satispay charge changes status. Creating a charge does not emit a webhook event. | Event | When it fires | What to do | | ------------------ | ------------------------------------------------------------------------------------------- | --------------------------------------------------- | | `charge.pending` | The customer approved the payment, and Satispay hasn't confirmed it yet | Wait for `charge.succeeded` or `charge.failed` | | `charge.succeeded` | The customer approved the payment, and it completed | Fulfill the order | | `charge.failed` | The customer canceled, Satispay declined the payment, or the authentication session expired | Ask the customer to pay again or use another method | Verify the `Pay-Signature` header before acting on an event. See [Verify webhook signatures](/developer-resources/webhooks#verify-webhook-signatures). ## Refunds [#refunds] You can refund a Satispay payment in full or in part. Refunded funds return to the customer's Satispay balance. You can refund a payment more than once, up to the charge amount. To refund it, send [`POST /v1/refunds`](/api-reference/endpoints/refunds/create-refund) with the charge's `id` as `charge`, and set `amount_to_refund` for a partial refund. See [Refund a charge](/payments/refunds) for refund statuses and webhook events. ## Accepted and prohibited industries [#accepted-and-prohibited-industries] Satispay is available to merchants in these industries. **Low risk:** * Retail * Travel * Skill games * Digital goods **Prohibited:** * Financial services (licensed) * Forex (regulated) * Gambling (licensed) * Pharma (prescription drugs) * Adult content and services * Dating services * Cryptocurrency The payment method provider sets these industry restrictions, and they can change. Contact your account manager if you're not sure whether your business qualifies. ## Next steps [#next-steps] * [Add to checkout](/documentation/payment-methods/wallets/satispay/integrate-at-checkout): Accept Satispay payments with Pay.com.js or from your server, and test them in the sandbox. * [Refund a charge](/payments/refunds): Review refund statuses and webhook events. * [Webhooks](/developer-resources/webhooks): Configure a webhook endpoint and verify signatures. # Add to checkout (/documentation/payment-methods/wallets/satispay/integrate-at-checkout) You can accept Satispay payments in three ways: * [Universal checkout](#universal-checkout): Pay.com.js displays Satispay in its payment form. * [Headless checkout](#headless-checkout): You build your own checkout UI, and Pay.com.js starts the Satispay payment when the customer selects it. * [Server-to-server](#server-to-server): You create the charge from your server and redirect the customer to Satispay. Before you start, ask your account manager to enable Satispay for your account, then [turn it on](/payments/alternative-payment-methods#turn-on-payment-methods) in the Pay.com dashboard. ## Universal checkout [#universal-checkout] Universal checkout displays Satispay in its payment form when the payment session includes it. ### Create a payment session [#create-a-payment-session] On your server, create a payment session with [`POST /v1/sessions/payment`](/api-reference/endpoints/paymentsessions/create-ps) and include `"satispay"` in `payment_method_types`. ```json { "amount": 5000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "satispay"] } ``` Amounts are in the currency's minor unit, so `5000` is €50.00. `customer_reference_id` is your own ID for the customer, and it's required. Return the session's `client_secret` to your page. ### Display the checkout [#display-the-checkout] On your page, initialize Pay.com.js with the `client_secret` and mount Universal checkout, as in [Universal checkout](/payments/universal-checkout). No method-specific configuration is required. ### Handle the result [#handle-the-result] When the customer selects Satispay and clicks **Pay**, Pay.com.js opens Satispay in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Headless checkout [#headless-checkout] With [Headless checkout](/payments/headless-checkout), you build your own checkout UI, and Pay.com.js starts the Satispay payment when the customer selects it. ### Create a payment session [#create-a-payment-session-1] Create the payment session on your server as in [Universal checkout](#universal-checkout), with `"satispay"` in `payment_method_types`, and initialize Pay.com.js with its `client_secret`. ### Check that Satispay is available [#check-that-satispay-is-available] Call [`checkout.getPaymentMethods()`](/sdks/pay-com-js/checkout-get-payment-methods), and show your Satispay button only when the list includes it. Don't use `checkout.canMakePayments()` for this, because it reports only Apple Pay and Google Pay. ```javascript const methods = await checkout.getPaymentMethods() const satispay = methods.find((method) => method.paymentMethodType === 'satispay') ``` ### Start the payment [#start-the-payment] When the customer selects Satispay, call [`checkout.headless()`](/sdks/pay-com-js/checkout-headless) with `'satispay'`. ```javascript try { await checkout.headless('satispay') } catch (error) { // onFailure receives the error details too. } ``` Pay.com.js opens Satispay in a window over your page. If the customer closes the window, Pay.com.js calls `onFailure`. When the customer finishes, Pay.com.js calls `onSuccess` if the payment succeeded, `onPending` if its result isn't final yet, or `onFailure` if it failed. Fulfill the order when you receive the `charge.succeeded` webhook event. ## Server-to-server [#server-to-server] From your server, a Satispay payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Satispay. ### Create the charge [#create-the-charge] Send [`POST /v1/charges`](/api-reference/endpoints/charges/create-charge) with `source_data.type` set to `"satispay"`. Pay.com passes `source_data.billing_details` to Satispay to prefill its page for the customer. ```json { "amount": 5000, "currency": "eur", "source_data": { "type": "satispay", "billing_details": { "name": "Marco Rossi", "address": { "country": "IT" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" } ``` ```json { "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "satispay" }, "reference": "order-12345", "test_mode": true } ``` The charge's `status` is `requires_authentication` until the customer approves the payment. ### Create a linked authentication session [#create-a-linked-authentication-session] Send [`POST /v1/sessions/authentication/linked`](/api-reference/endpoints/authenticationsessions/create-linked-authentication-session) with the charge's `id` as `resource` and the `return_url` to return the customer to. `confirm` defaults to `true`, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session. ```json { "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" } ``` ```json { "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } ``` ### Redirect the customer [#redirect-the-customer] Send the customer to the session's `url` with a full-page redirect. After they approve or cancel the payment, Satispay redirects them back to your `return_url`. Fulfill the order when you receive the `charge.succeeded` webhook event, and handle `charge.failed` as a canceled, declined, or abandoned payment. If the customer doesn't finish, the charge stays `requires_authentication` until the authentication session expires (60 minutes by default). It then moves to `failed`, and the `charge.failed` event fires. ## Test in the sandbox [#test-in-the-sandbox] Test with your sandbox API key (`sk-pay-com-sandbox-...`) against `https://api.sandbox.pay.com/v1`. Sandbox payments never move real funds. See [Environments](/get-started/environments). In the sandbox, you can verify each step up to the redirect to Satispay's page. | Step | Expected result | | -------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | Create a charge | `POST /v1/charges` with `source_data.type` set to `"satispay"` returns `status: "requires_authentication"`. | | Get the redirect URL | `POST /v1/sessions/authentication/linked` with the charge's `id` returns a `url`. | | Reach Satispay | Opening the `url` in a browser loads Satispay's page with the payment's amount. | | Display Satispay in Universal checkout | A payment session with `"satispay"` in `payment_method_types` displays Satispay in the form. | | Find Satispay with Headless checkout | `checkout.getPaymentMethods()` returns an entry with `paymentMethodType: "satispay"`. |