This walkthrough takes you from a fresh account to a test payment that exercises smart routing and failover. Everything here runs in test mode — no live card is ever charged.
1

Create your account and connect gateways

Sign up at the dashboard, verify your email, and connect at least two gateway accounts (Stripe and Adyen) under Connections. Each connection is verified with a live test call before it can be routed to.See Connecting gateways for the credential details each gateway needs.
2

Set your routing rules

Under Rules, order your gateways by priority and choose which failures trigger failover (hard declines, timeouts, gateway errors). Save to activate. The default configuration — priority 1 with failover to priority 2 on all retryable failures — is right for most merchants.See Routing rules.
3

Generate your Integration Kit keys

Under Integration Kit, generate your test keys. You receive three credentials:
KeyPrefixUsed for
Publishable keysf_test_pk_Widget initialization in the browser — safe to expose
Secret keysf_test_sk_Server-to-server API calls — keep on your backend
Webhook signing secretsf_test_whsec_Verifying webhook signatures
The secret key and webhook signing secret are shown once. Store them in your secret manager now — regenerating revokes the old keys immediately.
4

Create a payment session from your backend

This is the only server-side call you make per checkout:
curl https://api.switchflows.net/api/v1/payment-sessions \
  -X POST \
  -H "Authorization: Bearer $SWITCHFLOW_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "amountMinor": 4900,
    "currency": "USD",
    "orderRef": "ORDER-10023",
    "customerEmail": "buyer@example.com"
  }'
The response contains a sessionId, a clientSecret, and a vault block — pass all of them to the widget in the next step. Full contract: Create a payment session.
5

Embed the checkout widget

Render the widget on your checkout page with the session you just created:
<script src="https://js.switchflows.net/v1/switchflow.js"></script>
<div id="switchflow-checkout"></div>
<script>
  SwitchFlow.mount({
    container: '#switchflow-checkout',
    apiBase: 'https://api.switchflows.net',
    sessionId: session.sessionId,        // from your backend
    clientSecret: session.clientSecret,  // from your backend
    vault: session.vault,                // from your backend
    onSuccess: (result) => {
      // result.capturedVia: 'STRIPE' | 'ADYEN'
      // result.failoverUsed: boolean
      window.location.href = '/order/complete';
    },
    onDeclined: (result) => {
      showError('Payment declined (' + result.declineCode + ')');
    }
  });
</script>
The widget collects the card, tokenizes it directly to the vault, submits the payment, and holds a single loading state while routing and failover run. See Embedding the widget.
6

Register your webhook endpoint

Under Integration Kit → Webhooks, register your endpoint URL and click Verify — SwitchFlow sends a signed test event and expects a 2xx. Then implement signature verification with your sf_test_whsec_ secret: Verifying signatures.
7

Run the test-card matrix

Pay with these cards on your checkout to see routing in action:
CardBehavior
4242 4242 4242 4242Approves on your priority-1 gateway
4000 1000 0000 0000Declines on priority 1 → transparent failover to priority 2
4000 0000 0000 9979Fraud-class decline — never retried, by design
Check the Analytics page: the failover payment appears with failover: true and a two-attempt trail. The full matrix is in Test cards.
When the matrix behaves as expected end to end, you’re ready for the go-live checklist.