<yourcompany>.staging.payrails.io.
At the end of this guide, you have:
- A staging checkout that takes a test card, Apple Pay, and Google Pay through one Payrails workflow, and renews a subscription from a saved card.
- The same setup in production, taking real payments.
Assumptions
This guide assumes that:- Your go-live includes cards, Apple Pay, and Google Pay. Other methods, for example PayPal or local methods, go live with them or later on the same instances and workflow.
- Apple Pay runs on the web under the Payrails Apple merchant identifier. You use your Apple Developer account only to create a sandbox tester for staging tests.
- Google Pay uses the Payrails-hosted button, so you need no Google Pay & Wallet Console account.
- Your checkout uses one of two integration options, and the guide marks where they differ:
- Option A, Drop-in or Elements (recommended): Payrails renders the whole checkout (Drop-in) or one component per payment method (Elements), and the SDK runs the payment.
- Option B, Secure Fields and server-to-server: you build the form and Payrails hosts the card fields, so your servers never handle card numbers. Your backend creates and authorizes the payment through the API. Use it only if server-to-server is a strict requirement.
- One payment workflow handles the first payment (customer-initiated transaction, CIT) and later renewals (merchant-initiated transaction, MIT).
- You go through staging once, end to end, then repeat the same steps in production.
Go-live steps
Work through the six steps in order. Open a step to see its instructions and what done looks like.Step 1: Access and credentials
Step 1: Access and credentials
Portal access and API credentials
Portal access and API credentials
<yourcompany>.staging.payrails.io and adds colleagues under Settings → Users.API credentials. These identify your backend to Payrails. Full details are in API credentials.- In the Portal, open Settings → API credentials → Create credentials and name them, for example
checkout backend, staging. - Copy the Client ID and the Client Secret. The Portal shows the secret once, so store it in your secrets manager right away.
- Your backend exchanges them for an access token with
POST /auth/token/{CLIENT_ID}, sending the secret in thex-api-keyheader. The token is valid for one hour, and every other call carries it asAuthorization: Bearer.
mTLS certificate
mTLS certificate
- Open Settings → mTLS certificates → Create certificate. The Portal shows an OpenSSL command.
- Run it on a machine you control. It produces a private key, which never leaves your infrastructure, and a certificate signing request (CSR).
- Paste the CSR into the Portal and download the signed certificate.
- Install the certificate and the private key on your backend, or on the proxy that connects to Payrails.
access_token over mTLS. That one response proves the credentials and the certificate both work.Step 2: Payment instances and notifications
Step 2: Payment instances and notifications
Payment instances
Payment instances
- Pick the provider you plan to use in your workflow, for example Stripe, Adyen, or Checkout.com.
- Name the instance, for example
Stripe, test. The Portal generates an Integration instance ID and a Notification URL. Register that URL in the PSP’s dashboard so the PSP’s webhooks reach Payrails. - Under Payment methods, tick Card, Apple Pay, and Google Pay. Checkout offers only the methods ticked here.
- Enter the PSP’s test credentials. Never put live credentials in staging.
Special payment cases to check early
Special payment cases to check early
- Capture a payment and Capture and cancel modes for capturing less than the authorized amount or capturing one order in several parts
- Refund a payment for refunding part of a payment or refunding the same payment more than once
- Cancel a payment for releasing an authorization you don’t plan to capture
- Authorization flags and Billing for renewing subscriptions and charging a stored card outside the billing cycle
- Payment instruments and tokens and Network token lifecycle updates for managing saved cards and keeping them current
- Apple Pay Express for collecting the customer’s contact details in the Apple Pay or Google Pay sheet instead of a form (express checkout). Payrails sets these fields on your wallet configuration, not in your code, so tell Payrails which ones you need
Notifications (webhooks)
Notifications (webhooks)
- Open Configurations → Settings → Notifications and add your endpoint URL. Payrails shows an HMAC key for the endpoint once, so store it like a password. A URL belongs to one workspace and applies to payments created after you save it.
- Your endpoint receives a JSON
POSTand replies200. Payrails retries any other response, up to 10 attempts over about six hours. - Verify each notification: compute the HMAC-SHA256 of the raw body with the key, Base64-encode it, and compare it to the
X-Signatureheader.
Step 4: Payment workflow for first payments and renewals
Step 4: Payment workflow for first payments and renewals
The five parts of the workflow
The five parts of the workflow

Regular, CardOnFile, MOTO and everything else to an authorization step with 3DS mode Default. With that mode, a 3DS challenge appears only when the issuer requests one. Set Instrument future usage so Payrails saves the card, or the wallet token, for renewals.
meta.order.processingType: Subscription for a renewal, or UnscheduledCardOnFile for a one-off charge to a saved card. Send it when you create the execution, and never leave it out. Without it, Payrails falls back to the saved card’s future usage, so the PSP can receive the wrong transaction type. The same Condition routes it to an authorization step with no 3DS, against the saved instrument, on the same payment instance that holds the card.
authorize notification is your paid signal.

payment-acceptance, and Payrails runs whichever version you mark as Default.Common configurations for app publishers
Common configurations for app publishers
payment-acceptance workflow.payment-acceptance workflow, built from the Portal’s default template with the transaction type branches from this step. The currency template routes USD to a second payment instance as an example. To use a template:- Download it, then in the Portal open Workflows → Payment acceptance and select New version.
- Select Upload workflow configuration. The file opens in Workflow Studio as an unsaved version.
- Select your payment instance on every authorization step, because the templates name no instances. In the cascade and currency templates, pick a different instance on the second-PSP or
USDsteps, and changeUSDto your own currency. - In the fraud screening template, select your fraud provider on the fraud check step.
- Check that the start step offers Card, Apple Pay, and Google Pay as payment options.
- In Workflow settings, set Instrument future usage to
Subscription. The file doesn’t carry this setting, so an uploaded version starts without it. - Save the version, test it from Workflows → Test payments, then mark it Default.
Step 5: Connect your checkout and test end to end
Step 5: Connect your checkout and test end to end
Choose an integration option
Choose an integration option
Option A: Drop-in or Elements
Option A: Drop-in or Elements
- Backend: call
POST /merchant/client/initwith your customer ID asholderReferenceand your workspace ID, and return the response to the browser. Reuse the sameholderReferencefor each customer, so saved cards line up. - Frontend: install the SDK, initialize it with that response, and mount either Drop-in or the Elements you need. Wallet buttons show only where the device supports them.
- Use the SDK’s
successandfailedevents for the screen only. Confirm the order from the webhook.
Option B: Secure Fields and server-to-server
Option B: Secure Fields and server-to-server
- Backend: call
client/initwithtype: tokenization. This one session serves both the hosted card fields and the wallet buttons. Frontend: mount the card number, expiry, and CVC fields in your own form, then tokenize them to get a payment instrument ID. - Backend: create an execution, then call
authorizeon it with the instrument ID. - 3DS: when the execution status is
authorizePending, redirect the customer torequiredAction.href. Then read the result from the webhook or by long-polling the execution. - Wallets: mount the Apple Pay and Google Pay buttons in the same session. In a
tokenizationsession, a button saves the wallet token as an instrument instead of paying. The SDKsuccessevent with actionTOKENIZEreturns the instrument ID. Your backend then runs steps 2 and 3 with it, exactly as for a card. See Server-to-server integration reference architecture for the button code.
Workspace ID and renewals
Workspace ID and renewals
client/init, or create execution. Workspaces explains where to find it and how multiple workspaces work.Renewals, both options. Your billing job creates an execution with meta.order.processingType set to Subscription, then authorizes it against the saved instrument. No customer is present and no 3DS runs. Set the processing type when you create the execution, because the workflow’s Transaction type condition reads it before the authorize call. Send an X-Idempotency-Key UUID with each request, and reuse it when the job retries the same renewal, so a retry never charges twice. Authorization flags lists the values for subscriptions and one-off charges to a saved card.Flags per transaction type
Flags per transaction type
meta.order.processingType, and the Condition on Transaction type in the workflow from step 4 routes on it. Transaction type is the Portal’s name for the processing type.Send the processing type on the call that creates the execution: client/init in Option A, or create execution in Option B. The workflow reads it before the authorize call, so a value sent only on the authorize call doesn’t change the branch.Regular and CardOnFile go down the first-payment branch, where the issuer can ask for 3DS. Subscription and UnscheduledCardOnFile go down the renewal branch with no 3DS. The values come from Authorization flags.futureUsage once, when you save the card, and Subscription is the right value for a subscription app. When you later charge the same card for a different reason, send the processingType that matches that payment, as in the table, and the saved card still works. In Option A, a customer-present upsell goes through the SDK like the first payment, so put processingType: CardOnFile in the meta.order you pass to client/init.Upsell example, off-session. The same two calls as the renewal, with UnscheduledCardOnFile and a different amount:Notifications and customer data
Notifications and customer data
merchantReference, never by amount.Send real customer data. The Portal’s Test payments page fills in a name, email, and billing address for you. Your backend must send the same fields in meta. Otherwise a PSP rule that passed from the Portal can fail from your checkout.Once you connect the checkout, run the staging cases in Test cases.Step 6: Go live in production
Step 6: Go live in production
<yourcompany>.payrails.io) when you start step 5, with the list of administrator users.Network tokens and BIN lookup
Network tokens and BIN lookup
What changes in production
What changes in production
client/init response carries the environment, and the SDK passes it to the Apple Pay and Google Pay buttons. Google Pay switches from Google’s TEST mode to PRODUCTION on its own, and nothing in your page code changes.Move your workflow to production
Move your workflow to production
- In the staging Portal, open Workflows → Payment acceptance, select the version that passed your staging tests, and export it to a file.
- In the production Portal, import that file on the same page. It arrives as a new version, not yet the default.
- Point every authorization step at your production payment instances.
- Do the same for every retry or cascade step.
- Check that the start step offers Card, Apple Pay, and Google Pay, each on a production instance.
- Check that every branch still ends with a final status and a notification.
- Publish the version and mark it Default. Your code calls
payment-acceptance, so production picks it up with no release.
Test in production and roll out
Test in production and roll out
Test cases
Run every case in staging before you request go-live. Each one shows up in three places: the SDK event or API response, the execution in the Portal, and the notification at your webhook endpoint.Go-live checklist
Timeline at a glance
Steps 1 to 4 are Portal configuration and fit in the first week. The checkout build in step 5 takes the longest. These estimates are typical for app publishers with dedicated people on the implementation.Staging
- Access token returned over mTLS
- BIN lookup confirmed as on in staging, if your workflow or backend uses the issuer, country, or card type
- PSP test instance created with Card, Apple Pay, and Google Pay ticked, and the Notification URL registered at the PSP
- Webhook endpoint registered and the signature check passing on a Test PSP payment
- Staging hostname registered under Apple Pay Domains in the Portal
- Workflow version published with first-payment and renewal branches
- Card payment approved, 3DS challenge completed, decline handled
- Apple Pay payment with a sandbox tester account
- Google Pay payment with a test card
- Renewal charged from your backend on the saved instrument, no 3DS
- Refund from the API or Portal, with the webhook received
Production
- Production environment requested with the administrator user list
- BIN lookup confirmed as on in production, if your workflow or backend uses the issuer, country, or card type
- If you use network tokens: network onboarding details sent to Payrails, onboarding confirmed, and provisioning rules set
- Production credentials and mTLS certificate installed
- Live PSP instances created and the production webhook registered
- Apple Pay file hosted on the production hostname and the hostname registered in the production Portal
- If you use express checkout: the contact fields you tested in staging applied by Payrails in production
- Production workflow published and reviewed with Payrails
- Internal live payment approved and refunded, and wallets tested with real accounts
- First real renewal seen in production
- Traffic ramped to 100%
Common pitfalls
A payment failed. Where do I find the reason?
A payment failed. Where do I find the reason?
Google Pay works in staging, but every production attempt fails with OR_BIBED_11
Google Pay works in staging, but every production attempt fails with OR_BIBED_11
merchantInfo.merchantId. That replaces the Payrails Google registration, which production rejects. Remove it and pass only merchantName.My domain doesn't show as Registered under Apple Pay Domains, or Apple Pay stopped working on it
My domain doesn't show as Registered under Apple Pay Domains, or Apple Pay stopped working on it
https://<host>/.well-known/apple-developer-merchantid-domain-association in a browser and check each of these:- The file is the Payrails file, byte for byte. Download it again from the link in step 3 rather than copying its contents, which can change line endings.
- The host serves it directly with a
200: no redirect (includinghttptohttpsor to awwwhost), no login page, and no bot or firewall challenge. - The hostname you registered in the Portal is exactly the one that serves the file and shows the button.
yourbrand.comandpay.yourbrand.comare separate registrations. - No other provider’s file sits at the same path. A host holds only one file, so if another provider already uses it, move the Payrails checkout to a dedicated subdomain.
- The file is still there. Apple checks it again when the domain’s TLS certificate renews, so a deploy that removed it can break Apple Pay weeks later.
- You registered the hostname in the right Portal. Staging and production each need their own registration.
Apple Pay fails in staging with merchant url validation failed
Apple Pay fails in staging with merchant url validation failed