Skip to content

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.

Note:

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 testUse
Success, declines, and 3D Secure in checkoutTest cards in a hosted checkout
The same outcomes from a test suiteTest tokens on POST /v1/orders/{order_id}/pay
A payment on a reader or Tap to Pay phoneA simulated reader, a physical test card, and the Terminal SDK's simulator
Refunds, including one that fails after it succeededRefund requests and a refund-failure card
Chargebacks and inquiriesDispute test cards and a simulated ruling
Bank debit outcomesACH test account numbers
Your risk rules and payment reviewsMetadata-scoped rules and risk test cards
Delivery trackingA package transition
Your webhook handlerTest events, then real events
Trials, renewals, and failed-payment retriesA 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:

<!-- docs-test {"scenario":"merchant","status":200} -->

cURL
curl https://api.withflintpay.com/v1/merchant \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "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 (4 digits for American Express cards), and any ZIP code, such as 44444, work with all of them.

  • Success
    Payment succeeds immediately; the order becomes paid.
  • Requires authentication
    A 3D Secure challenge opens; complete it and the payment succeeds.
  • 3D Secure challenge
    Same challenge flow; complete it to succeed, fail it to decline.
  • Decline: insufficient funds
    Checkout shows a payment-failed message; the order stays open.
  • Decline: generic
    Same, simulating a generic issuer decline.
  • Decline: expired card
    Same, simulating an expired card.
  • Decline: incorrect CVC
    Same, simulating a bad security code.
  • Decline: processing error
    Same, simulating a processor-side failure.
  • Saves, then fails
    Attaches to a customer, but every charge fails. Use it to rehearse renewal failures and dunning.
  • Dispute: fraudulent
    Payment succeeds, then is disputed as fraudulent and waits in `needs_response`.
  • Dispute: inquiry
    Payment succeeds, then is disputed as an inquiry and waits in `inquiry_needs_response`.

Every card in Test card numbers also works in test mode.

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. Moving from another processor? Its page lists its test cards beside the Flint card for each scenario: Adyen, PayPal, Braintree, Authorize.net, Square, Checkout.com, Worldpay, Cybersource, and NMI.

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.

  1. Create an order#

    Amounts are integers in the currency's minor unit, so 2500 is $25.00. The line item is defined on the order itself, needs no shipping, and has tax turned off, so the total stays $25.00. The Orders API reference describes each field.

    <!-- docs-test {"scenario":"main","status":201} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/orders \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: order-testing-001" \
      -d '{
        "line_items": [{
          "type": "custom",
          "name": "Test tote bag",
          "quantity": 1,
          "unit_price_money": {"amount": 2500, "currency": "USD"},
          "fulfillment": {"requirement": "none"}
        }],
        "tax": {"enabled": false}
      }'
    
    Response
    {
      "data": {
        "order_id": "ord_1kmn0aExample",
        "status": "open",
        "payment_status": "unpaid",
        "pricing_amounts": {
          "total_money": {"amount": 2500, "currency": "USD"}
        },
        "settlement_amounts": {
          "paid_money": {"amount": 0, "currency": "USD"},
          "outstanding_money": {"amount": 2500, "currency": "USD"}
        }
      }
    }
    

    Each Idempotency-Key returns the same order on a repeat. To run the walkthrough again with a new order, change the keys, for example from 001 to 002.

  2. Create a checkout session#

    A checkout session is one hosted payment page for one order. It collects the order's outstanding balance, so you don't send the amount again. tip.enabled: false turns the tip prompt off so the total stays $25.00.

    <!-- docs-test {"scenario":"hosted","status":201,"fixtures":{"order":2500}} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/checkout-sessions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: checkout-testing-001" \
      -d '{
        "type": "order",
        "order_id": "ord_1kmn0aExample",
        "tip": {"enabled": false},
        "redirects": {
          "success_url": "https://example.com/thanks",
          "cancel_url": "https://example.com/checkout"
        }
      }'
    
    Response
    {
      "data": {
        "checkout_session_id": "cs_1kmn0aExample",
        "status": "open",
        "surface": "hosted",
        "order_id": "ord_1kmn0aExample",
        "expires_at": "2026-11-05T17:04:05Z",
        "url": "https://checkout.withflintpay.com/checkout/cs_1kmn0aExample#checkout_token=..."
      }
    }
    
  3. Pay with the card for your scenario#

    Warning:

    If your sandbox can't take card payments yet, hosted checkout says "No payment methods are available for this checkout." instead of showing a card form. Check readiness.payments on GET /v1/merchant, and reload checkout once it reports ready.

    Open data.url in a browser exactly as returned: it carries the one-time credential that admits the buyer. Checkout shows the test-mode banner and a $25.00 total. Fill in the buyer details it asks for and pay with , any future expiry date, and any CVC. The payment succeeds and checkout redirects to your redirects.success_url with checkout_session_id and order_id added as query parameters.

  4. Verify the outcome#

    Confirm the result from your backend rather than trusting the browser redirect:

    <!-- docs-test {"scenario":"paid-order","status":200,"fixtures":{"order":2500,"checkout":true,"paidOrder":true}} -->

    cURL
    curl https://api.withflintpay.com/v1/orders/ord_1kmn0aExample \
      -H "Authorization: Bearer YOUR_API_KEY"
    
    Response
    {
      "data": {
        "order_id": "ord_1kmn0aExample",
        "status": "closed",
        "payment_status": "paid",
        "settlement_amounts": {
          "paid_money": {"amount": 2500, "currency": "USD"},
          "refunded_money": {"amount": 0, "currency": "USD"},
          "outstanding_money": {"amount": 0, "currency": "USD"}
        },
        "checkout_session_ids": ["cs_1kmn0aExample"]
      }
    }
    

    payment_status: "paid" with outstanding_money.amount at 0 means the payment landed. An order can also close without payment, so check payment_status rather than status. If you registered a webhook endpoint, it also received order.paid.

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.

What a returned payment looks like#

When Flint can't accept a payment after it was sent, for example because it was completed with a payment method other than the one Flint approved, the payment intent ends canceled and the order stays unpaid. When Flint returns money for it, the payment intent has cancellation_reason: "payment_returned", the order's payment attempt fails with status_reason: "payment_returned", and collected money shows in captured_money while a refund with initiated_by: "flint" and reason: "payment_returned" returns it, so GET /v1/refunds?reason=payment_returned finds it. Until Flint knows of money to return, both show payment_blocked instead, and they move to payment_returned if money turns up. No test card produces this on purpose. Handle it by branching on cancellation_reason and status_reason, and treat a canceled payment intent with payment_blocked as one that can still change.

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.stripe.payment_method:

TokenResult
pm_card_visaThe payment succeeds and the order becomes paid.
pm_card_chargeDeclinedThe attempt ends failed with last_payment_error.code of card_declined.
pm_card_chargeDeclinedInsufficientFundsThe attempt ends failed with insufficient_funds.
pm_card_authenticationRequiredThe attempt stops at requires_action with a 3D Secure step for the browser to complete.
pm_card_threeDSecure2RequiredThe same, using 3D Secure 2.

For physical goods that require delivery, create a checkout session for the order with POST /v1/checkout-sessions, request a delivery quote with POST /v1/delivery-quotes using its checkout_session_id, and select one option per group with POST /v1/delivery-selections using delivery_quote_id and choices before paying. Without a selection, payment returns 409 ACTION_NOT_ALLOWED with delivery recovery steps. Use a service product when your test does not cover delivery.

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:

TokenSame card asWhat Flint shows
pm_card_createDisputeThe payment succeeds, then a dispute opens as fraudulent and waits in needs_response. dispute.created and dispute.needs_response follow the payment.
pm_card_createDisputeInquiryThe payment succeeds, then an inquiry opens and waits in inquiry_needs_response.
pm_card_riskLevelElevated4000 0000 0000 9235Flint's default rule opens a payment review and sends payment_review.opened, except on invoice and subscription renewal payments.
pm_card_riskLevelHighest4000 0000 0000 4954The 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_radarBlock4100 0000 0000 0019The card processor always blocks it. The attempt fails with payment_blocked.
pm_card_createIssuerFraudRecord4000 0000 0000 5423The 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:

<!-- docs-test {"scenario":"main","status":200} -->

cURL
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": "stripe_payment_method",
    "stripe": {
      "payment_method": "pm_card_visa"
    }
  },
  "expected_outstanding_money": {
    "amount": 2500,
    "currency": "USD"
  }
}'
Response
{
  "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. By default, open each action's client_action.url in a redirect, popup, or iframe; after the challenge, continue it with action: "resume". Test the explicit client_action_type: "stripe" path too if your integration uses Stripe.js.

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 card-present payments#

The test cards above are for card-not-present payments. A payment taken on a reader has three ways to test, none of which needs a real card:

  • A simulated reader. Register a reader with registration_code: "simulated-s700". Send a payment to it with a reader payment source, then call POST /v1/readers/{reader_id}/simulate with an outcome of approved, declined, or insufficient_funds, an optional card_brand, and a tip_money when the payment was sent with the tip screen on. Use a payment amount ending in .00 to test the requested outcome. Amounts ending in .01, .05, .55, .65, or .75 can trigger a decline even with outcome: "approved". The result arrives the way a real tap's does, so your webhook handling gets tested too.
  • A physical S710 or S700 and Stripe's physical test card. A real reader pairs in a sandbox. The cents of the amount choose the result: .00 approves, .01 declines with call_issuer, .02 and .03 ask for a PIN, .05 declines, .55 is an incorrect PIN, .65 is over the withdrawal limit, and .75 is too many PIN tries.
  • Tap to Pay. Use the Terminal SDK's simulated reader with a sandbox connection session, and pick the test card in the SDK's simulator configuration.

Phone wallets such as Apple Pay and Google Pay can't be tested in a sandbox. simulate and a simulated reader refuse a live credential. In-person payments has the requests.

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.

<!-- docs-test {"scenario":"main","status":201,"oneOf":{"data.status":["pending","succeeded","partially_succeeded","failed"]}} -->

cURL
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"
  }'
Response
{
  "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_type returns 400 INVALID_REQUEST with a REQUIRED detail.
  • Refunding an unpaid order returns 409 ACTION_NOT_ALLOWED with reason status_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.

  1. Create a test dispute#

    Pay with . The payment succeeds, then is disputed as fraudulent and waits in needs_response. For an inquiry, pay with , which waits in inquiry_needs_response. Listen for dispute.created and dispute.needs_response, or find the dispute with GET /v1/disputes?is_action_required=true.

  2. Simulate the ruling#

    Call POST /v1/disputes/{dispute_id}/simulate with the outcome you want: won or lost for a chargeback, inquiry_closed or escalated for an inquiry. The key needs payments.disputes.write. The Idempotency-Key is optional, and it lets you retry safely.

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/disputes/du_1kmn0aExample/simulate \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: simulate-dispute-001" \
      -d '{"outcome": "won"}'
    

    Simulating submits any saved draft and replaces its additional notes with Stripe's test value for the chosen outcome. The 200 response is the dispute right after that submission, normally under_review or inquiry_under_review with evidence_submission_count of 1.

  3. Watch the events#

    Stripe decides the dispute, and the ruling reaches you through webhook events, as a real one would. Flint never sets the outcome itself, and the ruling has no fixed timing.

    • won: dispute.updated, then dispute.won.
    • lost: dispute.updated, then dispute.lost.
    • inquiry_closed: dispute.updated, then dispute.inquiry_closed.
    • escalated: dispute.needs_response, sometimes after a dispute.updated, because the inquiry becomes a chargeback that needs a response.

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 numberOutcome
000123456789Succeeds.
000222222227Fails for insufficient funds.
000111111113Fails because the account is closed.
000111111116Fails because no account exists.
000333333335Fails because the debit isn't authorized.
000555555559Succeeds, then the bank returns it, which Flint reports as a dispute with case_type bank_return.
000000000009Stays 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/payment-intents, and pay it with action: "confirm_payment_intents" and a test token. Test your rules shows each request.

What to check:

  • A block rule. The pay request returns 200 with the attempt failed, the payment intent back at requires_payment_method, last_payment_error.code of payment_blocked, and risk.matched_risk_rule_id naming your rule. payment_blocked with risk: null isn'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 review rule with manual capture. Create the leg with "capture_method": "manual", pay it, and wait for payment_review.opened. Capture returns 409 PAYMENT_REVIEW_OPEN while the review is open. Approving doesn't capture, so capture separately and confirm payment_intent.succeeded arrives. Decline instead, and the authorization is canceled and payment_review.closed arrives with closed_reason of declined.
  • A review rule with automatic capture. The payment succeeds before the review opens. Declining the review refunds it with reason fraudulent and closes the review as declined.

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 numberRisk scenario
4000 0000 0000 9235Elevated risk. Flint's default rule opens a review, except on invoice and subscription renewal payments.
4100 0000 0000 0019Highest risk, blocked by the card processor's fraud screening. The attempt fails with payment_blocked.
4000 0000 0000 5423The 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 {} to POST /v1/packages/{package_id}/mark-delivered. 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, signed as JWTs like production deliveries (set the endpoint ID it prints as FLINT_WEBHOOK_ENDPOINT_ID), 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.

<!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

cURL
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"
    ]
  }'
Response
{
  "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.

<!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

cURL
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"}'
Response
{
  "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:

<!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

cURL
curl https://api.withflintpay.com/v1/webhook-deliveries/wdel_1kmn0aExample/attempts \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "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.

  1. Create a trial plan and a test clock#

    Create a monthly plan with a 14-day trial. Subscription billing describes each plan field.

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/subscription-plans \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: plan-testing-001" \
      -d '{
        "name": "Test Monthly Plan",
        "billing_interval": "monthly",
        "billing_interval_count": 1,
        "currency": "USD",
        "trial_period_days": 14,
        "line_items": [{
          "type": "custom",
          "name": "Test subscription item",
          "quantity": 1,
          "unit_price_money": {"amount": 2900, "currency": "USD"}
        }]
      }'
    
    Response
    {
      "data": {
        "subscription_plan_id": "plan_1kmn0aExample",
        "name": "Test Monthly Plan",
        "status": "active",
        "billing_interval": "monthly",
        "trial_period_days": 14
      }
    }
    

    Then create the clock. frozen_at is the time the clock shows. It defaults to now and can be up to five years ahead, so a fixed future time keeps the dates below predictable.

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/test-clocks \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: clock-testing-001" \
      -d '{"frozen_at": "2030-01-01T00:00:00Z", "name": "Trial and renewal"}'
    
    Response
    {
      "data": {
        "test_clock_id": "tclk_1kmn0aExample",
        "name": "Trial and renewal",
        "status": "ready",
        "frozen_at": "2030-01-01T00:00:00Z",
        "version": 1
      }
    }
    
  2. Create a customer on the clock#

    Send test_clock_id when you create the customer. A customer can't move to another clock or come off one later. Buyer emails in a sandbox go to real addresses, with [Test] in the subject and a banner saying no money moved. Each sandbox can send buyer email to 100 distinct non-team recipients per UTC day across To and CC addresses. Repeat emails to the same address count once, ignoring letter case. After the limit, email can still go to team addresses and recipients already used that day; use your own team address to test without this limit. A team address is your merchant email, support email, or an active team member's email; matching ignores letter case.

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/customers \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: customer-clock-001" \
      -d '{
        "name": "Ada Lovelace",
        "email": "ada@example.com",
        "test_clock_id": "tclk_1kmn0aExample"
      }'
    
    Response
    {
      "data": {
        "customer_id": "cus_1kmn0aExample",
        "name": "Ada Lovelace",
        "email": "ada@example.com",
        "test_clock_id": "tclk_1kmn0aExample"
      }
    }
    
  3. Save a card#

    Save a card for the customer as in steps 3 and 4 of Subscription billing, using , and wait until the payment method is active. Card setup runs at Stripe in real time, so the clock doesn't affect it.

    From a terminal. To save the card without a browser, such as in CI, an agent, or a backend test, pay a small standalone payment intent with a test token and ask Flint to keep the card. Your API key needs payments.payment_intents.write and payments.payment_methods.write. Each request below runs in the sandbox, so the payment moves no real money.

    1. Create a payment intent for the customer. The customer_id is the customer Flint saves the card for, and the amount is what the next request charges:

      <!-- docs-test {"scenario":"save","status":201,"fixtures":{"customer":true},"expect":{"data.status":"requires_payment_method"}} -->

      cURL
      curl -X POST https://api.withflintpay.com/v1/payment-intents \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Idempotency-Key: pi-save-card-001" \
        -d '{
          "amount_money": {"amount": 100, "currency": "USD"},
          "payment_options": ["card"],
          "customer_id": "cus_1kmn0aExample"
        }'
      

      Save data.payment_intent_id. The payment intent starts at requires_payment_method.

    2. Confirm it with pm_card_visa and save_payment_method: true:

      <!-- docs-test {"scenario":"save","status":200,"expect":{"data.status":"succeeded"}} -->

      cURL
      curl -X POST https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample/confirm \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Idempotency-Key: confirm-pi-save-card-001" \
        -d '{
          "save_payment_method": true,
          "payment_source": {
            "credential_type": "stripe_payment_method",
            "stripe": {
              "payment_method": "pm_card_visa"
            }
          }
        }'
      

      The confirm charges the payment intent's amount. Check that data.status is succeeded. 403 INSUFFICIENT_SCOPE means the key lacks payments.payment_methods.write, and 409 ACTION_NOT_ALLOWED with reason configuration_required means the payment intent has no customer_id.

    3. Read the saved card's ID. Flint saves the card after the payment is approved, which is after the confirm response. Either wait for the payment_method.activated webhook, or read the payment intent until payment_source.card.payment_method_id appears:

      <!-- docs-test {"scenario":"save","status":200,"waitFor":"data.payment_source.card.payment_method_id"} -->

      cURL
      curl https://api.withflintpay.com/v1/payment-intents/pi_1kmn0aExample \
        -H "Authorization: Bearer YOUR_API_KEY"
      
      Response
      {
        "data": {
          "payment_intent_id": "pi_1kmn0aExample",
          "customer_id": "cus_1kmn0aExample",
          "status": "succeeded",
          "payment_source": {
            "type": "card",
            "card": {
              "brand": "visa",
              "last4": "4242",
              "payment_method_id": "pm_1kmn0aExample"
            }
          }
        }
      }
      

    The card is saved on the customer as active and off_session, so you can use payment_method_id to create the subscription in the next step. Stripe's test aliases have no limit on reuse, so you can save pm_card_visa for as many customers in a sandbox as you like. To save while paying an order instead, set customer_id on the order and send save_payment_method: true with pm_card_visa as payment_source.stripe.payment_method (credential_type: "stripe_payment_method") on POST /v1/orders/{order_id}/pay; Save a card while the customer pays has the request.

    This path charges the card, so it can't save a card that declines. A declined payment saves nothing, which means the failing-renewal card in Fail a renewal and walk the retries still needs the browser steps above. Save the card for later charges covers the consent wording, errors, and webhook in full.

  4. Create a trial subscription#

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/subscriptions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: sub-clock-001" \
      -d '{
        "terms": {
          "type": "subscription_plan",
          "subscription_plan_id": "plan_1kmn0aExample"
        },
        "customer_id": "cus_1kmn0aExample",
        "payment_method_id": "pm_1kmn0aExample",
        "billing_start": {"type": "immediate"},
        "billing_schedule": {"owner": "flint"}
      }'
    
    Response
    {
      "data": {
        "subscription_id": "sub_1kmn0aExample",
        "test_clock_id": "tclk_1kmn0aExample",
        "status": "trialing",
        "trial_end_at": "2030-01-15T00:00:00Z",
        "next_billing_at": "2030-01-15T00:00:00Z"
      }
    }
    

    The response is shortened to the fields this walkthrough reads. The trial ends at the clock's time plus the plan's trial length, and the subscription carries the clock's ID as test_clock_id. Its created_at is real time.

    POST /v1/subscriptions/{subscription_id}/renew judges the trial by the clock's time too, so calling it now returns 409 ACTION_NOT_ALLOWED with details[0].reason of trial_in_progress. To end a trial in a sandbox, advance the clock past trial_end_at.

  5. Advance to the end of the trial#

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/test-clocks/tclk_1kmn0aExample/advance \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: advance-trial-end-001" \
      -d '{"frozen_at": "2030-01-15T00:00:00Z"}'
    
    Response
    {
      "data": {
        "test_clock_id": "tclk_1kmn0aExample",
        "status": "advancing",
        "frozen_at": "2030-01-15T00:00:00Z",
        "version": 2
      }
    }
    

    The 202 response means Flint accepted the advance, not that it finished. Wait for the test_clock.ready webhook, which Flint records after every event the advance caused, or poll GET /v1/test-clocks/{test_clock_id} until status is ready or failed. Don't write to the clock's subscriptions while it is advancing; see Test clock limits and refusals.

    The events to look for, sent at the clock's time:

    Once the clock is ready, read the subscription. It is active, completed_cycles is 1, current_period_start_at is the old trial_end_at, and next_billing_at is one month later, 2030-02-15T00:00:00Z.

  6. Fail a renewal and walk the retries#

    Save a second card for the same customer with . It attaches, then every charge on it fails. Point the subscription at it:

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X PATCH https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: sub-failing-card-001" \
      -d '{"payment_method_id": "pm_1kmn0bExample"}'
    

    Advance the clock to next_billing_at, 2030-02-15T00:00:00Z, and wait for ready. The renewal charge fails: the subscription is past_due, you receive subscription.past_due, missed_billing_at is the failed billing date, and next_retry_at is one day later in clock time, 2030-02-16T00:00:00Z.

    Advance to next_retry_at and wait for ready again. The first retry runs and fails, and next_retry_at moves to the next retry in the retry schedule. Keep advancing to each next_retry_at to reach subscription.dunning_exhausted and the end action you configured.

    To test recovery instead, PATCH the subscription back to the 4242 card and start a retry:

    <!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

    cURL
    curl -X POST https://api.withflintpay.com/v1/subscriptions/sub_1kmn0aExample/payment-retries \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Idempotency-Key: sub-retry-001" \
      -d '{}'
    

    A successful retry returns the subscription to active and sends subscription.payment_succeeded.

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.

<!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

cURL
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}'

<!-- docs-test {"skip":"Outside one-time payment examples: disputes, webhooks, subscriptions and test-clock orchestration have separate QA suites."} -->

cURL
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#

  • HTTP 409
    Reason test_clock_subscriptions, with param customer_id: the clock already holds 10 subscriptions that aren't canceled. Create the subscription for a customer on another clock, or cancel one on this clock. A subscription that a paid checkout creates for a customer on a clock is never refused; it counts toward the limit and joins an advance in progress.
  • HTTP 409

    Branch on details[0].reason:

    • advance_limit_exceeded: the advance goes past maximum_frozen_at, which the error carries. One advance can reach the earlier of two years after the current frozen_at and two billing intervals of each subscription on the clock that isn't canceled. Advance to the limit, wait for ready, then advance again.
    • frozen_at_not_later: the new frozen_at isn't after the current one. Clocks only move forward.
    • in_progress, with resource_type test_clock and current_status advancing: you wrote to a subscription on an advancing clock, from your API key or the customer's account, created a customer or subscription on it, or advanced it again. Wait for test_clock.ready and retry. Writes to subscriptions on failed and archived clocks are allowed, so you can still cancel.
    • terminal_status or archived: you created a customer or subscription on a failed or archived clock, or advanced one. Create a new clock.
  • HTTP 403
    Reason test_mode_required: a live credential sent test_clock_id or called a test clock route. Use a test key.

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:

  • HTTP 401
    details[0].reason is mode_mismatch when your test key isn't bound to a sandbox: use a dashboard-issued key or mint one in a sandbox, as the sandbox-bound key requirement describes. It is revoked when the key's sandbox was archived: issue a new key in an active sandbox. A reset keeps the sandbox's keys working.
  • HTTP 404
    The resource exists in the other mode or another sandbox. Test and live data never mix, so use a key for the mode and sandbox that created it.
  • HTTP 403
    Reason test_mode_required: a live key called a sandbox-only route or sent test_clock_id. Flint checks the mode before scopes. Send the request with a test key bound to the sandbox you're testing in.

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.paid webhook or a backend read, never from the browser redirect alone, and checks the order's dispute_status first.
  • Your webhook handler verifies signatures and deduplicates on the webhook-id header (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_id from 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 0341 card, 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.

Next steps#

Test card lookupEvery Stripe test card that works on Flint, beside the other major processors.Sandboxes & test modeWhere test data lives, resetting, and a clean sandbox for each CI run.Declines and payment attemptsThe recovery model for declines, 3D Secure, and lost responses.Going liveVerify the business, create a live key, and confirm with one real payment.

Was this helpful?