Testing
Make sure your integration behaves correctly — creating a Payment Intent, loading the widget, and handling the result — before you rely on it in production.
Use Sandbox to test the whole flow — invoices, products and the widget — without moving real money. Flip your dashboard to Sandbox, or create the Payment Intent with mode: 'sandbox' (it is set when the intent is created, not in the widget). The checks below still apply to your integration logic.
What to check
- Your server creates a Payment Intent and receives a
client_secret. - The widget loads on your domain and accepts the
client_secret. - You correctly handle the
successanderrormessages from the widget — includingstatus: "pending", which must not lead to a second payment. - You resize the iframe in response to
resizemessages (the SDK does this for you). - Your server reads the intent back and checks status, amount, currency and
modebefore fulfilling — never on the browser's word alone. - The customer sees the 3-D Secure prompt when their bank requires one, and the flow completes either way.
- For a subscription: the widget shows the terms and requires the checkbox,
successcarriessubscription.status: "pending_activation", and your server waits for the agreement to become active before granting access. - A card declined at the charge leaves the intent
failed; one that fails or is abandoned earlier, in 3-D Secure, leaves itrequires_payment. Either way nothing was taken and the customer can retry. A declined wallet payment arrives aspayment_ended { outcome: "failed" }and then anerrorwith areference, and leaves the intentrequires_payment; the intent'slast_attemptmay describe it once the widget has prepared the next wallet attempt, so do not depend on it being there. A closed wallet sheet posts onlypayment_ended { outcome: "cancelled" }. - Your server never reads
requires_paymentorfailedas paid, and never readsprocessingas unpaid. - If your checkout creates the order before charging: an empty card form is caught by
validate()and no order is created. - Your page honours
onActive/payment_started: a cart edit while a payment is active is queued, never applied by remounting the widget. - A second
submit()while one is pending rejects with "A payment is already in progress."; a page on an unregistered host (or an unregistered port) getsorigin_not_allowed. A wrong publishable key produces no callback at all — the frame answers 404 — so treat a widget that never reachesonReadyas a wiring problem. - If you use wallets under your own button: returning anything but
truefromonWalletAuthorize, or answering too late (18 s Apple Pay, 30 s Google Pay), ends withpayment_ended { outcome: "cancelled" }, nothing charged — and your server handles the order it created for that attempt. - Your reconciliation covers the known Google Pay issue: an intent that stays
requires_paymentafter the customer approved a wallet payment is checked against the transaction (GET https://app.securepayapi.com/api/v1/transactions/{transaction_reference}) or the dashboard before you ask for another payment. See 3-D Secure.
Pay with the test cards in sandbox for each of these.
Discount codes
If you use coupons on a hosted checkout page, enter a code and confirm the total updates correctly before payment. Manage your codes per product in Products & pricing.
Going live
Once your integration handles the full flow cleanly, you're ready to take real payments. Keep your secret key server-side and monitor your first live transactions from your dashboard.