Skip to content
In this section

Hosted checkout

Accept payments by redirecting customers to a Fynex-hosted page — the lowest-PCI path to going live.

Hosted checkout is the simplest, lowest-friction way to accept a payment with Fynex. Card details are entered on a Fynex-hosted page, so your servers and frontend never touch raw PAN/CVV — your PCI obligations stay at the SAQ A level.

When to use it

  • You want to ship fast.
  • You don't have an existing card-collection UI.
  • You're OK redirecting customers to a Fynex domain to complete the payment.

If you need to keep the customer on your own domain or already manage card data securely, use server-to-server instead.

Lifecycle

Your backendFynexCustomer browserPOSTresponseredirectsubmitredirectpoll statusCreate sessionPOST /checkoutSession createdsessionId, checkoutUrlRedirect customerto checkoutUrlHosted payment pageCard form and 3DSProcess paymentAuthorize and captureReturn to your sitereturnUrls.success or .failureVerify and fulfilWebhook or poll status

Note

Fynex delivers a PaymentCompleted webhook to the webhook URL(s) configured on your seller account (your receiver must return HTTP 200). To verify the final payment state — or as a backstop — poll GET /payments-api/v1/payments/{payment_id} (bearer token; the path value is your externalOrderRef) from your server, or subscribe to SSE events in the browser. See the Polling & SSE guide.

Step-by-step

  1. Create a checkout session from your backend

Send POST /payments-api/v1/checkout with a Bearer token and a unique Idempotency-Key header.

curl -sS -X POST "$FYNEX_API/payments-api/v1/checkout" \
  -H "Authorization: Bearer $FYNEX_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "externalOrderRef": "ORDER-1042",
    "amount": 49.00,
    "currencyCode": "GBP",
    "countryCode": "GB",
    "returnUrls": {
      "success": "https://example.com/orders/1042/success",
      "failure": "https://example.com/orders/1042/failure"
    },
    "description": "Order #1042"
  }'

You receive a 201 Created response:

   {
     "sessionId": "6f9b84e1-3b83-4fb9-9f42-a8ac27d11d6b",
     "checkoutUrl": "https://pay.fynex.ai/checkout/6f9b84e1-3b83-4fb9-9f42-a8ac27d11d6b",
     "expiresAt": "2026-04-29T13:30:00Z"
   }

The TTL is set server-side; expiresAt tells you when the session will become invalid.

  1. Redirect the customer

Send a 302 to checkoutUrl, or render it as a button. Do not embed it in an iframe — browsers may block cross-origin iframe navigation.

   res.redirect(302, session.checkoutUrl);
  1. Customer completes the payment on the hosted page

3DS challenges, if required, are handled internally by the hosted page. Your integration does not need to manage any 3DS redirect.

  1. Customer is redirected back

On completion, Fynex redirects the customer to returnUrls.success (payment completed) or returnUrls.failure (payment failed or abandoned). The redirect itself carries no authoritative payment state — do not grant fulfilment based on it. For card payments, a redirect to returnUrls.success can mean the payment is authorized with settlement still pending; fulfil on the webhook or a terminal payment status.

  1. Verify the payment status

Poll GET /payments-api/v1/payments/{payment_id} (bearer token; the path value is your externalOrderRef) or use SSE to confirm the final state before fulfilling the order.

See Polling & SSE for code samples.

Request fields reference

Required fields

Field Type Description
externalOrderRef string Your order reference. Stored on both the checkout session and the underlying payment.
amount float Amount in major units (e.g., 49.00 for £49.00).
currencyCode string (3-letter) ISO 4217 code, e.g. GBP. Normalized to upper-case server-side. Note: /checkout does not enforce a currency allowlist — an unsupported currency will be rejected at payment time, not at session creation.
countryCode string (2-letter) ISO 3166-1 alpha-2. Required despite the omitempty JSON tag.
returnUrls.success string URL the customer is redirected to on successful payment.
returnUrls.failure string URL the customer is redirected to on failure. Note the field name is failure, not cancel.

Optional fields

Field Type Description
autoSettlement bool When true, the payment auto-settles immediately; false leaves it for manual POST /capture. Omitted means the seller account's configured default.
orderData.payeeDistribution array Split funds across payees. Each element is { "payeeId": <int64>, "amountMinor": <int64> }, the share in integer minor units (8500 for £85.00). The deprecated { "payeeId": <int64>, "amount": <float> } in major units is still accepted; every element must use the same one. The shares, plus orderData.sellerShareMinor when sent, must add up to the payment amount. See Split payments.
orderData.sellerShareMinor integer Optional. Your own share of the payment in integer minor units (5356 for £53.56); it stays on your main wallet while the payees receive theirs. Sent only with payeeDistribution, never negative. See Split payments.
sellerMerchantName string Business name displayed on the hosted checkout page.
logoUrl string Logo URL displayed on the hosted checkout page.
locale string Language code (e.g., en). Falls back to the seller account locale, then en.
description string Order description shown to the customer (e.g., "Order #1042").
allowPromotions bool When true, the customer may apply a coupon or Fynex wallet credit on the hosted page, and the amount charged is then lower than amount by the promotion. Defaults to false: the customer pays exactly amount. Promotions are offered only once Fynex has switched coupon checkout on.
customer object The buyer's details, if you already hold them. All sub-fields optional; see Passing the buyer's details.

Passing the buyer's details

Send customer when you already know who is paying, so the buyer does not type it again:

"customer": {
  "email": "buyer@example.com",
  "phone": "+447700900123",
  "billingAddress": {
    "country": "GB",
    "city": "London",
    "line1": "1 Example Street",
    "line2": "Flat 5",
    "postalCode": "SW1A 1AA",
    "state": "Surrey"
  }
}

It is checked with the same rules the hosted page applies when the buyer types the address:

Field Rule Refusal code (HTTP 422)
email One address, at most 254 characters, no IP-literal domain. Stored lower-cased. customer_email_invalid
phone At most 32 characters. Needs billingAddress. customer_phone_invalid
billingAddress.country Required. ISO 3166-1 alpha-2. customer_billing_country_invalid
billingAddress.line1 At most 128 characters. Required, unless your active checkout design uses the country_aware billing-address mode and country is not GB, US or CA. customer_billing_line1_invalid
billingAddress.line2 At most 128 characters. customer_billing_line2_invalid
billingAddress.city At most 64 characters. Required, unless your active checkout design uses the country_aware billing-address mode and country is not GB, US or CA. customer_billing_city_invalid
billingAddress.postalCode Required, at most 10 characters. customer_billing_postcode_invalid
billingAddress.state Required for US and CA, where it must be the 2-letter state or province code (NY, ON). Free text up to 64 characters elsewhere. customer_billing_state_invalid

Fields containing control characters or invisible formatting characters (bidi overrides, zero-width spaces) are refused with the field's code. Validation runs before the idempotency check, so an invalid customer is refused with 422 even when you replay an Idempotency-Key. The one exception is the line1/city requirement that depends on your design's billing-address mode, which you can change between a request and its replay: a replay of a checkout created under the earlier mode returns the original checkout, and the same key with a different customer returns 409 Conflict.

customer is stored as your record of the buyer and is used only as a prefill. It is never treated as what the buyer submitted (the one exception is Sending the buyer straight to the card page, where the buyer types nothing and your values are recorded):

  • The hosted page shows your email, country, postcode, state, line1 and city, and the buyer can change them. line2 and phone are not shown. If the buyer submits the card form with the same country, postcode and line1 as yours and leaves those fields empty, your line2 and phone are kept.
  • Email precedence, from highest: a returning buyer's verified email (shown read-only, and your email is then not shown); the addressee of a payment link; your customer.email. The payment records only the email the buyer submits, or the one Google Pay returns. If the buyer clears your email, the payment has no buyer email, because your value was only a prefill.
  • Billing address: the payment records the address the buyer submits on the card form or the one Apple Pay or Google Pay returns. A wallet payment that returns no address goes without one; your customer.billingAddress is not sent to the payment provider in its place.

On some card routes Apple Pay and Google Pay are switched on per acquiring channel by Fynex (not yet the default); where they are off, the page does not show them.

customer is part of the idempotency comparison: replaying an Idempotency-Key with a different or missing customer returns 409 Conflict.

Sending the buyer straight to the card page

Where Fynex has enabled it for your account, a checkout that carries a complete billing address skips the Fynex form. The buyer briefly sees "Redirecting to secure payment…" and lands directly on the secure card page.

You send The buyer sees
customer.billingAddress with country, line1, city, postalCode (and state for US and CA) "Redirecting to secure payment…", then the card page. Nothing to fill in on the Fynex page.
No customer, or customer with only email (no billingAddress) The Fynex checkout page, as described above.

A billingAddress with a required field missing or invalid is refused with 422 when you create the checkout (see the table above). It never falls back to the Fynex page.

A complete request:

curl -sS -X POST "$FYNEX_API/payments-api/v1/checkout" \
  -H "Authorization: Bearer $FYNEX_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "externalOrderRef": "ORDER-2041",
    "amount": 240.00,
    "currencyCode": "EUR",
    "countryCode": "DE",
    "returnUrls": {
      "success": "https://example.com/orders/2041/success",
      "failure": "https://example.com/orders/2041/failure"
    },
    "description": "Order #2041",
    "customer": {
      "email": "buyer@example.com",
      "phone": "+493012345678",
      "billingAddress": {
        "country": "DE",
        "line1": "Musterstraße 1",
        "line2": "Wohnung 3",
        "city": "Berlin",
        "postalCode": "10115"
      }
    }
  }'

The buyer gets the Fynex page instead, even with a complete address, when:

  • allowPromotions is true;
  • the checkout is a payment link or a subscription;
  • the checkout is shown through the Checkout widget. To use this path, redirect the buyer to checkoutUrl instead, and do not put checkoutUrl in your own iframe (see step 2);
  • the card page cannot be opened for this payment. The buyer then sees the Fynex page with your details prefilled, so your integration must work with either page.

On this path the buyer types nothing on the Fynex page, so your values are what the payment records:

  • Send the buyer's real details. The buyer does not see or confirm them here, and they become the payment's record.
  • The receipt goes to customer.email. Your billing address (including line2), customer.phone and customer.email are recorded as the payment's billing details and used for the receipt, payment notifications and the settlement report. Of these, only customer.email is passed to the card page; the billing address and phone are not. A wrong email sends the buyer's receipt to that address.
  • They are your claim, not the buyer's. Fynex records them as merchant-supplied. No card is saved on this path, and your values never take precedence over an email the buyer's wallet returns.
  • The buyer's own entries win. If the buyer ends up on the Fynex page and pays there, what they submit replaces your values (your line2 and phone are kept only if they keep your country, postcode and line1, as described above).
  • The redirect is not a payment result. Confirm the outcome before fulfilling: poll the payment or use SSE as in step 5, or handle the PaymentCompleted webhook and check its lifecycleStatus. PaymentCompleted is also sent for failed payments.

Caution

Fields that do NOT exist on this DTO: successUrl, cancelUrl, expiresInMinutes, metadata, customerEmail (use customer.email), payeeId (top-level), splitRules (top-level). Do not send these — the server will ignore them silently or reject the request.

Split payments

To distribute the captured amount across multiple payees, include orderData.payeeDistribution. Retrieve payee IDs from GET /payments-api/v1/payees.

Note

payeeDistribution only takes effect alongside an active Split Rule on your seller account — with no active rule, it's silently ignored and nothing is distributed. See Split Rules § Precedence when both are present for exactly how the two interact.

{
  "externalOrderRef": "ORDER-1042",
  "amount": 100.00,
  "currencyCode": "GBP",
  "countryCode": "GB",
  "returnUrls": {
    "success": "https://example.com/success",
    "failure": "https://example.com/failure"
  },
  "orderData": {
    "totalAmount": 100.00,
    "payeeDistribution": [
      { "payeeId": 101, "amountMinor": 8500 },
      { "payeeId": 102, "amountMinor": 1500 }
    ]
  }
}

amount and orderData.totalAmount are in major units. Each share's amountMinor is in integer minor units, so 8500 is £85.00. The shares must add up to amount in minor units, which is 10000 for the £100.00 above (or to orderData.totalAmount if you provide it). A distribution sent in the wrong unit cannot add up, so it is refused with 400. The deprecated major-units amount on a share is still accepted, but every share in one distribution must use the same unit — see Split Rules. What happens to the money afterwards (fees, rounding, holds, refunds) is described in Split Rules, section How Fynex splits money.

To pay a payee a set amount and keep the rest, send your own part as orderData.sellerShareMinor, in minor units. The shares plus sellerShareMinor must add up to the payment amount: for a £717.00 payment, { "payeeId": 101, "amountMinor": 66344 } and "sellerShareMinor": 5356. With no rule fee the payee receives exactly £663.44 on a full capture; with a rule fee or a partial capture every part scales pro rata. The field is ignored with an absolute-mode rule, like payeeDistribution. See Split Rules, section Keeping your own share.

3DS handling

The hosted checkout page manages the entire 3DS flow internally. If the issuer requires a challenge, the customer completes it on the hosted page without ever leaving the Fynex-controlled flow. Your backend only sees the final outcome via polling/SSE — there is no requiresAction or redirectUrl on this path.

If you need direct control over the 3DS redirect (e.g., your own checkout UI), use server-to-server instead.

Common pitfalls

Warning

Do not fulfil the order based on the redirect alone. A user can navigate directly to returnUrls.success without paying. Always verify the payment state server-side before dispatching goods or services.

Caution

401 seller auth is required

/checkout answers this when the request carries no authenticated seller — a missing, malformed or revoked Bearer token (/initialize-payment phrases the same condition as merchantId is missing in auth context). It is not an Idempotency-Key problem: a missing or non-UUID key answers 400 with Idempotency-Key header is required / Idempotency-Key must be a valid UUID, and that check runs only after the token has passed. Fix the token for a 401, the header for those 400s.

  • Idempotency-Key reuse with a different body returns 409 Conflict — allowPromotions and customer included. Use a fresh UUID per order.
  • returnUrls.failure — not cancelUrl. The field is named failure. Sending cancelUrl has no effect.
  • currencyCode is not validated at session creation. An unrecognized currency may be silently accepted at /checkout and only rejected when the payment is processed. Test end-to-end in staging.
  • Amount is locked at session creation. To change the amount, create a new session.

Test cards

The hosted checkout page manages 3DS internally and always runs it — unlike the server-to-server flow, the hosted page does not expose the skip3DS flag. Because 3DS always runs, the PAN you use decides the authentication outcome, and a handle that does not authenticate (threeDResult other than Y/A) cannot be settled.

For a happy-path success in staging use one of the frictionless-Y PANs, with any future expiry date and any 3-digit CVV:

Card number Brand
4000 0000 0000 2701 Visa
5200 0000 0000 2235 Mastercard

Important

Do not use 4111 1111 1111 1111 here. It is not one of the authenticating PANs, so on the hosted checkout it always ends in a decline. It only works on flows that skip 3DS.

To exercise a decline or a failed 3DS challenge, use one of the challenge/failure PANs from the Test cards & sandbox guide, which lists the full set.

With no buyer at hand — a test suite, a CI job, an AI agent — a Demo account can pay its own session with POST /test/checkout/{sessionId}/complete: Fynex submits this page with a test card and skips 3DS, so no card details pass through your code and no challenge waits for a browser. A session created with "force3DS": true keeps its 3DS, and the call answers 409 requires_action for it. See Test cards & sandbox.

Payment links are a different API contract from the checkout-session endpoint above: POST /api/v1/payment-links, with the same seller Bearer authentication. Do not use /payments-api/v1/payment-links. Link amounts are decimal strings in major units.

{
  "externalOrderRef": "ORDER-1042",
  "type": "one_time",
  "amount": "7.99",
  "currency": "EUR",
  "title": "Order #1042",
  "testMode": true,
  "allowMultipleUses": true,
  "allowPromoEntry": false,
  "returnLinks": [
    {"rel": "default", "href": "https://example.com/orders/1042/return", "method": "GET"}
  ]
}

Find every payment attempt for your order

The optional externalOrderRef is stored on the link and returned in its response. A supplied reference must be nonblank and at most 128 UTF-8 bytes; it is stored without trimming or case folding. It is a merchant correlation reference, not an idempotency key. Creating twice with one reference can create two links; a multi-use link can create several payment attempts. Existing links created before this field was supported are not backfilled.

One status for the order. Call GET /api/v1/payment-links/status?externalOrderRef=ORDER-1042 with your Bearer token (URL-encode the reference). It considers every link of your seller account carrying that exact reference, archived links included, and every attempt on them — but only links of one mode: by default your account's own mode (a Live account counts only live links, a Demo account only test links). Add testMode=true to count only test links, or testMode=false for only live ones. A test link's capture never answers for a live order, even when it reuses the same reference. livemode in the response says which mode was counted:

{
  "externalOrderRef": "ORDER-1042",
  "status": "captured",
  "paymentId": "PL-…",
  "amount": "7.99",
  "currency": "EUR",
  "capturedCount": 1,
  "attemptCount": 3,
  "paymentLinkIds": [512, 498],
  "livemode": true
}
  • status is captured when any attempt captured money; paymentId, amount and currency are then the most recent captured attempt's, and capturedCount says how many attempts captured (more than one means the order was paid more than once).
  • Otherwise status is the lifecycleStatus of the most recent attempt (pending, failed, cancelled, …), with its paymentId, amount and currency.
  • no_attempt means links carry the reference but no checkout was attempted yet; it is not a declined payment. paymentId, amount and currency are omitted.
  • paymentLinkIds lists the matching links, newest first (at most 200), for the drill-down below. No link with the reference in the counted mode answers 404 payment link not found; an invalid or missing reference, or a testMode that is not true/false, answers 400.

Fulfil only when status is captured, livemode is true, and amount and currency equal your order total. The captured attempt can come from any link carrying the reference — not necessarily the newest — so an older link at a different price can be the one that was paid. If capturedCount is above 1, the order was paid more than once and the extra payment needs a refund. captured is not dispute-final: a later chargeback does not change it. To see every attempt rather than the aggregate:

  1. Save the link id returned by creation. To find links by your reference, call GET /api/v1/payment-links?externalOrderRef=ORDER-1042 with your Bearer token. URL-encode the reference. Matching is exact and restricted to your seller account. The list excludes archived links by default; also query with archived=true if you archive links and need their history. A saved link ID remains the simplest lookup.
  2. For each matching link, call GET /api/v1/payment-links/{id}/attempts with the same authentication. Paginate both lists using limit and offset; do not choose an arbitrary latest link when several share the reference.
  3. Check each attempt's lifecycleStatus. Pending, failed and cancelled attempts are included; an empty list means there is no visible attempt yet, not a declined payment. Fulfil only when the authoritative lifecycle is captured, never on a browser return or bank approval alone.

Each attempt retains its own generated payment reference. The link's order reference does not replace it: do not pass the link reference to GET /payments-api/v1/payments/{payment_id} expecting the status of a unique payment. Use the attempt reference for that payment API. The link's own status describes the link, not an aggregate payment result. The existing /{id}/payments remains a collection report and is not a substitute for /{id}/attempts.

Return destinations

Payment links accept successUrl and cancelUrl, or the compatible returnLinks array. returnLinks supports default, on_completed, on_failed and on_cancelled, with method: "GET". A specific outcome overrides default. The link has one non-success destination, so resolved failure and cancellation destinations must be the same when both are supplied. Different destinations, duplicate relations, a fully shadowed destination, unsupported methods, and conflicts with explicit successUrl / cancelUrl are rejected. All accepted destinations still pass the seller's return-host and redirect-safety checks. The create response exposes the resolved successUrl and cancelUrl.

allowMultipleUses permits repeated payments; it does not let a buyer change the amount. The amount remains fixed at link creation.

Add an order block and the link is created together with a merchant order and that order's invoice. The link collects the invoice: paying the link marks the invoice paid and the order paid. The payment always gets a numbered receipt that names the invoice, whether or not the account has payment receipts switched on.

{
  "type": "one_time",
  "currency": "GBP",
  "title": "Kitchen repaint",
  "order": {
    "sellerCustomerId": 4217,
    "items": [
      {"description": "Kitchen repaint", "quantity": "1", "unitAmount": "100.00",
       "taxCategory": "standard", "taxRatePercent": "20"}
    ],
    "paymentTerms": "due_on_receipt"
  }
}
  • sellerCustomerId is one of your customers, with a name and a billing address (the invoice's bill-to). items[].unitAmount is net of tax, in the link's currency; the lines take the same taxCategory / taxRatePercent as the orders API. Without items the order is one line named by the link's title, priced at amount, with no tax.
  • The link asks for the order's total (lines plus tax). With items, leave amount out or send exactly that total; without items, amount is required.
  • The link must be one_time, single use, without promoCodeId, allowPromoEntry: true, autoCalculateTax, expiresAt or testMode (it follows the account's mode), not kind: "invoice", and not a link that already collects a contract's or your billing system's invoice. Accounts whose invoices Fynex issues and collects cannot attach an order.
  • All or nothing: a refused order answers 422 with {"error", "code"} and leaves neither a link, nor an open order, nor an invoice (an invoice issued before the refusal is voided), and emits no payment_link.* event. Codes: order_not_supported, invalid_order, customer_not_found, buyer_address_required, no_jurisdiction, no_issuing_party, invalid_invoice, issuing_unavailable, link_not_attached, issue_failed. A dashboard session also needs the orders:write permission (403, code permission_denied); an API key is the account's own authority, as on the orders API.
  • The customer's stored credit is not drawn by this invoice: the link asks for its whole total.
  • The 201 body and GET /api/v1/payment-links/{id} carry "order": {"id", "orderKey", "invoiceId", "invoiceNumber", "collectsInvoice"}. The order and the invoice are in the order and invoice lists like any other.
  • While collectsInvoice is true the link is cancelled by voiding its invoice, which cancels the link: POST …/cancel, POST …/archive and a PATCH that turns allowPromoEntry on or sets expiresAt answer 409 with code link_has_order. After the invoice is voided the link is cancelled and the order can be invoiced again, through an invoice link of its own.
  • The buyer gets the invoice. With deliveryChannel: "email" and sendImmediately: true the customer receives one e-mail, and it is the invoice (number, amounts, due date, a PDF link and a pay button that opens the link) instead of the payment-link invitation. emailDelivered: false in the 201 body means the e-mail did not go out (the link, order and invoice were still created); send it from the invoice's Remind action, which e-mails the same invoice worded as a reminder (subject Reminder: Invoice …). Without those two options nothing is e-mailed.
  • Opening the link (/p/{token}, or /i/{token}) shows the invoice document with a Pay button while both the invoice and the link can be paid, and the invoice's state (Paid, and so on) afterwards. The PDF is at /p/{token}/pdf (or /i/{token}/pdf). A checkout from the link is refused when its invoice can no longer be paid (410), or when that cannot be checked just then (503, retry), and takes no coupon or credit. Both the start of a checkout (POST /p/{token}/start) and the payment itself are checked, so a checkout opened before the invoice was voided is refused when the buyer pays.
  • Voiding the invoice cancels the link. While the order's record still names the link, opening it shows the voided invoice without a Pay button; POST /p/{token}/start answers 410.
  • In a sandbox account neither the invoice nor the receipt is e-mailed; read them from the dashboard (the receipt is numbered TEST-…).

For an account enabled by Fynex, add the top-level selection to the payment-link request:

"payByBank": {"countryCode": "GB"}

Use currency: "GBP" for the example above. This selects bank-only checkout; it is not paymentType: "apm" and needs no paymentMethod in the link request. The request must be type: "one_time" with allowPromoEntry: false, without subscriptions, invoice mode, promotions, tax calculation or email collection. Seller payment receipts must be disabled: bank-only checkout cannot collect the email that receipts require. Existing bank links and sessions become unavailable if this setting is enabled later.

Environment Account/link mode Bank selection
Staging Demo seller, testMode: true Optional sandbox payByBank.bankId; omit it to choose a bank during checkout.
Production Live seller, testMode: false Omit bankId; the buyer chooses the bank on the provider's secure page. Live bank preselection is not supported.

The old metadata.stagingPayByBank remains a staging-only compatibility format. Do not send it alongside payByBank, and do not rename it to productionBankId. A Live seller cannot use a test-mode bank link to select a different provider environment.

A production request shape does not activate production payments. Fynex must enable and verify the merchant's bank rail, currency/terminal, fee path, safeguarding account, Core/provider configuration, redirect hosts, and payment reconciliation before go-live. An unavailable bank route remains refused; this contract does not bypass those gates. Provider consent or a return redirect is not evidence of received funds.

See also