> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowlix.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing

> Test cards and scenarios for building your integration in test mode

Use your test secret key (`api_test_sk_...`) to exercise the full payment flow
without moving real money. Test mode behaves exactly like live mode — same
endpoints, same objects, same statuses — but cards are simulated.

<Note>
  Objects created in test mode are invisible to live keys and vice versa.
  Check the `livemode` flag on any object if in doubt.
</Note>

## Test cards

Use these card numbers with **any future expiry date**, **any 3- or 4-digit
CVC**, and **any cardholder name**:

| Number                | Scenario                                                                    |
| --------------------- | --------------------------------------------------------------------------- |
| `4111 1111 1111 1111` | Visa — payment succeeds.                                                    |
| `5555 5555 5555 4444` | Mastercard — payment succeeds.                                              |
| `4000 0000 0000 9995` | Declined with `insufficient_funds`.                                         |
| `4000 0000 0000 0002` | Declined with `generic_decline`.                                            |
| `4000 0000 0000 0069` | Declined with `expired_card`.                                               |
| `4000 0000 0000 3220` | Requires 3D Secure; challenge succeeds.                                     |
| `4000 0000 0000 3063` | Requires 3D Secure; customer fails the challenge → `three_d_secure_failed`. |

On the hosted payment page in test mode, the 3D Secure challenge is replaced
by a simulator page where you choose **Complete** or **Fail**.

## Scenarios to cover before going live

<Steps>
  <Step title="Happy path">
    Create a payment, complete it, verify you observe `SUCCEEDED` via polling
    and via the `payment.succeeded` webhook.
  </Step>

  <Step title="Failures">
    Trigger at least `insufficient_funds` and `generic_decline`; confirm your
    checkout shows a sensible message and lets the customer retry with a
    different card. See [Operation failure codes](/guides/operation-failures).
  </Step>

  <Step title="3D Secure">
    Complete and fail a challenge; verify both outcomes, including the
    redirect back to your `return_url`.
  </Step>

  <Step title="Abandonment">
    Create a hosted payment and never complete it; verify your system handles
    `EXPIRED` (and doesn't strand the order).
  </Step>

  <Step title="Retries and duplicates">
    Send the same create request twice with the same `Idempotency-Key` and
    confirm only one payment exists. Send it with a changed body and confirm
    you get `409` with `error.code: "idempotency_key_reused"`. See
    [Idempotency](/guides/idempotency).
  </Step>

  <Step title="Refunds">
    Refund a test payment partially, then fully; verify `amount_refunded`,
    `amount_refundable`, and refund webhooks.
  </Step>

  <Step title="Webhook failures">
    Make your endpoint return 500 once and verify the delivery is retried.
    Verify your signature check rejects a tampered payload.
  </Step>
</Steps>

## Going live

1. Complete the checklist above in test mode.
2. Swap `api_test_sk_...` for `api_live_sk_...` in your server configuration —
   nothing else changes.
3. Configure live-mode webhook endpoints (test and live endpoints are
   separate).
4. Make a small real payment and refund it to verify the live configuration
   end to end.
