Testing
Before you take real money, run every outcome your integration has to handle in a sandbox: a payment that succeeds, a decline, a 3D Secure challenge, a refund that fails late, a dispute, a renewal that fails and retries. Everything on Flint runs in test mode with a flint_test_... key, and card charges run against Stripe test mode, so no money moves and you need no real card or Stripe account.
If you're signed in to the docs, each request below runs against your own sandbox with your test key, and IDs from one response fill in the requests that follow.
Test and live traffic share one host, https://api.withflintpay.com. The key prefix decides the mode, and each test key is bound to one isolated sandbox. Sandboxes & test mode covers how keys bind to sandboxes and how to reset or create more.
| To test | Use |
|---|---|
| Success, declines, and 3D Secure in checkout | Test cards in a hosted checkout |
| The same outcomes from a test suite | Test tokens on POST /v1/orders/{order_id}/pay |
| Refunds, including one that fails after it succeeded | Refund requests and a refund-failure card |
| Chargebacks and inquiries | Dispute test cards and a simulated ruling |
| Bank debit outcomes | ACH test account numbers |
| Your risk rules and payment reviews | Metadata-scoped rules and risk test cards |
| Delivery tracking | A package transition |
| Your webhook handler | Test events, then real events |
| Trials, renewals, and failed-payment retries | A test clock |
What you need#
A test API key bound to a sandbox. Create one on the dashboard's API keys page, or let API & agent onboarding provision the merchant and mint its first key from your backend. Then confirm that the sandbox can take card payments:
curl https://api.withflintpay.com/v1/merchant \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": {
"merchant_id": "mer_1kmn0aExample",
"readiness": {
"payments": {"status": "ready", "next_actions": []}
}
}
}
The response is shortened to the part this check reads. readiness.payments.status of ready means every card scenario below works. While it is pending or blocked, its status_reason and next_actions, and readiness.requirements, name what is still due.
Test cards#
Use these numbers anywhere Flint collects a card: hosted checkout, payment links, invoices, and embedded payments. Any future expiry date, any 3-digit CVC, and any ZIP code, such as 44444, work with all of them.
A decline never ends a checkout session. The buyer sees the failure inline and can retry with another card, and the order keeps its outstanding balance until a payment succeeds. Checkout pages opened in test mode show a test-mode banner.
Flint processes cards on Stripe, so every Stripe test card works in a sandbox. To check what any test card number does on Flint, Stripe, or another processor, paste it into the test card lookup.
Simulate a payment outcome#
Create an order, open its checkout page, pay with the card for your scenario, then confirm the result from your backend.
Simulate a decline or 3D Secure#
Repeat steps 1 and 2 with new idempotency keys, then pay with a decline card such as . Checkout shows the failure and lets the buyer retry in place, and the verify call returns the order still open and unpaid with paid_money at 0. A real decline behaves the same way: a retryable failure in checkout and an unpaid order in the API.
With , checkout opens a 3D Secure challenge. Complete it and the payment succeeds; fail it and the payment declines. Test both branches, because real buyers abandon challenges.
Pay from the API with a test token#
To run card scenarios from a test suite or a terminal, skip the browser and pay the order directly. POST /v1/orders/{order_id}/pay takes a Stripe test payment method token in payment_source.token:
| Token | Result |
|---|---|
pm_card_visa | The payment succeeds and the order becomes paid. |
pm_card_chargeDeclined | The attempt ends failed with last_payment_error.code of card_declined. |
pm_card_chargeDeclinedInsufficientFunds | The attempt ends failed with insufficient_funds. |
pm_card_authenticationRequired | The attempt stops at requires_action with a 3D Secure step for the browser to complete. |
pm_card_threeDSecure2Required | The same, using 3D Secure 2. |
Stripe's fixed test aliases such as these have no limit on reuse: send the same one on as many payments in a sandbox as you like. A ConfirmationToken or a pm_ ID your own page creates is different. Each works once.
These aliases from Stripe's testing reference start the dispute, review, block, and fraud warning scenarios without a card number:
| Token | Same card as | What Flint shows |
|---|---|---|
pm_card_createDispute | The payment succeeds, then a dispute opens as fraudulent and waits in needs_response. dispute.created and dispute.needs_response follow the payment. | |
pm_card_createDisputeInquiry | The payment succeeds, then an inquiry opens and waits in inquiry_needs_response. | |
pm_card_riskLevelElevated | 4000 0000 0000 9235 | Flint's default rule opens a payment review and sends payment_review.opened, except on invoice and subscription renewal payments. |
pm_card_riskLevelHighest | 4000 0000 0000 4954 | The same default rule opens a review. If the card processor's fraud screening blocks the payment first, the attempt fails with payment_blocked instead. |
pm_card_radarBlock | 4100 0000 0000 0019 | The card processor always blocks it. The attempt fails with payment_blocked. |
pm_card_createIssuerFraudRecord | 4000 0000 0000 5423 | The payment succeeds, then receives an early fraud warning. Flint creates a fraud warning and sends fraud_warning.created. |
Disputes and fraud warnings come from the card processor after the payment, so they arrive shortly after it rather than in the pay response. Find the fraud warning with GET /v1/fraud-warnings, and read Respond to fraud warnings for its fields. The dispute outcome walkthrough picks up from the dispute.
Create a fresh order as in step 1, with a new Idempotency-Key, then pay it:
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: pay-testing-001" \
-d '{
"action": "pay",
"payment_source": {"credential_type": "token", "token": "pm_card_visa"},
"expected_outstanding_money": {"amount": 2500, "currency": "USD"}
}'
{
"data": {
"order": {
"order_id": "ord_1kmn0aExample",
"status": "closed",
"payment_status": "paid",
"settlement_amounts": {
"paid_money": {"amount": 2500, "currency": "USD"},
"outstanding_money": {"amount": 0, "currency": "USD"}
}
},
"order_payment_attempt": {
"order_payment_attempt_id": "opat_1kmn0aExample",
"status": "succeeded",
"is_resumable": false
}
}
}
Read data.order_payment_attempt, not the HTTP status. A declined token also returns 200, with the attempt failed, the payment intent back at requires_payment_method, and last_payment_error naming the reason. A 3D Secure token returns the attempt at requires_action with pending_actions for the browser; after the challenge, continue it with action: "resume".
expected_outstanding_money is the balance you expect to charge. If the order changed since you read it, the call returns 409 VERSION_CONFLICT instead of charging. It is required when the order has an open checkout session, so pay a fresh order rather than one from the checkout walkthrough. Declines and payment attempts covers every attempt status, a full decline response, and finishing 3D Secure.
The CLI runs the same flow from your terminal, and flint help test-cards prints these tokens offline.
Test refunds#
Refund the payment you made. Send refund_type: "amount" with amount_money to refund part of the order, or refund_type: "full" without an amount to refund what remains. 500 is $5.00.
curl -X POST https://api.withflintpay.com/v1/refunds \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: refund-testing-001" \
-d '{
"refund_type": "amount",
"order_id": "ord_1kmn0aExample",
"amount_money": {"amount": 500, "currency": "USD"},
"reason": "requested_by_customer"
}'
{
"data": {
"refund_id": "ref_1kmn0aExample",
"order_id": "ord_1kmn0aExample",
"status": "pending",
"amount_money": {"amount": 500, "currency": "USD"},
"reason": "requested_by_customer"
}
}
Sandbox refunds run the same lifecycle as live ones. A 201 means Flint recorded the refund. When processing finishes during the request, the response reports succeeded, partially_succeeded, or failed; otherwise it is pending. Follow a pending refund with GET /v1/refunds/{refund_id} or the refund.succeeded, refund.partially_succeeded, and refund.failed events.
Then test the refusals, which create no refund:
- A body without
refund_typereturns400 INVALID_REQUESTwith aREQUIREDdetail. - Refunding an unpaid order returns
409 ACTION_NOT_ALLOWEDwith reasonstatus_not_reached. - Refunding one cent more than what remains returns
409 LIMIT_EXCEEDED.
To test a refund that fails after it succeeded, pay with 4000 0000 0000 5126. The charge succeeds, and a refund of it reaches succeeded, then moves to failed and sends refund.failed. The create response may still be pending, so follow the refund to observe the changes. Refunds covers line-item refunds and the full lifecycle.
Simulate a dispute outcome#
Test how your integration handles a chargeback or inquiry ruling without waiting for a card network. This needs a test-mode credential: a live one gets 403 FORBIDDEN with reason test_mode_required.
A dispute that is already decided or under review, an outcome for the other kind of dispute, and a repeat with a new Idempotency-Key all return 409 ACTION_NOT_ALLOWED. Test dispute outcomes lists each reason. Simulating is separate from POST /v1/disputes/{dispute_id}/accept, which concedes a chargeback as the merchant and leaves it lost.
Test ACH debit#
Bank debits use routing number 110000000 in test mode. Pick the account number for the outcome you need:
| Account number | Outcome |
|---|---|
000123456789 | Succeeds. |
000222222227 | Fails for insufficient funds. |
000111111113 | Fails because the account is closed. |
000111111116 | Fails because no account exists. |
000333333335 | Fails because the debit isn't authorized. |
000555555559 | Succeeds, then the bank returns it, which Flint reports as a dispute with case_type bank_return. |
000000000009 | Stays processing. |
Sandbox bank accounts verify instantly; Flint doesn't offer microdeposit verification. Use 000000000009 to confirm that a processing payment leaves the order unpaid and can't be canceled, and that your integration fulfills only after payment_intent.succeeded or order.paid. ACH debit payments covers collection and returns.
Test risk rules and reviews#
To test your own rules without affecting other sandbox payments, scope each test rule to a payment intent metadata key, such as {"attribute": "payment_intent_metadata.risk_test", "operator": "eq", "value": "block"}. Validate the rule with POST /v1/risk-previews, create it, and check that its status is active with an empty issues array. Then create an order, add a payment intent with that metadata through POST /v1/orders/{order_id}/payment-intents, and pay it with action: "confirm_payment_intents" and a test token. Test your rules shows each request.
What to check:
- A
blockrule. The pay request returns200with the attemptfailed, the payment intent back atrequires_payment_method,last_payment_error.codeofpayment_blocked, andrisk.matched_risk_rule_idnaming your rule.payment_blockedwithrisk: nullisn't a rule result. In checkout, the buyer sees a generic decline and can retry with another payment method on the same session. The buyer never sees the rule or the list. - A
reviewrule with manual capture. Create the leg with"capture_method": "manual", pay it, and wait forpayment_review.opened. Capture returns409 PAYMENT_REVIEW_OPENwhile the review is open. Approving doesn't capture, so capture separately and confirmpayment_intent.succeededarrives. Decline instead, and the authorization is canceled andpayment_review.closedarrives withclosed_reasonofdeclined. - A
reviewrule with automatic capture. The payment succeeds before the review opens. Declining the review refunds it with reasonfraudulentand closes the review asdeclined.
Each attempt keeps the rules and lists in force when it started, so editing a rule afterward doesn't change that attempt's result. When you finish, delete each test rule or PATCH it to {"status": "inactive"}, since an environment can have at most 100 active rules, counting Flint's defaults.
These Stripe test cards exercise Flint's default controls:
| Card number | Risk scenario |
|---|---|
4000 0000 0000 9235 | Elevated risk. Flint's default rule opens a review, except on invoice and subscription renewal payments. |
4100 0000 0000 0019 | Highest risk, blocked by the card processor's fraud screening. The attempt fails with payment_blocked. |
4000 0000 0000 5423 | The payment succeeds, then receives an early fraud warning. |
Risk scoring isn't enabled in every sandbox. GET /v1/risk-rules/attributes reports is_available for risk_score. Where it is false, payment intents omit risk.score, which is not the same as a score of 0, so build test rules on risk_level or pre-authorization attributes instead. Risk controls covers the rule grammar and review actions.
Test package deliveries#
Flint has no carrier integration, so nothing in a sandbox delivers a package on its own. Report delivery the same way as in live mode: send {"action": "mark_delivered"} to POST /v1/packages/{package_id}/transitions. Report carrier progress covers the other package actions.
Test webhook deliveries#
Sandbox webhooks are real deliveries with real signatures, sent to any public HTTPS URL. To receive them on your machine, run flint listen, which forwards sandbox events to localhost without a tunnel, or expose your local server through an HTTPS tunnel and register its URL. To see delivery records before your handler works, register a throwaway URL and inspect the failed attempts it produces.
curl -X POST https://api.withflintpay.com/v1/webhook-endpoints \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: webhook-testing-001" \
-d '{
"url": "https://example.com/webhooks/flint",
"enabled_events": [
"order.paid",
"refund.succeeded",
"subscription.past_due"
]
}'
{
"data": {
"webhook_endpoint_id": "whep_1kmn0aExample",
"url": "https://example.com/webhooks/flint",
"signing_methods": ["jwt"],
"enabled_events": [
"order.paid",
"refund.succeeded",
"subscription.past_due"
],
"api_version": "default",
"event_sources": ["merchant"],
"status": "active"
}
}
data.webhook_endpoint_id is the audience your handler expects in each delivery's JWT. Verify the bearer token and raw request body with Flint's public JWKS, using the same issuer and JWKS URL as live mode.
Send a test event#
A test event carries the example resource for the event type you name, signed like any other delivery, so it exercises your handler without staging the payment behind it. Its resource has placeholder IDs that don't exist in your account.
curl -X POST https://api.withflintpay.com/v1/webhook-endpoints/whep_1kmn0aExample/test-events \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: webhook-test-order-paid-001" \
-d '{"event_type": "order.paid"}'
{
"data": {
"webhook_event_id": "whev_1kmn0aExample",
"webhook_delivery_id": "wdel_1kmn0aExample",
"webhook_delivery_attempt_id": "watt_1kmn0aExample",
"attempt_number": 1,
"attempt_status": "delivered",
"delivery_status": "delivered",
"delivery_trigger": "test_event",
"status_code": 200,
"duration_milliseconds": 326
}
}
The response is the delivery attempt, with the HTTP status your endpoint returned. If your handler rejected it, attempt_status is failed and the response adds error_summary and recommended_action. A test event is delivered once and never retried. Real events retry on a backoff schedule, up to 9 attempts, the last one 71 to 86 hours after the first.
Name a current event_type from GET /v1/webhook-event-types that the endpoint's event_sources can receive. A known type the endpoint can't receive, and an unknown or previous name, return 400 INVALID_REQUEST with detail code INVALID_VALUE. Send a test event lists which types each kind of endpoint can test.
Inspect and resend deliveries#
Read any delivery's attempts by its webhook_delivery_id:
curl https://api.withflintpay.com/v1/webhook-deliveries/wdel_1kmn0aExample/attempts \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": [
{
"webhook_delivery_attempt_id": "watt_1kmn0aExample",
"attempt_number": 1,
"delivery_trigger": "test_event",
"status": "failed",
"status_code": 405,
"error_summary": "The webhook endpoint rejected the delivery.",
"recommended_action": "Inspect the endpoint response body and signature verification logic, then resend after fixing the handler.",
"duration_milliseconds": 63
}
]
}
After fixing your handler, replay the delivery with POST /v1/webhook-deliveries/{webhook_delivery_id}/resend. Real events from the walkthroughs above appear in GET /v1/webhook-events; synthetic test events are included by default. Pass test=false to exclude them or test=true to return only synthetic events. Webhooks covers JWT verification, deduplication on the webhook-id header, and optional HMAC signing, and the Webhooks API reference has every payload.
Test subscriptions and renewals#
A test clock lets you test trials, renewals, and failed payments in minutes instead of weeks. Create a customer on a clock, and every subscription you create for them reads the clock's time instead of real time. When you advance the clock, Flint runs the billing that falls due, in order, with real webhooks and real emails, so each subscription ends up where it would be after the time you skipped.
Test clocks exist only in sandboxes. A subscription whose customer isn't on a clock bills on real schedules; to test one, use a plan with a daily interval so renewals arrive within a day, and cancel the subscription when you're done.
This walkthrough runs a trial to its first charge, then a failed renewal and its retries.
When you finish, cancel the subscription, then archive the clock. Archiving a clock doesn't cancel its subscriptions, and a canceled subscription stops counting toward the clock's limit.
curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/cancel \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"cancel_immediately": true}'
curl -X DELETE https://api.withflintpay.com/v1/test-clocks/tclk_1kmn0aExample \
-H "Authorization: Bearer YOUR_API_KEY"
What follows the clock#
The clock's time applies to the customer on it, their subscriptions, and those subscriptions' payment retries, wherever Flint decides or records a point in the billing lifecycle: trial ends, renewals, notices, retries, scheduled starts, timed pauses, and cancellations at period end. Subscription _at fields follow the clock, except created_at and updated_at, and so do the dates in subscription emails and webhook data.
Everything else runs in real time: created_at and updated_at on every resource, webhook envelope times, request logs, and the resources a clock doesn't bind, such as orders (including renewal orders), payment intents, refunds, disputes, invoices, and payouts. Stripe's own processing, such as charges, 3D Secure, and ACH settlement, also runs in real time, and an advance waits for it. What follows the clock lists each behavior.
Test clock limits and refusals#
Sandbox-only routes#
These routes accept only a test-mode credential:
The test_clock_id field on POST /v1/customers and the test_clock_id filters on customer and subscription lists are sandbox-only too.
Test-mode errors#
These errors come up most in test mode:
The full error envelope and every code are in Error handling.
Before you go live#
Work through this list in your sandbox before you switch to a live key:
- Each card scenario shows the buyer the outcome and lets them retry after a decline or an abandoned 3D Secure challenge.
- Fulfillment runs from an
order.paidwebhook or a backend read, never from the browser redirect alone. - Your webhook handler verifies signatures and deduplicates on the
webhook-idheader (Webhooks). - Retries of the same business action reuse the same
Idempotency-Key, so a network failure can't charge twice or create twice (Idempotency). - You log
request_idfrom API responses, so you can match a failure to Flint's logs with support. - If you bill subscriptions, you've watched a renewal succeed and one fail with the
0341card, and handled both. - You've canceled the subscriptions on your test clocks and archived the clocks.
You don't change code to go live: send a flint_live_... key to the same base URL. Live mode has its own data, so register a production webhook endpoint and re-create any resources your integration refers to by ID. Going live walks through each step.
