Custom gateway routing (merchant-initiated)
Use Recurly's Custom Gateway Routing to direct transactions to a specific payment gateway by passing a gateway_code — for fund segregation, acceptance rate optimization, and subscription routing control.
Custom Gateway Routing lets you direct transactions to a specific payment gateway by passing a
gateway_code in your API requests. Use it to segregate funds, optimize acceptance rates through local processors, and control exactly which gateway handles each transaction or subscription renewal. Not included in Starter or Pro — contact Recurly Sales to upgrade
Prerequisites
- Multiple gateways configured in Recurly for the payment type you want to route (e.g., credit cards).
Limitations
- Card on File Mandates — Depending on the gateway, Card on File mandate data is packaged in different formats. In most cases the raw network transaction ID is accepted and recurring transactions process normally. In rare cases, the data is incompatible and failover will not occur.
- Multiple subscriptions in a single request — When passing
gateway_codefor multiple subscriptions within a single request, routing to different gateways per subscription is not honoured. - Stripe card brand awareness — Card brands for Stripe gateways are configured in the Stripe dashboard, not in Recurly. Recurly is not aware of which card brands your Stripe account supports. If certain card brands aren't supported by Stripe but are by other gateways, specify a
gateway_codeto route those transactions to the correct gateway. Review your Stripe configuration in the merchant portal to confirm your routing setup.
Definition
Custom Gateway Routing is a Recurly feature that lets merchants direct transactions to a specific payment gateway by passing a
gateway_code parameter in API requests. It supports fund segregation, acceptance rate optimization, and granular routing control across subscriptions and one-time transactions.Key benefits
Financial reporting efficiency
Separate funds across specific gateway accounts to simplify financial reporting.
Business-centric routing
Direct transactions based on your specific business logic, giving you control over which gateway handles each payment.
Enhanced acceptance rates
Route transactions through local processors to reduce cross-border failures and improve approval rates.
Recurring transaction management
Update gateway routes for recurring subscriptions at any time to align with renewals and changing business needs.
Key details
Supported transactions and payment methods
Supported transaction types:
- One-time transactions
- Initial subscription transactions (and subsequent recurring transactions)
- Recurring subscription renewals
Supported payment methods:
- Credit cards
- PayPal (excluding PayPal through Braintree)
- Amazon Pay
gateway_code behaviour
- Passing
gateway_codein an API request routes the transaction to the associated gateway. If the code is absent or doesn't match a configured gateway, the transaction routes to the default gateway — with certain mismatches causing a transaction failure. - The
gateway_codepersists for recurring transactions, routing all subsequent subscription renewals to the specified gateway unless updated. - Update the
gateway_codevia a PUT request tov2/subscriptions/:uuid/notesorv3 /subscriptions/{subscription_id}. Clear it with an empty tag to revert to standard routing logic. - Retrieve the
gateway_codefor a subscription via GET requests to/subscriptions. - Modify the
gateway_codeat the invoice level usingv2/invoices/<uuid>orv3 /invoices/<invoice_id>. - Unique Recurly gateway instances are required to route to different gateways — either via a unique Merchant Account ID / MID or by using a different gateway provider entirely.
- If the
gateway_codeis incompatible with the payment method on a transaction, the transaction defaults to the original gateway for that method. - Applying gateway codes to all subscriptions within a single API request is supported.
- For aggregate invoices: if all subscriptions share the same
gateway_code, that gateway is used. If codes differ or are unspecified, the default gateway is used. - The
gateway_codeis visible on the transaction detail page, included in the Transaction Export, and appears in webhooks.
Standard gateway routing
If no gateway_code is passed, Recurly routes the transaction to the Default Gateway if it supports the combination of payment method, card type, and currency. If the Default Gateway doesn't support the transaction, Recurly looks for another configured gateway that matches.
Setup for custom gateway routing
1
2
3
4
5