Skip to main content

Multi-PSP Routing & Vault

Time: ~10 minutes | Difficulty: Intermediate

The Problem

You’re locked into one payment processor. If it declines, you lose the sale:
With TagadaPay, you connect all your processors and route intelligently:
Card data is vaulted once. Transactions flow to the best processor automatically. If one declines, the next one picks up — zero extra code on your side.
TagadaPay sits above every PSP. It’s not a Stripe plugin or a Checkout.com add-on. You connect any combination of Stripe, NMI, Checkout.com, Airwallex, Adyen, and more — then define routing rules. Each processor is just a connection with API keys.

How It Works

Three concepts to understand:

Step 1: Connect Your Processors

Add each processor in the TagadaPay dashboard → Settings → Processors, or connect them via the SDK: After connecting, list them via the SDK to get their IDs:
You can connect unlimited processor accounts — even multiple Stripe accounts (US, EU, etc.). TagadaPay is fully gateway-agnostic.

Step 2: Create a Payment Flow

A payment flow defines how transactions are routed across your 4 processors:
Here’s what each field does:
Yes, a processor can appear in both lists. Stripe is the primary at 40% and the 2nd fallback. If Checkout.com or Airwallex declines, NMI tries first, then Stripe retries — sometimes a retry on the same PSP with a fresh attempt succeeds.

Step 3: Vault a Card (Tokenize Once)

Card data is tokenized client-side via @tagadapay/core-js. The raw card number never reaches your server.
Then, server-side, create a reusable payment instrument:
One vault, all processors. The payment instrument is PSP-agnostic. TagadaPay translates it to the right format for whichever processor the flow selects — Stripe, NMI, Checkout.com, Airwallex, or any other. You tokenize once, charge anywhere.

Step 4: Charge — TagadaPay Routes Automatically

What happened under the hood:
  1. TagadaPay’s weighted algorithm picked Checkout.com (30% weight, this time)
  2. If Checkout.com declined → automatically retried on NMI (fallback #1)
  3. If NMI also declined → retried on Stripe (fallback #2)
  4. The winning processor is recorded in payment.processorId
You wrote zero retry logic. Zero PSP-specific code. One API call for 4 processors.

Routing Strategies Explained

Weighted Distribution

Split traffic by percentage. Great for load balancing or gradually migrating to a new processor.

Lowest Capacity

Sends traffic to whichever processor has processed the fewest transactions today. Auto-balances across all 4 PSPs.

Automatic (Round Robin)

Equal distribution — each processor gets roughly the same number of transactions.

Sticky Processor

When enabled, a returning customer is always routed to the processor that last succeeded for them. Reduces declines on stored-credential transactions.

Multiple Flows for Different Scenarios

You can create different flows for different situations. Example: a standard flow and a high-value flow using different processor mixes:
You can also override per funnel step — see the Step Config Guide.

Recurring Charges (MIT)

For subscriptions and server-initiated charges, use initiatedBy: 'merchant'. The vaulted instrument works the same way — TagadaPay handles the stored-credential handshake with each PSP.
No customer present, no 3DS challenge, same routing intelligence.

Comparison: Single PSP vs TagadaPay


Full Example: 4 PSPs, End to End


Stripe Connect via API

If your merchants use Stripe, you can programmatically connect their Stripe accounts via OAuth instead of manually entering API keys.

How It Works

Step-by-Step

1. Create a Stripe processor (placeholder)
2. Initiate the OAuth flow
TagadaPay handles the OAuth callback automatically — no URL configuration needed. You can optionally pass redirectUrl to control where the merchant lands after authorizing:
3. After the merchant authorizes, TagadaPay automatically:
  • Exchanges the authorization code for access tokens
  • Saves the connected Stripe account ID and credentials on the processor
  • Enables the processor
  • Redirects the merchant to your redirectUrl (or the default processors page)
4. Verify the connection

Disconnect a Stripe Account

When to use Stripe Connect vs direct API keys?
  • Use Stripe Connect when you’re a platform onboarding merchants who have their own Stripe accounts
  • Use direct API keys when you own the Stripe account and just need to plug it in

Next Steps

Subscriptions & Rebilling

Trials, auto-retry, manual rebill, processor migration for recurring billing

Node SDK Quick Start

Full SDK setup with stores, products, and funnels

Headless Payments (Frontend)

Build your own checkout UI with client-side card tokenization and 3DS

Scripts & Pixels per Step

Add tracking pixels and custom scripts to funnel steps