Accept a payment
Create a payment session, embed FloPayCheckout, authenticate continuation calls, handle a complete checkout flow, and show your brand on card statements with statement descriptors.
Accept a payment
Start by choosing how you want to deliver checkout. The technical steps in this guide cover an SDK checkout that your application renders and controls.
Who this is for
This guide is for teams comparing FloPay delivery methods and for developers adding an SDK checkout to a web application. The browser can create the session inline, or a trusted backend can create it first.
Choose a delivery method
- Hosted checkout links let an operator create a shareable full page or embeddable payment widget from the Dashboard.
- SDK checkout gives your application direct control over session creation, layout, and callbacks. Continue with this guide for that path.
- Connectors add FloPay through a supported commerce or platform integration.
Choose an SDK session approach
Use inline session creation when the browser can supply the approved cart and buyer data directly to FloPay. Create the session on a trusted backend when pricing, entitlements, or other business rules must stay server-side. Both approaches use the same checkout modes, layouts, callbacks, and session-token contract.
One-click with a server-minted session
For a one-click purchase with a saved payment method, the recommended path is a server-minted session. Your server mints it with @flopay/node checkout.sessions.createOneClick and your merchant credentials, which come from the API tokens page. The automatic payment button then fetches the session with getSession when the buyer clicks.
- On your server, take the buyer from your own login session, never from the request body, and call
createOneClick. It always creates a Confirm session and returns only{ sessionId, nonce }. - In the browser, pass the button a
getSessionfunction that calls your endpoint and resolves to that{ sessionId, nonce }. - On SDK versions before 1.10, fetch the session from your endpoint yourself and pass its
sessionIdandnonceto the button instead ofgetSession.
const user = await getCurrentUser(); // your own login session
const { sessionId, nonce } = await flopay.checkout.sessions.createOneClick({
billingApiUrl: 'https://billing.example.com',
checkoutBaseUrl: 'https://checkout.example.com',
clientId: process.env.FLOPAY_CLIENT_ID!,
currency: 'USD',
products: [{ code: 'upsell_ai_pack' }],
account: { userId: user.id, email: user.email },
successUrl: 'https://shop.example.com/success',
cancelUrl: 'https://shop.example.com/cancel',
});
return Response.json({ sessionId, nonce });<FloPayAutomaticPaymentButton
getSession={async ({ signal }) => {
const response = await fetch('/api/one-click-session', { method: 'POST', signal });
return response.json();
}}
>
Buy now
</FloPayAutomaticPaymentButton>A keyless Auto or Confirm create, made from the browser without merchant credentials, falls back to Full checkout. The buyer can still pay, but not in one click.
Create a payment session
A Full checkout session is created in two phases:
- The shell:
POST /v1/checkouts/sessionswithdeferDataAttachment: true. A lightweight session that runs no catalog validation and takes none of the buyer-identity advisory locks that serialize concurrent checkouts for the same customer. The backend routes a gateway for it, so the response already carriesgatewaysand the hostedvaultblock. - The claim:
PATCH /v1/checkouts/sessions/{id}/claim. Attaches buyer identity, address, products and coupons, validates them against the catalog, and returns the fully-populated session.
Splitting them lets the hosted card form mount from the shell and become interactive while buyer and cart data are still being attached. Stripe.js for wallets, APMs and PayPal loads in parallel with the claim rather than after it.
When you use @flopay/react or @flopay/js, both phases are handled for you: see SDK behavior below. This guide describes the contract for direct HTTP integrators and for anyone who needs to reason about what the SDK is doing.
Direct HTTP integrators can also skip the split and create a fully-populated session in one request. See Standard create.
Standard create (single request)
A standard create sends the cart and buyer data up front and omits deferDataAttachment. The response is the fully-populated session, ready to process, and no claim is needed.
POST /v1/checkouts/sessions
Content-Type: application/json{
"clientId": "18bff186-284c-483f-acee-e712f21d2b8d",
"currency": "USD",
"products": [{ "code": "plan_a", "quantity": 1 }],
"accountData": {
"userId": "buyer-123",
"email": "buyer@example.com",
"country": "US"
},
"successUrl": "/success",
"cancelUrl": "/cancel"
}| Field | Standard create |
|---|---|
clientId | Required. Your client UUID. |
currency | Required unless deferDataAttachment: true. Three-letter ISO code applied to every product. |
products | Required unless deferDataAttachment: true. At least one entry, each with a catalog code and a positive integer quantity. |
couponCodes | Optional. When omitted, defaults to couponCodes: []. Send the codes to apply when the buyer has any. |
accountData | Required unless deferDataAttachment: true. A non-empty object. Every property inside it (userId, email, names, address) is optional, but the object itself must be present. A first or last name (firstName or lastName; one part is enough) hides the card form's name field, and a valid email removes the SDK email box. See What the card form asks for. |
successUrl, cancelUrl | Optional. |
The API reference marks currency, products and accountData as not required, because a deferred shell (and the deprecated subscriptions / items arrays) can omit them. On a standard create they are required. A request missing any of them is rejected with 400 Bad Request before a session is created, and the response message array names each failing field, for example "accountData must be a non-empty object".
Mounting is not charging
The shell exists to be mounted, not charged. Every route that can take money still requires attached data:
| Route | Unclaimed session |
|---|---|
POST /v1/checkouts/sessions/:id/process | 409 Conflict |
POST /v1/checkouts/payments/intents | 409 Conflict |
POST /v1/checkouts/payments/setup-intents | 409 Conflict |
POST /v1/checkouts/payments/intents/decline | 409 Conflict |
POST /v1/checkouts/sessions/:id/vault/error | 409 Conflict |
| PCIVault capture webhook | 503 Service Unavailable |
POST /v1/checkouts/sessions/:id/vault/capture | Allowed, provided the shell bound a gateway |
The 409 responses carry a machine-readable code:
{
"code": "checkout_session_data_attachment_required",
"message": "Checkout session buyer and catalog data must be attached before payment or vault operations."
}The capture webhook is the deliberate exception. It answers 503 rather than a 4xx so PCIVault re-delivers on its 8-attempt schedule: a claim landing moments later lets the retried delivery succeed instead of terminally failing the buyer.
Creating the shell
Only clientId and checkoutMode: 'full' are structurally required. currency, products and accountData (normally required on a create) become optional, because they arrive with the claim. couponCodes is always optional.
POST /v1/checkouts/sessions
Content-Type: application/json{
"clientId": "18bff186-284c-483f-acee-e712f21d2b8d",
"checkoutMode": "full",
"deferDataAttachment": true,
"currency": "USD",
"accountData": { "country": "US" },
"successUrl": "/success",
"cancelUrl": "/cancel"
}currency and accountData.country are accepted here as gateway-routing inputs only. No buyer is resolved, upserted or linked, and the persisted shell carries no buyer identity: accountData is blanked on the stored session. Supplying them lets the backend route the same gateway it would have routed for the full create, so the vault block on the response is the one the buyer will actually pay through.
The response is 201 Created with the normal session shape, plus:
dataAttachmentDeferred: truenonce: the checkout session token required by the claim and every later callgatewaysfor the bound provider: start loading Stripe.js- a usable
vaultblock: mount the hosted card form immediately
A shell that could not bind any gateway carries no vault block on the create response, and POST /v1/checkouts/sessions/:id/vault/capture rejects it with 400: there is no provider to mint capture credentials against.
deferDataAttachment is supported only for Full checkout sessions. Sending it with checkoutMode of auto or confirm is rejected with a validation error: "deferDataAttachment is supported only for Full checkout sessions".
Claiming the session
Claim the shell before any payment, intent, decline-reporting or processing call. The claim is authenticated with the session nonce.
PATCH /v1/checkouts/sessions/{sessionId}/claim
X-Checkout-Session-Token: {nonce}
Content-Type: application/json{
"currency": "USD",
"products": [{ "code": "plan_a", "quantity": 1 }],
"couponCodes": ["SAVE10"],
"accountData": {
"userId": "buyer-123",
"email": "buyer@example.com",
"country": "US"
}
}The body accepts the cart and buyer fields of the create body: currency, products, couponCodes, accountData, and the deprecated subscriptions / items arrays. Everything else about the session (clientId, checkoutMode, successUrl, cancelUrl, tags) was fixed at create time and is not re-sent.
The attachment is atomic: buyer identity, address, and validated product and coupon snapshots all land together, and the response is 200 OK with the same full session shape a one-shot create returns.
Retries and conflicts
The claim payload is fingerprinted server-side (SHA-256 over a stable stringify), which makes it replay-safe:
| Claim | Result |
|---|---|
| First claim of a deferred shell | 200 OK with the attached session. |
| Identical replay | 200 OK with the same claimed session: safe across transport retries. |
| Materially different payload | 409 Conflict: "Checkout session data has already been attached with a different payload." |
Session created without deferDataAttachment | 409 Conflict: "Checkout session data was attached outside the claim contract." |
| Products or coupons fail catalog validation | 422 Unprocessable Entity: see Product Catalog. |
products, subscriptions, items and couponCodes are treated as sets, not ordered lists, so a cart rebuilt in a different order still replays cleanly. Every other field is compared as sent: retry with a byte-identical body wherever you can.
Catalog validation moves to the claim
Because the shell create skips it, an invalid product or coupon surfaces as a 422 from the claim rather than from the create. The status, the message, and the issues[] shape are unchanged: only the timing moves.
Gateway semantics across the claim
The claim does not re-route by default. If the shell's bound gateway is still usable: loaded, active, and owned by the session's client: the claim keeps it and leaves the vault binding untouched. Re-routing would silently invalidate a widget the buyer may already be typing into.
Only when the shell's binding is no longer usable does the claim re-route. It then clears the stale capture credentials, so the claim response carries a fresh vault block.
Treat a changed vault block on the claim response as a remount signal; an unchanged one means keep the mounted widget.
SDK behavior
@flopay/react and @flopay/js create inline sessions this way by default.
FloPayCheckoutrenders from the shell, then applies the claim when it lands. The card widget's submit stays gated for that window; a click during it is not swallowed: the buyer is asked to press pay again. In practice the claim resolves while the card is still being filled in.PaymentAPI.createDetachedSession()exposes both phases as{ shell, sessionId, nonce, claimed }.PaymentAPI.createAndFetchSession()uses the same flow but awaits the claim, so its resolved value is a single fully-populated session.
Eligibility is decided by isDetachedSessionEligible(): Full mode only, no tokenizedData, and deferDataAttachment: false opts back into the one-shot create.
<FloPayCheckout
createSession={{
clientId: 'your-client-id',
currency: 'EUR',
products: [{ code: 'omni-ai-booster' }],
account: { userId: 'user_123', email: 'customer@example.com' },
successUrl: '/success',
cancelUrl: '/cancel',
deferDataAttachment: false, // one-shot create
}}
/>There is no client-side fallback. The SDK requires a billing API that exposes PATCH /v1/checkouts/sessions/{id}/claim; if the create returns no session shell it raises FloPayError with code InvalidCheckoutSessionResponse.
Telemetry
Each phase is measured on its own:
| Stage | Covers | Log names |
|---|---|---|
session_shell | Create → mountable card form | session.shell.ready |
session_claim | The background attach (own request category) | session.claim.started, session.claim.completed |
session_create | The whole logical create: shell and claim | session.create.started, session.request.completed |
session_create reports the create's attempt count rather than the claim's, so end-to-end dashboards keep measuring the same span.
What the card form asks for
The checkout asks the buyer only for what the session does not already carry. Pass the buyer details you have, and the form asks for less.
- Name field: the card form hides the name field when the session carries a first or last name by the time the form is shown. One part is enough: a first name alone or a last name alone hides the field. The name is filled in for the buyer, and PCI Vault and the gateways receive it with the card.
- Email box: the SDK shows its own email box only when the session has no valid email. A valid email on the session removes the email box.
- Form already on screen: when names are attached after the form is already on screen, the name field stays shown and the buyer types the name. The form is not swapped while the buyer is on it.
Pass the names at session creation so they are there when the form is shown: accountData.firstName and accountData.lastName on a standard create, or account in the createSession payload on the React SDK (FloPayCheckout). A standard create carries them from the start. What the SDK default flow does with the names depends on the SDK version:
- 1.18.1 and later: from
@flopay/reactand@flopay/vue1.18.1, the SDK default flow sends the names with the first session request, so the card form never paints the name field when you pass a first or last name. - Older versions: the session is created as a shell and the names are attached at the claim. Older versions can show the name field until the claim attaches the names. They usually arrive before the form is shown, but a name that lands after the form is on screen leaves the field shown for that buyer.
The buyer enters the card number, the expiry, the CVC and, when the session carries no name, the name. The expiry is one expiry field with the placeholder MM / YY: the buyer types the month and the year into it, and the month and year dropdowns are no longer part of the form. This applies to every integration, with nothing to change in your code. If your own browser tests fill in the card form, see Automate checkout in browser tests.
Related
- Checkout Session Token: the nonce that authenticates the claim and every continuation call.
- FloPayCheckout Guide: the inline component that drives this flow.
- Product Catalog: what the claim validates against.
- Error Handling: how these statuses surface as
FloPayError.
Embed FloPayCheckout
FloPayCheckout is the fastest way to integrate FloPay. One component handles session fetching, Stripe initialization, card fields, wallets, PayPal, 3DS, and checkout modes: no manual wiring needed.
Quick Start
The recommended integration is inline: pass a createSession payload and FloPayCheckout creates the session and renders the form for you: no separate backend route to build, call, and pass a sessionId back to the client.
import { FloPayCheckout } from '@flopay/react';
import { configureFlopay } from '@flopay/shared';
// Call once at app startup (layout.tsx or _app.tsx)
configureFlopay({ environment: 'production' });
function CheckoutPage() {
return (
<FloPayCheckout
createSession={{
clientId: 'your-client-id',
currency: 'EUR',
products: [{ code: 'omni-ai-booster' }],
account: {
userId: 'user_123',
email: 'customer@example.com',
firstName: 'Jane',
lastName: 'Doe',
},
successUrl: '/success',
cancelUrl: '/cancel',
}}
onComplete={(result) => {
if (result.status === 'succeeded') {
window.location.href = '/success';
}
}}
onError={(err) => console.error(err.message)}
/>
);
}That's it. The component automatically:
- Creates the checkout session from your
createSessionpayload (no backend route required) - Reads
gateways.stripe.publishableKeyto initialize card fields and every payment method enabled on the connected Stripe account - Reads
gateways.paypalto decide which PayPal path to render:- When
gateways.paypalis present: loads the PayPal JS SDK directly (see Direct PayPal guide) - When
nullor missing: renders PayPal via Stripe'sExpressCheckoutElementas fallback (see PayPal via Stripe) - PayPal never renders twice
- When
- Uses each gateway entry's
environment('stage'or'production') to pick sandbox vs live credentials per gateway - Renders card fields, the Stripe-enabled payment methods configured on the connected Stripe account (Apple Pay, Google Pay, Cash App, Klarna, Afterpay, iDEAL, Bancontact, etc.), and PayPal
- Handles 3DS authentication
- Calls
onCompletewhen payment succeeds
See Inline Session Creation for the full createSession payload, currency requirements, and email handling.
Already have a session ID?
If you create the session on your backend (for example to keep pricing or entitlement logic server-side), pass the returned sessionId instead of createSession:
<FloPayCheckout sessionId={sessionId} onComplete={handleSuccess} />Every option on this page works the same whether you pass createSession or sessionId. The examples below use sessionId for brevity.
Environment Setup
FloPayCheckout needs to know which billing API to call. Choose one:
Option A: configureFlopay() (recommended)
import { configureFlopay } from '@flopay/shared';
configureFlopay({ environment: 'production' });Call this once at app startup, for example in app/layout.tsx or _app.tsx.
Option B: Explicit prop
<FloPayCheckout
sessionId={sessionId}
billingApiUrl="https://api.flopay.com"
onComplete={handleSuccess}
/>Checkout Modes
Full Mode (default)
Shows the complete payment form: card fields, wallets, PayPal.
<FloPayCheckout sessionId={sessionId} onComplete={handleSuccess} />Confirm Mode
Uses a saved payment method. Shows a single "Confirm Purchase" button. Falls back to full mode if payment fails.
Mint the Confirm session on your server with createOneClick, as in One-click with a server-minted session. A keyless Confirm create from the browser falls back to Full checkout.
<FloPayCheckout
sessionId={sessionId}
checkoutMode="confirm"
onComplete={handleSuccess}
/>Customize the confirm button:
<FloPayCheckout
sessionId={sessionId}
checkoutMode="confirm"
renderConfirmButton={({ onConfirm, isProcessing }) => (
<button onClick={onConfirm} disabled={isProcessing}>
{isProcessing ? 'Working...' : 'Buy Now'}
</button>
)}
onComplete={handleSuccess}
/>Auto Mode
Automatically submits with a saved payment method: no user interaction. Falls back to full mode if it fails.
A keyless Auto create from the browser falls back to Full checkout. For one-click, use a server-minted session as in One-click with a server-minted session.
<FloPayCheckout
sessionId={sessionId}
checkoutMode="auto"
onComplete={handleSuccess}
onSessionCompleted={(successUrl) => {
// Session was already completed (e.g. page reload after success)
window.location.href = successUrl;
}}
/>Layout Modes
Default Layout
All payment methods visible together: wallets on top, divider, then card fields below.
Buttons Layout
Payment methods shown as stacked buttons. Clicking "Credit / Debit Card" expands into the card form with a back button and title.
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
onComplete={handleSuccess}
/>Theme Bundles
Pick a bundled theme and the SDK styles both the Stripe-rendered fields and the React-rendered wrapper, submit, and inputs:
// Modern light: Inter, soft shadows, generous spacing
<FloPayCheckout sessionId={id} layout="buttons" theme="modern-light" />
// Bold dark: saturated FloPay blue on a dark surface
<FloPayCheckout sessionId={id} layout="buttons" theme="bold-dark" />
// Glass dark: translucent surfaces over a blue gradient
<FloPayCheckout sessionId={id} layout="buttons" theme="glass-dark" />Available theme values: 'classic' | 'modern-light' | 'modern-dark' | 'bold-light' | 'bold-dark' | 'glass-light' | 'glass-dark'. See the Theming guide for the full reference and resolution precedence.
Custom Styles
Override individual elements with buttonsStyles:
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
buttonsStyles={{
cardButton: { borderRadius: '12px', border: '2px solid #4A49FF' },
cardButtonFontSize: '1rem',
cardFormContainer: { backgroundColor: '#f8f7ff' },
cardInputBorder: '#c4c3ff',
cardInputColor: '#1a1a2e',
cardInputPlaceholderColor: '#9ca3af',
submitButton: { backgroundColor: '#2d2ccc', borderRadius: '12px' },
title: { color: '#2d2ccc' },
}}
onComplete={handleSuccess}
/>Custom Card Button Content
Use cardButtonContent to replace the default card button body with your own React content:
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
cardButtonContent={
<div
style={{
display: 'flex',
alignItems: 'center',
gap: '0.75rem',
width: '100%',
}}
>
<span style={{ fontWeight: 700 }}>Pay by card</span>
<span style={{ fontSize: '0.75rem', opacity: 0.7 }}>
Visa, Mastercard, Amex
</span>
<span style={{ marginLeft: 'auto', fontSize: '0.7rem' }}>Secure</span>
</div>
}
onComplete={handleSuccess}
/>Use cardButtonContent for the inner content and buttonsStyles.cardButton for the outer button container styles.
Buttons Layout Header Slots
Use cardBackButtonContent and cardTitleContent to replace the default "Go back" and "Secure card checkout" text in the expanded card form header. Pass '' when you want to remove the text completely.
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
cardBackButtonContent=""
cardTitleContent="Enter card details"
onComplete={handleSuccess}
/>cardTitleContent also replaces the standalone title in the default card form layout.
For dark backgrounds, the bundled bold-dark / glass-dark themes already style the Stripe Element text inside the iframe. Override individual fields with cardInputColor, cardInputPlaceholderColor, and cardInputBackground when needed:
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
theme="bold-dark"
buttonsStyles={{
cardInputColor: '#f9fafb',
cardInputPlaceholderColor: '#6b7280',
cardInputBackground: '#1f2937',
nameInput: { backgroundColor: '#1f2937', color: '#f9fafb' },
}}
onComplete={handleSuccess}
/>See the full ButtonsLayoutStyles reference for all available properties.
Inline Session Creation
This is the recommended flow shown in the Quick Start: pass createSession and skip the backend API route entirely. The component creates the session and renders the checkout for you:
<FloPayCheckout
layout="buttons"
createSession={{
clientId: 'your-client-id',
currency: 'EUR',
products: [{ code: 'omni-ai-booster' }],
account: {
userId: 'user_123',
email: 'customer@example.com',
firstName: 'John',
lastName: 'Doe',
},
successUrl: '/success',
cancelUrl: '/cancel',
}}
onComplete={(result) => window.location.href = '/success'}
/>No sessionId needed: the component creates the session, initializes the payment provider, and renders the form automatically.
Inline creation suits Full checkout. For one-click Auto or Confirm, use a server-minted session instead: see One-click with a server-minted session.
For embedded checkout, include createSession.account.email in the initial payload. If you only have a temporary value such as test@email.com, pass it first and then replace it in onBeforeButtonClick before the card flow continues.
Session-level currency is required. The SDK throws FloPayError({ type: 'validation_error', code: 'CurrencyRequired' }) synchronously when no currency can be resolved from the session or any per-line currency. Set createSession.currency at the top of the payload for the cleanest behavior.
How the session is created
Creation runs in two phases. The component first creates a lightweight session shell and mounts the hosted card form from it, then applies a background claim that attaches buyer identity, address, products and coupons. The card form is interactive before the claim lands, and Stripe wallets, APMs and PayPal load in parallel with it rather than after it.
Nothing else changes for you: the same session, the same callbacks, the same results. Catalog and coupon errors still surface as a checkout load error: just from the claim rather than the create.
The card submit stays gated until the claim lands, because the billing API rejects a charge against an unclaimed session. A buyer who clicks during that window is asked to press pay again; in practice the claim resolves while the card is still being filled in.
Opt out per session to restore the original single-request create:
<FloPayCheckout
createSession={{
/* … */
deferDataAttachment: false,
}}
/>Two-phase creation applies to checkoutMode: 'full' only, is skipped when tokenizedData is supplied, and requires a billing API that exposes PATCH /v1/checkouts/sessions/{id}/claim: there is no client-side fallback. See the Session Creation guide for the full contract.
Tracking Button Clicks
Fire GTM events when users interact with payment buttons:
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
onButtonClick={(method) => {
window.dataLayer?.push({
event: 'initiate_checkout',
payment_method: method,
});
}}
onComplete={handleSuccess}
/>method values: 'card', 'paypal', 'apple_pay', 'google_pay'.
Before Card Button Click
Use onBeforeButtonClick when you need to do async work before the credit card button continues, such as confirming checkout details or replacing a temporary email address:
<FloPayCheckout
layout="buttons"
createSession={{
clientId: 'your-client-id',
currency: 'EUR',
products: [{ code: 'product-1' }],
account: {
userId: 'user_1',
email: 'test@email.com',
},
successUrl: '/success',
cancelUrl: '/cancel',
}}
onBeforeButtonClick={async ({ method, createSession }) => {
if (method !== 'card') return;
const email = await openEmailCaptureModal({
initialEmail: createSession?.account.email ?? '',
});
if (!email) return false;
return {
account: { email },
};
}}
onComplete={handleSuccess}
/>onBeforeButtonClick is credit card only. It runs only for the "Credit / Debit Card" button in layout="buttons". It does not run for PayPal, Apple Pay, or Google Pay. If you need required data before every payment method, collect it before rendering FloPayCheckout.
Returning false cancels the card click. Throwing routes the error through onError. When createSession is used, the returned patch refreshes the card flow with the merged session draft. createSession.account.email should already be present when the embedded checkout renders; use this hook to update it, not to skip it.
Decline Events
Use onDecline when you want GTM or analytics events for declined payments, failed 3DS, PayPal cancellation, or wallet dismissal:
<FloPayCheckout
sessionId={sessionId}
onDecline={(decline) => {
window.dataLayer?.push({
event: 'checkout_decline',
...decline,
});
}}
onComplete={handleSuccess}
/>Payment Methods
Payment methods are toggled at the gateway level with two props: showStripe and showPayPal. Which individual methods appear inside the Stripe gateway (cards, Apple Pay, Google Pay, Cash App, Klarna, Afterpay, iDEAL, Bancontact, etc.) is controlled from your Stripe dashboard: see Stripe payment methods.
Stripe
Enabled by default. Renders card fields plus every payment method enabled on the connected Stripe account. Apple Pay and Google Pay only paint on supported devices/browsers; Stripe-enabled local methods (Cash App, Klarna, Afterpay, iDEAL, Bancontact, etc.) appear when the buyer's locale and currency match the method's eligibility rules.
// Hide the entire Stripe gateway: cards, wallets, and all Stripe-enabled payment methods
<FloPayCheckout
sessionId={sessionId}
showStripe={false}
onComplete={handleSuccess}
/>Wallet buttons depend on Stripe domain registration. Apple Pay also needs the Apple association file. See the Apple Pay Setup and Google Pay Setup guides.
PayPal
Enabled by default. Routes to the direct PayPal path when the session response includes gateways.paypal, otherwise falls back to PayPal via Stripe. Handles redirects automatically.
// Hide the entire PayPal gateway (both direct and Stripe-rendered paths)
<FloPayCheckout sessionId={sessionId} showPayPal={false} onComplete={handleSuccess} />AVS (Address Verification)
Enable AVS to collect the user's country and postal/ZIP code. When enabled, billing_details are passed to Stripe's createPaymentMethod() so Stripe can run postal code and address verification checks automatically.
Basic Setup
<FloPayCheckout
sessionId={sessionId}
enableAVS
onComplete={handleSuccess}
/>The country dropdown defaults to the session's customer.country value (typically resolved from the user's IP by your backend). If no country is provided, it defaults to US.
Country from GEO/IP Lookup
Pass the user's country in the session creation params. The SDK pre-fills the dropdown:
<FloPayCheckout
createSession={{
clientId: 'your-client-id',
currency: 'EUR',
products: [{ code: 'product-1' }],
account: {
userId: 'user_1',
email: 'user@example.com',
country: 'GB', // resolved from user's IP
},
successUrl: '/success',
cancelUrl: '/cancel',
}}
enableAVS
layout="buttons"
onComplete={handleSuccess}
/>The dropdown shows "United Kingdom" and the postal code label says "Postcode" instead of "ZIP Code".
Dynamic Labels
The postal code field label adapts to the selected country:
| Country | Label |
|---|---|
| US | ZIP Code |
| GB, AU, NZ | Postcode |
| CA | Postal Code |
| IE | Eircode |
| All others | Postal Code |
AVS Field Layout
By default, country and postal code sit side-by-side in a row. Switch to stacked:
<FloPayCheckout
sessionId={sessionId}
enableAVS
avsLayout="column"
onComplete={handleSuccess}
/>Theming AVS Fields
AVS fields inherit from the card input styles. Override individually with countrySelect and zipInput in buttonsStyles:
<FloPayCheckout
sessionId={sessionId}
enableAVS
layout="buttons"
theme="bold-dark"
buttonsStyles={{
countrySelect: { backgroundColor: '#1f2937', color: '#f9fafb' },
zipInput: { backgroundColor: '#1f2937', color: '#f9fafb' },
}}
onComplete={handleSuccess}
/>How It Works
- User selects country and enters postal code in the form
- On submit,
billing_details(name + address with country and postal_code) are passed to Stripe'screatePaymentMethod() - Stripe runs AVS checks automatically when billing details are present
- The
accountData.zipandaccountData.countryare also sent to your backend in the process request - Configure Stripe Dashboard → Radar → Rules to block or allow based on AVS results (e.g., "Block if postal code check fails")
AVS is performed by Stripe at payment confirmation time. The SDK sends the billing details: your Stripe Radar rules determine whether to block, allow, or flag based on the verification result. No backend code changes are needed for basic AVS.
Error Handling
<FloPayCheckout
sessionId={sessionId}
onError={(err) => {
// err.type: 'validation_error' | 'api_error' | 'authentication_error' | ...
// err.message: human-readable error message
console.error(`Payment failed: ${err.message}`);
showToast(err.message);
}}
onComplete={handleSuccess}
/>Suppress the built-in error UI and handle it yourself:
<FloPayCheckout
sessionId={sessionId}
error={() => <></>}
onError={(err) => setMyError(err.message)}
onComplete={handleSuccess}
/>Custom Loading State
<FloPayCheckout
sessionId={sessionId}
loading={<MySkeletonLoader />}
onComplete={handleSuccess}
/>Full Example
See the FloPayCheckout Example for a complete checkout page with order summary, discount timer, and all props configured.
Next Steps
- API Reference: full props table
- Theming: customize card field appearance
- Stripe payment methods: how the dynamic Stripe gateway resolves methods at runtime
- Apple Pay Setup: domain verification
- Google Pay Setup: Stripe payment method domains
- AVS (Address Verification): postal code verification setup
Authenticate continuation calls
Every continuation call against the /v1/checkouts/* API is authenticated with the session nonce issued at session-create time. Clients send the nonce as the x-checkout-session-token request header, and the billing API matches it against checkout_session.nonce for the session id on the URL.
The session-create endpoint (POST /v1/checkouts/sessions) is the only /v1/checkouts/* route that does not require the header: it issues the nonce.
When the SDK creates the session for you (@flopay/js, @flopay/react, or @flopay/node), you do not need to manage the header by hand: it reads CheckoutSessionResponseDto.nonce from the create response and attaches it to every subsequent request automatically.
When you instead hand the SDK a session your backend created: e.g. the sessionId prop on FloPayAutomaticPaymentButton or FloPayCheckout: pass the session's nonce via the matching nonce prop. A session read does not echo the nonce back, so the SDK cannot recover it on its own; omit it and the continuation calls fail with 401.
Capture the nonce
The session-create response returns the nonce as nonce on CheckoutSessionResponseDto. Stash it alongside the session id; you'll need it on every follow-up call for the lifetime of the session.
const res = await fetch(`${billingApiUrl}/v1/checkouts/sessions`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
clientId,
currency: 'USD',
products: [{ code: 'pro_plan', totalAmount: 49.99 }],
account: { userId, email },
successUrl: '/success',
cancelUrl: '/cancel',
}),
});
const { id: sessionId, nonce } = await res.json();Echo as x-checkout-session-token
Send the nonce as the x-checkout-session-token header on every continuation call. The header value is the raw nonce string: no Bearer prefix, no encoding.
await fetch(`${billingApiUrl}/v1/checkouts/sessions/${sessionId}/process`, {
method: 'POST',
headers: {
'content-type': 'application/json',
'x-checkout-session-token': nonce,
'x-user-id': userId,
},
body: JSON.stringify({ tokenizedData, accountData }),
});A missing or mismatched header is rejected with 401 Unauthorized before any business logic runs.
Protected routes
The header is required on every /v1/checkouts/* route below. For routes that include :id, that session id must match the session that issued the nonce.
| Method | Route | Purpose |
|---|---|---|
GET | /v1/checkouts/sessions/:id | Fetch the checkout session. |
GET | /v1/checkouts/sessions/:id/status | Poll the session's processing status. |
GET | /v1/checkouts/sessions/:id/products | List the products attached to the session. Replaces the removed GET /v1/checkouts/items. |
PATCH | /v1/checkouts/sessions/:id/claim | Attach buyer and catalog data to a session shell. See Session Creation. |
PATCH | /v1/checkouts/sessions/:id/account | Update the buyer account on the session. |
POST | /v1/checkouts/sessions/:id/process | Submit a tokenized payment. Moved from POST /v1/checkouts/sessions/process. |
POST | /v1/checkouts/sessions/:id/vault/capture | Re-mint PCIVault capture credentials. |
POST | /v1/checkouts/sessions/:id/vault/error | Report a vault-side failure for the session. Moved from POST /v1/checkouts/sessions/vault/error. |
POST | /v1/checkouts/sessions/:id/3ds/complete | Complete a 3DS challenge for the session. |
POST | /v1/checkouts/payments/intents | Create the PaymentIntent for the session. |
POST | /v1/checkouts/payments/setup-intents | Create the SetupIntent for the session. |
Two routes were renamed in this release. Update any client code that still posts to /v1/checkouts/sessions/process or /v1/checkouts/sessions/vault/error: both now live under /v1/checkouts/sessions/:id/.... GET /v1/checkouts/items has been removed; use GET /v1/checkouts/sessions/:id/products instead.
Lifetime
The nonce is bound to the session row and lives as long as the session does: it does not rotate per request. Persist it next to the session id wherever your client tracks checkout state (component state, sessionStorage, server-side cache) so that downstream calls can read it back.
There is no separate refresh endpoint. If you lose the nonce, the session can no longer be continued and the buyer must restart at session-create.
Errors
| Status | Meaning |
|---|---|
401 | Header missing, or the value does not match checkout_session.nonce for the session id on the URL. |
404 | The session id on the URL does not exist. |
409 | The token was valid, but the session is a shell whose buyer and catalog data has not been attached yet. Carries the code checkout_session_data_attachment_required: claim the session first. See Session Creation. |
In the SDK these surface as FloPayError with type: 'authentication_error' (401) or type: 'api_error' (404 / 409). See the Error Handling guide.
Preserve checkout context with metadata
Attach checkoutMetadata when you create a checkout session to carry non-sensitive merchant context through FloPay's billing lifecycle. A merchant order reference is a good correlation value.
Use metadata when you need to correlate a checkout with your own non-sensitive order or workflow reference across API reads, billing records, and webhook deliveries:
{
"checkoutMetadata": {
"merchantOrderId": "order-123"
}
}The map belongs to the checkout, not to a catalog product or payment provider. For the request type, boundaries, errors, and read response shapes, see the checkout metadata REST reference.
Add metadata with an SDK
The released SDK packages expose CheckoutMetadata from @flopay/shared. Creation types accept CheckoutMetadata | null, while returned session types expose an optional, non-null snapshot.
JavaScript
createCheckoutSession() and createCheckoutSessionWithRetries() accept the map through CreateSessionParams. PaymentAPI accepts the same field for one-shot and detached inline creation.
import { createCheckoutSession, PaymentAPI } from '@flopay/js';
import type {
CheckoutMetadata,
CheckoutSession,
CreateSessionParams,
InlineSessionDraft,
NormalizedCheckoutSession,
} from '@flopay/shared';
const checkoutMetadata: CheckoutMetadata = {
merchantOrderId: 'order-123',
};
const redirectParams: CreateSessionParams = {
billingApiUrl: 'https://api.flopay.com',
checkoutBaseUrl: 'https://checkout.flopay.com',
clientId: '00000000-0000-0000-0000-000000000000',
currency: 'USD',
products: [{ code: 'starter', quantity: 1 }],
account: { userId: 'buyer-123', email: 'buyer@example.com' },
successUrl: 'https://merchant.example/success',
cancelUrl: 'https://merchant.example/checkout',
checkoutMetadata,
};
export async function createRedirectCheckout() {
return createCheckoutSession(redirectParams);
}
const inlineDraft: InlineSessionDraft = {
clientId: redirectParams.clientId,
currency: redirectParams.currency,
products: redirectParams.products,
account: redirectParams.account,
successUrl: redirectParams.successUrl,
cancelUrl: redirectParams.cancelUrl,
checkoutMetadata,
};
export async function createDetachedCheckout() {
const paymentApi = new PaymentAPI('https://api.flopay.com');
const detached = await paymentApi.createDetachedSession(inlineDraft);
const normalized: NormalizedCheckoutSession = await detached.claimed;
const session: CheckoutSession | undefined = normalized.data.session;
return (
normalized.checkoutMetadata?.merchantOrderId ??
session?.checkoutMetadata?.merchantOrderId
);
}Detached creation sends checkoutMetadata on the initial shell POST only. The catalog claim and late-buyer claim do not repeat or edit it. A populated map, null, and {} are forwarded unchanged, while omission leaves the wire field absent.
Node
@flopay/node uses the same CreateSessionParams contract:
import { FloPay } from '@flopay/node';
import type { CheckoutMetadata, CreateSessionParams } from '@flopay/shared';
const checkoutMetadata: CheckoutMetadata = {
merchantOrderId: 'order-123',
};
const params: CreateSessionParams = {
billingApiUrl: 'https://api.flopay.com',
checkoutBaseUrl: 'https://checkout.flopay.com',
clientId: '00000000-0000-0000-0000-000000000000',
currency: 'USD',
products: [{ code: 'starter', quantity: 1 }],
account: { userId: 'buyer-123', email: 'buyer@example.com' },
successUrl: 'https://merchant.example/success',
cancelUrl: 'https://merchant.example/checkout',
checkoutMetadata,
};
export async function createNodeCheckout() {
const flopay = new FloPay('<your-flopay-secret-key>');
return flopay.checkout.sessions.create(params);
}React
FloPayCheckout accepts metadata through its InlineSessionDraft. A just-in-time InlineSessionPatch replaces the whole map before session creation; return null to clear the draft value.
import { FloPayCheckout } from '@flopay/react';
import type { InlineSessionDraft, InlineSessionPatch } from '@flopay/shared';
const createSession: InlineSessionDraft = {
clientId: '00000000-0000-0000-0000-000000000000',
currency: 'USD',
products: [{ code: 'starter', quantity: 1 }],
account: { userId: 'buyer-123', email: 'buyer@example.com' },
successUrl: 'https://merchant.example/success',
cancelUrl: 'https://merchant.example/checkout',
checkoutMetadata: { merchantOrderId: 'order-123' },
};
const metadataPatch: InlineSessionPatch = {
checkoutMetadata: { merchantOrderId: 'order-124' },
};
export function Checkout() {
return (
<FloPayCheckout
createSession={createSession}
onBeforeButtonClick={() => metadataPatch}
/>
);
}The SDK does not duplicate the backend's length or size validation. Invalid metadata remains a backend 400 surfaced as a structured FloPayError.
How immutable snapshots flow
Checkout metadata uses copy-on-write snapshots. Each durable entity owns a separate JSON value rather than a reference to shared live state.
| Record | When its snapshot is taken |
|---|---|
| Checkout session | The request value from POST /v1/checkouts/sessions is fixed when the session is first stored. Omitted or null input produces no returned snapshot. |
| Transaction/payment | The new transaction copies the checkout session snapshot when the payment transaction is created. |
| Subscription | The subscription copies the checkout session snapshot when the subscription is first stored. |
| Invoice | An initial invoice copies its transaction or subscription snapshot when the invoice is first created. A renewal invoice copies the subscription snapshot when that renewal cycle begins. |
| Renewal attempt | Each attempt copies the subscription snapshot when the attempt is reserved, before its provider outcome is known. |
| Rebill result | Each successful or failed rebill result copies the subscription snapshot into a new transaction. |
| Refund and chargeback | Each refund and chargeback record copies the original purchase snapshot when that money-movement record is created. |
Transaction and invoice ledgers use first-write-wins behavior, including a snapshot stored as SQL null. Provider synchronization, retry completion, and reconciliation can enrich other fields on an existing record, but they cannot fill, replace, or remove its checkout snapshot.
Later lifecycle work never rewrites an earlier snapshot. A renewal attempt does not update its parent subscription. A refund does not update its original payment. A chargeback does not update an earlier invoice. Every record continues to describe the context that was attached when that record crossed its own copy boundary.
Why each record owns a copy
Independent snapshots preserve historical meaning. If records shared one mutable map, a later write could make an old payment, invoice, or refund appear to have happened under context that did not exist at the time. Copy-on-write lets API reads, financial reconciliation, and webhook consumers agree about which merchant order a specific record represented.
Create-time only
Checkout metadata is create-time only. Supply it on the initial session creation request. In the detached SDK flow, it is sent on the initial shell POST and is not repeated on the catalog or late-buyer claim.
There is no public post-creation mutation operation. FloPay does not provide metadata search or filter behavior through the public API, and there are no dashboard editing instructions for this feature.
checkoutMetadata is FloPay-local. It is not forwarded to Stripe or PayPal, and it is never merged into provider, catalog, transaction, subscription, or legacy session metadata fields.
Keep metadata non-sensitive
Never put secrets, API tokens, payment credentials, card data, or personal data in checkout metadata.
Treat arbitrary metadata as visible application context. Do not copy it into logs, URLs, or telemetry. Use opaque internal references such as merchantOrderId: "order-123", then retrieve any sensitive business record through your own authorized system.
Complete checkout example
A full checkout page with order summary, discount timer, and FloPayCheckout handling all payment logic.
Complete Page
'use client';
import type { NormalizedCheckoutSession, PaymentResult } from '@flopay/shared';
import { Suspense, useCallback, useEffect, useMemo, useState } from 'react';
import { buildCheckoutDisplayData, configureFlopay, resolveBillingApiUrl } from '@flopay/shared';
import { FloPayCheckout } from '@flopay/react';
import { PaymentAPI } from '@flopay/js';
import { useSearchParams } from 'next/navigation';
// Configure once at module load
configureFlopay({ environment: 'production' });
function CheckoutContent() {
const searchParams = useSearchParams();
const sessionId = searchParams.get('id') ?? '';
const modeParam = searchParams.get('mode') as 'full' | 'auto' | 'confirm' | null;
const [session, setSession] = useState<NormalizedCheckoutSession | null>(null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [countdown, setCountdown] = useState(600);
const api = useMemo(() => new PaymentAPI(resolveBillingApiUrl()), []);
useEffect(() => {
if (!sessionId) return;
let cancelled = false;
(async () => {
try {
const unified = await api.getUnifiedCheckoutSession(sessionId);
if (!cancelled) {
setSession(unified);
if (unified.data.session?.status === 'complete')
window.location.href = '/success';
}
} catch (err) {
if (!cancelled)
setError(err instanceof Error ? err.message : 'Failed to load session');
} finally {
if (!cancelled) setIsLoading(false);
}
})();
return () => { cancelled = true; };
}, [sessionId, api]);
// Countdown timer
useEffect(() => {
const timer = setInterval(() => {
setCountdown((prev) => {
if (prev <= 1) { clearInterval(timer); return 0; }
return prev - 1;
});
}, 1000);
return () => clearInterval(timer);
}, []);
const handleComplete = useCallback((result: PaymentResult) => {
if (result.status === 'succeeded') window.location.href = '/success';
}, []);
const formatCountdown = (seconds: number) => {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${mins}:${secs.toString().padStart(2, '0')}`;
};
if (!sessionId) return <p>No session ID. Browse products first.</p>;
if (isLoading) return <p>Loading...</p>;
if (!session?.data.session) return <p>Checkout Error: {error}</p>;
const cs = session.data.session;
const displayData = buildCheckoutDisplayData(cs);
const { items, currency, total, totalSave, discountPercent } = displayData;
const fmt = (n: number) =>
new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(n);
return (
<div style={{
background: 'white', maxWidth: 526, margin: '0 auto',
borderRadius: '16px', boxShadow: '0 0 34px rgba(43, 51, 67, 0.12)',
overflow: 'hidden',
}}>
{/* Title */}
<div style={{ textAlign: 'center', padding: '1rem 1.5rem 0.25rem' }}>
<p style={{ fontSize: '1.5rem', fontWeight: 600 }}>Safe & Secure Checkout</p>
</div>
<div style={{ padding: '0.25rem 1rem 1.5rem', display: 'flex', flexDirection: 'column', gap: '1.25rem' }}>
{/* Discount timer */}
{countdown > 0 && totalSave > 0 && (
<div style={{
background: '#fef2f2', borderRadius: '8px', padding: '0.5rem',
textAlign: 'center', color: '#991b1b',
}}>
Your Discount Reserved for <strong>{formatCountdown(countdown)}</strong>
</div>
)}
{/* Error */}
{error && (
<div style={{ background: '#FAECE9', borderRadius: '8px', padding: '0.5rem 0.75rem', color: '#C72B23' }}>
Error: {error}
</div>
)}
{/* Order summary */}
<div>
{items.map((item, i) => (
<div key={i} style={{ display: 'flex', justifyContent: 'space-between', padding: '0 0.75rem', marginBottom: '0.5rem' }}>
<span>{item.name.toUpperCase()}</span>
<span style={{ color: '#A8A9AD' }}>{fmt(item.originalPrice)}</span>
</div>
))}
{totalSave > 0 && (
<div style={{ background: '#EFF9F0', borderRadius: '8px', padding: '0.25rem 0.5rem', display: 'flex', justifyContent: 'space-between', marginBottom: '0.5rem' }}>
<span style={{ color: '#7DAD3A', fontSize: '0.8rem', fontWeight: 500 }}>{discountPercent}% DISCOUNT APPLIED</span>
<span style={{ color: '#7DAD3A' }}>-{fmt(totalSave)}</span>
</div>
)}
<div style={{ borderTop: '1px solid #A8A9AD', margin: '0.5rem 0' }} />
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<p style={{ fontSize: '1.5rem', fontWeight: 600 }}>Total Due Today:</p>
<p style={{ fontSize: '1.5rem', fontWeight: 600 }}>{fmt(total)}</p>
</div>
</div>
{/* FloPayCheckout handles everything */}
<FloPayCheckout
sessionId={sessionId}
checkoutMode={modeParam ?? undefined}
onComplete={handleComplete}
onError={(err) => setError(err.message)}
/>
</div>
</div>
);
}
export default function CheckoutPage() {
return (
<Suspense fallback={<p>Loading...</p>}>
<CheckoutContent />
</Suspense>
);
}With Buttons Layout
<FloPayCheckout
sessionId={sessionId}
layout="buttons"
theme="bold-dark"
onComplete={handleComplete}
onError={(err) => setError(err.message)}
/>With Confirm Mode
<FloPayCheckout
sessionId={sessionId}
checkoutMode="confirm"
renderConfirmButton={({ onConfirm, isProcessing }) => (
<button
onClick={onConfirm}
disabled={isProcessing}
style={{
width: '100%', padding: '1rem',
backgroundColor: '#4A49FF', color: 'white',
border: 'none', borderRadius: '8px',
fontWeight: 600, cursor: isProcessing ? 'not-allowed' : 'pointer',
}}
>
{isProcessing ? 'Processing...' : 'Confirm Purchase'}
</button>
)}
onComplete={handleComplete}
/>Key Points
configureFlopay()is called once at module load: not per renderbuildCheckoutDisplayData()formats session data for display (handles discounts, trial naming, item hiding)FloPayCheckoutautomatically readsemail,userId,amount, andcurrencyfrom the session- Error suppression: pass
error={() => <></>}to handle errors entirely viaonError - The component handles 3DS, PayPal redirects, and wallet payments internally
Show your brand on card statements
A statement descriptor is the text your customer sees next to a charge on their card statement. In FloPay you save the dynamic part of that text, for example PREMIUM BOX, on a product, a collection, or your whole company. FloPay sends it with each charge, and the gateway puts your prefix in front of it, so the customer sees ACMEGOODS* PREMIUM BOX instead of one generic name for everything you sell. Customers who recognize a charge are less likely to dispute it. The examples in this section use the placeholder brand ACMEGOODS and placeholder product names: use your own.
Nothing changes until a descriptor is saved. Until you save one, Stripe charges and PayPal orders carry the same statement text as before, and a PayPal lead-in on its own changes nothing, because FloPay never sends it. The one exception is Worldpay: every Worldpay order now carries your Worldpay prefix, or your company name when you have not set a prefix, and there is no activation step for it. See Worldpay prefix and fallback text.
Two of the steps below are yours alone: setting the shortened descriptor on your Stripe account, and making sure your pre-dispute alert enrollment covers the new text. The field-by-field API contract, with every validation rule, both save warnings and the fields recorded on each payment, is in the statement descriptors API reference. Every gateway at a glance is in Statement descriptors by gateway.
Follow these steps in order:
- Learn how the statement text is built and choose a dynamic part that fits.
- Set your Stripe shortened descriptor in the Stripe Dashboard, if you take payments through Stripe.
- Set your Worldpay prefix, if you take payments through Worldpay.
- Set your PayPal lead-in, if you take payments through PayPal.
- Save a descriptor on a product, a collection, or your company, through the API or in the Dashboard.
- Act on the alert enrollment check if you use pre-dispute alerts.
- Check the result on the saved value and on a test payment.
How the statement text is built
On Stripe and Worldpay, the statement text for a charge is built from the prefix, then an asterisk and a space (* ), then the dynamic part. PayPal builds its statement line differently, as described in PayPal statement descriptors.
| Piece | Where it comes from | Example |
|---|---|---|
| Prefix | Your gateway: the Stripe shortened descriptor, or the Worldpay prefix | ACMEGOODS |
| Separator | An asterisk and a space | * |
| Dynamic part | The statement descriptor you save in FloPay | PREMIUM BOX |
The whole text has a budget of 22 characters. The prefix and the separator use part of that budget, so the dynamic part can be at most 22 minus the prefix length minus 2 characters.
Worked example: the prefix ACMEGOODS (9 characters) plus the dynamic part PREMIUM BOX (11 characters) gives ACMEGOODS* PREMIUM BOX, which is exactly 22 characters.
On Stripe and Worldpay, when the dynamic part is too long, the dynamic part is cut at charge time and the prefix always stays whole. PayPal never cuts: it skips a value that does not fit. With the prefix ACMEGOODS there is room for 11 characters, so a saved PREMIUM BOX PLUS (16 characters) shows on the statement as ACMEGOODS* PREMIUM BOX. The save response tells you when this will happen: statementDescriptorWarnings lists each gateway where your value is longer than that gateway allows, with its maxLength and a preview. See Save warnings.
FloPay also checks every value when you save it. A descriptor needs at least one letter, can be up to 18 characters, and cannot contain <, >, \, ', " or *. Anything else is refused and nothing is saved. The full rules are in Validation.
Set your Stripe shortened descriptor
On Stripe, the prefix is your Stripe account's shortened descriptor. You set it in the Stripe Dashboard. FloPay reads it from your Stripe account each time your Stripe connection is validated, for example when the gateway is activated, and never changes your Stripe settings. FloPay has no field for it, so you cannot type it in FloPay.
To set it:
- Sign in to the Stripe Dashboard for the Stripe account you connected to FloPay.
- Open the public business details settings, where Stripe keeps your statement descriptor and your shortened descriptor. Stripe moves its settings pages from time to time, so if you cannot find them, search the Stripe Dashboard for "shortened descriptor".
- Enter a short brand name your customers recognize, for example
ACMEGOODS, and save it in Stripe. Every character of it comes out of the 22-character budget, so shorter leaves more room for the dynamic part.
FloPay picks up a changed value the next time it validates your Stripe connection. Until then, FloPay's previews, save warnings, and alert check use the value it read last.
What happens in each case:
- No shortened descriptor set: Stripe puts your full account statement descriptor in front of the dynamic part instead, and long text can be cut in places you do not expect. Set a shortened descriptor before you save descriptors in FloPay.
- No descriptor applies to a charge: the request FloPay sends to Stripe is unchanged, so the statement looks the same as before.
- Upper case: Stripe shows statement text in upper case, so a saved
Premium Boxappears asPREMIUM BOX. - A value Stripe would reject: FloPay sends the charge without a descriptor, so your account's default statement text applies, and the payment still goes through.
FloPay sends the descriptor on every card and wallet charge it creates through Stripe: the first checkout payment, upsells, saved-card purchases, rebills, dunning retries, one-off charges, and manual captures. Other Stripe payment methods do not carry it yet: see Stripe non-card payment methods.
Worldpay prefix and fallback text
Worldpay accepts dynamic statement text on every FloPay merchant code, so there is no activation step. You set your prefix on the Worldpay gateway settings in FloPay, the same gateway record described in Gateway settings. With a prefix and a descriptor, the text is PREFIX* DESCRIPTOR, built and cut the same way as on Stripe.
Every Worldpay order FloPay creates carries statement text from the first rule that applies:
- Prefix and descriptor:
PREFIX* DESCRIPTOR, with the dynamic part cut so the prefix stays whole. - Descriptor only: you have not set a prefix, so the descriptor is sent alone.
- Prefix only: no descriptor applies to the charge, so the prefix is sent alone.
- Neither: your company name, cut to the length limit.
FloPay never sends fixed FloPay text on a Worldpay order, and it applies the same 22-character budget to Worldpay text. If Worldpay rejects an order because of its statement text, FloPay retries it once with the text from the next rule, and the payment still goes through.
PayPal statement descriptors
PayPal statement descriptors are on as standard: there is no activation step and no setting to change. FloPay sends the resolved dynamic part on the PayPal orders it creates: first payments, upsells and saved-payment rebills.
PayPal composes the statement line itself, and not the way Stripe and Worldpay do. It prints the fixed text PAYPAL * (8 characters), then a space and the descriptor on your PayPal business profile, then a space and the dynamic part FloPay sends. There is no * before the dynamic part.
FloPay cannot read your PayPal profile descriptor, so you can type it on your PayPal gateway as an optional lead-in, for example the placeholder ACME. The lead-in is up to 10 characters and follows the same rules as the Worldpay prefix: it needs at least one letter and cannot contain <, >, \, ', " or *. FloPay never sends the lead-in to PayPal. It uses it to work out how much room the dynamic part has, to build the preview in the save warnings, and to run the alert enrollment check. The Dashboard has no lead-in field yet, so set it with paypalStatementDescriptorPrefix on PATCH /v1/settings/gateways/:id, as described in Gateway prefix fields. Send null or "" to clear it.
PayPal prints at most 22 characters. The prefix is PAYPAL * followed by a space and your lead-in when you set one, and PayPal puts one more space before the dynamic part, so the dynamic part can be at most 22 minus the prefix length minus 1. That leaves 13 characters with no lead-in, and 8 with the placeholder lead-in ACME:
| Lead-in | Prefix | Room for the dynamic part | Example statement line |
|---|---|---|---|
| None | PAYPAL * (8 characters) | 13 characters | PAYPAL * PREMIUM BOX |
ACME | PAYPAL * ACME (13 characters) | 8 characters | PAYPAL * ACME STARTER |
FloPay only sends a dynamic part made of letters, digits, spaces, . and -. A value with any other character (FloPay's own rules allow characters such as & or accented letters), an empty or whitespace-only value, or a value over the budget is not sent and not cut. The order goes to PayPal exactly as it would with no descriptor, the PayPal account default applies, and the payment still goes through. With no lead-in, PREMIUM BOX PLUS (16 characters) is skipped on PayPal, while Stripe and Worldpay cut it. The save response warns you: statementDescriptorWarnings has an entry for each PayPal gateway where the value is too long, with its maxLength and preview.
If PayPal rejects the descriptor on an order, FloPay retries once without it, and the payment completes. That payment records no descriptor.
Changing the lead-in runs the alert enrollment check for that PayPal gateway, and the gateway update response carries preDisputeAlertWarnings.
Stripe non-card payment methods
Statement descriptors for Stripe payment methods other than cards and wallets are not yet available. Bank debits such as SEPA Direct Debit and US bank account do not carry a descriptor yet: FloPay sends them exactly as before, and they show your Stripe account's default statement text. Apple Pay and Google Pay count as cards, so wallet payments carry the descriptor like any other card charge.
Save a statement descriptor
You can save a descriptor at three levels, through the API as shown below or in the Dashboard as described in Set descriptors in the Dashboard:
| Level | Save it with | Applies to |
|---|---|---|
| Product | POST /v1/products or PATCH /v1/products/{productUuid} | Charges where every product has this same value |
| Collection | POST /v1/collections or PATCH /v1/collections/{collectionUuid} | Charges whose products are all in the collection |
| Client | PATCH /v1/company | Every other charge |
For each charge FloPay picks one value: product first, then collection, then client, then nothing. A basket that mixes products with different values, or with and without a value, falls back to the collection or client value. The exact rules are in Cascade.
To set a descriptor for your whole company, use an OAuth access token for an owner or admin. PATCH /v1/company refuses an API token sent with HTTP Basic with a 403:
curl -X PATCH https://api.flopay.com/v1/company \
-H "Authorization: Bearer $FLOPAY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"statementDescriptor": "PREMIUM BOX"
}'To give one product its own text, send the same field to PATCH /v1/products/{productUuid}. The product and collection endpoints also accept your API token over HTTP Basic:
curl -X PATCH https://api.flopay.com/v1/products/PRODUCT_UUID \
-u "$FLOPAY_CLIENT_ID:$FLOPAY_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"statementDescriptor": "STARTER KIT"
}'Send null to clear a value. A request that leaves the field out does not change it. Only owners and admins can change the company value.
Set descriptors in the Dashboard
Everything in Save a statement descriptor can also be done in the FloPay Dashboard. Each field sits where you already edit the thing it belongs to:
| Level | Where to set it in the Dashboard |
|---|---|
| Client | Settings, then Brand: the statement descriptor section, which is separate from your brand theme |
| Collection | The statement descriptor field on the collection create and edit form |
| Product | The statement descriptor field on the product create and edit form |
An empty field means the descriptor is not set at that level, so the next level in the cascade applies. To clear a value, empty the field and save. The Brand page saves the client value on your company, the same as PATCH /v1/company, and saving your brand theme never changes it. Only owners and admins can save the client value. For anyone else the save is refused with an error message.
Live preview. Under the field, a live preview shows the statement text a charge would carry on each gateway you have active. It updates as you type. When the value is too long for a gateway's prefix, the preview shows which characters would be cut. That is a warning, not a block: the value still saves. Stripe rows are in upper case, as Stripe prints them, and a Worldpay row with nothing to send shows the Worldpay fallback text. A gateway whose prefix the Dashboard does not know, which today includes PayPal, shows the value alone with a note that the prefix is not available yet and the final text may differ. The warnings the API returns after a save cover PayPal too.
Which level wins. The collection and product forms also show which level currently wins: product, collection, client or none. They use the value you have typed, so you see the effect before you save. The product form works the level out for a charge of that product alone: its own value, then a single value shared by its live collections, then the client value. The collection form reminds you that a product with its own descriptor wins over the collection value.
Values that cannot be saved. The forms check every value the way the API does. A value that contains <, >, \, ', " or *, a value with no letter (a descriptor needs at least one letter), or a value over 18 characters cannot be saved: Save stays disabled and the form says why. A value that passes these rules but is too long for a gateway's prefix saves with a warning.
After you save. The form lists the warnings the API returned. Each statementDescriptorWarnings entry appears as a notice with its gateway and preview. When you use pre-dispute alerts, each preDisputeAlertWarnings entry appears as an alert warning with its final text and message, as explained in Check your pre-dispute alert enrollment. The alert warning never blocks the save: the descriptor is already saved when you see it.
Gateway pages. Under Settings, then Gateways, each gateway page has a Statement descriptor prefix section:
- Stripe: read-only, with no input. It shows the shortened descriptor FloPay read from your Stripe account. When none is set, it shows the prefix Stripe derives from your account's statement descriptor and a hint to set a shortened descriptor in the Stripe Dashboard. See Set your Stripe shortened descriptor.
- Worldpay: the Worldpay gateway page has a Prefix field (up to 10 characters) and a Save prefix button. Empty the field and save to clear the prefix. Below the field, a preview shows the fallback text Worldpay prints when no descriptor resolves: your prefix alone, or with no prefix, the company-name text FloPay sends. See Worldpay prefix and fallback text.
- PayPal: there is no lead-in field in the Dashboard yet. Set it through the API, as described in PayPal statement descriptors.
Worked example: on Stripe with the shortened descriptor ACMEGOODS, you set the client value ACME SHOP on the Brand page, the collection value GIFT BOXES on a collection, and the product value PREMIUM BOX on a product in that collection. The product form shows that the product level wins, and a charge for that product alone gives ACMEGOODS* PREMIUM BOX.
Clear the product value and the same charge gives ACMEGOODS* GIFT BOXES, because every product in it is in that collection. Clear the collection value too and it gives ACMEGOODS* ACME SHOP. A charge that adds a product from outside the collection never uses the product or collection value, so it gives ACMEGOODS* ACME SHOP as well.
Check your pre-dispute alert enrollment
If you use pre-dispute alerts, each incoming alert is matched to you by the statement text on the charge. A new descriptor changes that text, so FloPay checks whether alerts for the new text would still reach you.
When it runs. The check runs when you have pre-dispute alerts set up (at least one live enrolled descriptor) and you save a non-empty descriptor at any level: product, collection, or client. Saving the same value again runs it again. FloPay also runs it when you change your Worldpay prefix or your PayPal lead-in.
How text is matched. The check uses the same rule FloPay uses for incoming alerts: the final text matches an enrolled descriptor when it starts with it, ignoring punctuation, spaces, and case. For example, ACMEGOODS * STARTER KIT matches ACMEGOODS.
- FloPay checks each alert network you have a live enrollment on (
ethoca,rdr,cdrn) against every live enrollment on that network, because incoming alerts are matched the same way. An exact match wins first. Otherwise the longest enrolled descriptor the text starts with wins. - Enrolled descriptors with fewer than 4 letters or digits are never used as a prefix.
- If another FloPay client's enrollment wins, or ties with yours, alerts would not reach you. FloPay never shows you another client's descriptor.
What you get. The save response carries preDisputeAlertWarnings, with one entry per gateway whose prefix FloPay knows. Each entry has the finalText for that gateway and a result, which is attributed only when every network matches the text to you:
result | What it means | What to do |
|---|---|---|
attributed | Alerts for this text would be matched to you. | Confirm with your alert provider that this variant is covered. |
unmatched | Alerts for this text would not be matched to you. | Enroll the descriptor before using it: ask your alert provider to enroll the final text, or a prefix of it, then save the value again to rerun the check. |
The save goes through either way, so the descriptor applies to charges as soon as it is saved. If you get unmatched and cannot enroll right away, clear the value until the enrollment is live. Gateways whose prefix FloPay does not know get no entry, so they are not checked.
Statement descriptors by gateway
| Gateway | Status | Where the prefix comes from | Character budget | When the value is too long |
|---|---|---|---|---|
| Stripe cards and wallets | On as standard | Your Stripe shortened descriptor, set in the Stripe Dashboard and read-only in FloPay | 22 characters in total: the dynamic part gets 22 minus the prefix length minus 2 | Cut at charge time, with the prefix kept whole |
| Stripe non-card methods | Not yet available | None: no descriptor is sent | Not applicable | Not applicable |
| Worldpay | On as standard, no activation step | Your Worldpay prefix, up to 10 characters, set on the Worldpay gateway settings | 22 characters in total: the dynamic part gets 22 minus the prefix length minus 2 | Cut, with the prefix kept whole. With no descriptor, the four fallback rules decide the text |
| PayPal | On as standard, no activation step | PAYPAL * plus your optional lead-in, set through the gateway settings API | 22 characters in total: the dynamic part gets 22 minus the prefix length minus 1 (13 with no lead-in) | Skipped, not cut: nothing is sent and the PayPal account default applies |
Stripe and Worldpay put * between the prefix and the dynamic part. PayPal puts a space. The details are in Set your Stripe shortened descriptor, Stripe non-card payment methods, Worldpay prefix and fallback text and PayPal statement descriptors.
How descriptors behave
- Worked out fresh at every charge. FloPay picks the descriptor for each charge from your settings at that moment. A change applies from the next charge, including the next rebill of a subscription that already exists. Charges already made keep what they carried, and a rebill replay reuses the descriptor of the attempt it replays.
- Flo-owned subscriptions only. For subscriptions, descriptors apply to Flo-owned subscriptions only: the ones whose renewals FloPay charges itself. A subscription the gateway bills itself, such as one Stripe renews on its own, keeps the gateway's own statement text.
- A descriptor problem never fails a payment. If a value cannot be used, or a gateway rejects it, FloPay sends the payment without it and the gateway default is used instead. On Worldpay, FloPay uses the next fallback text. Either way the payment goes through.
See the descriptor on a payment
Every payment records what it carried, so you can check the result and answer a customer who does not recognize a charge.
In the Dashboard. The payment detail page has a statement descriptor section with three values: the descriptor sent (the dynamic part FloPay sent to the gateway), its source level, and the final statement text, or "Not reported by the gateway" when the gateway reported none. A payment with level none shows only "No statement descriptor recorded".
The source level says where the text came from:
| Level | Meaning |
|---|---|
product | The product-level descriptor won the cascade. |
collection | The collection-level descriptor won the cascade. |
client | The descriptor saved on your company applied. |
prefix | Worldpay only: no descriptor resolved, so the Worldpay prefix was sent alone. The Dashboard shows "Worldpay prefix only". |
company_name | Worldpay only: no prefix and no descriptor, so the company-name text was sent. The Dashboard shows "Company name (Worldpay fallback)". |
none | Nothing was sent. |
Payments made before the release, and payments where nothing was sent, show none and no text. A Worldpay order with no descriptor still carries your prefix or company-name text, so it shows prefix or company_name with its final text. A rebill replay shows the original attempt's values, because it reuses that attempt's descriptor, while a new attempt shows what it resolved from your settings at the time.
Stripe and Worldpay record the final text. For Stripe it is the statement text Stripe reports for the charge, which can arrive shortly after the payment. For Worldpay it is the narrative FloPay sent in the order. PayPal records none, because PayPal does not report the text it prints, so a PayPal payment shows the descriptor sent, its level and "Not reported by the gateway".
In exports. Payment exports can include the same three values as the columns Statement descriptor, Statement descriptor level and Statement descriptor final text. The columns are off by default, so existing exports keep their layout: select them when you set up an export to add them.
Through the API. Every payment carries statementDescriptor, statementDescriptorLevel and statementDescriptorFinalText. Their types and what null means are in Per-payment fields.
Statement descriptors in data replicas
If you read your data from a client data replica, it carries the descriptor data too. The change is additive: no existing table or column changed, so the queries you already run keep working. Two tables are new to the replica: client, which holds only your own row with its uuid and statement_descriptor, and collection, which holds your collections.
| Column | Table | What it contains |
|---|---|---|
statement_descriptor | client | The client-level descriptor saved on your company, or empty when none is set. |
statement_descriptor | collection | The collection-level descriptor, or empty when none is set. |
statement_descriptor | product | The product-level descriptor, or empty when none is set. |
statement_descriptor | transaction | The dynamic part sent with the payment, or empty when none was sent. |
statement_descriptor_level | transaction | The source level of the payment's descriptor: product, collection, client, prefix, company_name or none. |
statement_descriptor_final_text | transaction | The final statement text, the same value as statementDescriptorFinalText: the text Stripe reported for the charge, or on Worldpay the narrative FloPay sent in the order. Empty when there is none, which is always the case on PayPal. |
Each column holds the same value as the matching API field. Payments made before the release have empty values in the three transaction columns, and the API reads an empty level as none.
Check the statement descriptor result
- Read the value back with
GET /v1/company,GET /v1/products/{productUuid}, orGET /v1/collections/{collectionUuid}.statementDescriptoris the trimmed value you saved, ornullwhen the level has none. - Check the save response. An empty
statementDescriptorWarningsmeans the value fits every gateway whose prefix FloPay knows. EverypreDisputeAlertWarningsentry should beattributedand confirmed with your alert provider. - Take a test payment for a product the descriptor applies to. Open it on the payment detail page in the FloPay Dashboard, as described in See the descriptor on a payment, or in your Stripe Dashboard, and compare the statement text with the text you expect, for example
ACMEGOODS* PREMIUM BOX. - If the text is not what you expect, check which level applied. A product value only applies when every product in the charge has the same value, and a collection value only when the collections containing every product agree on one value.