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

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# Dynamic Routing

> Payrails offers a powerful and flexible feature called **routing** as part of its payment orchestration platform, enabling merchants to intelligently and dynamically configure rules to route payments to different Payment Service Providers (PSPs), fraud providers, and other third-party services.

This page provides an overview of the Routing feature and its practical benefits for merchants using the Payrails platform.

## What is routing?

In the context of payment orchestration, routing refers to the process of directing a payment transaction to the most appropriate PSP or acquiring bank based on various factors such as card type, transaction amount, currency, and country of payment origin and destination. Payrails, as a payment orchestration platform, provides a single technical framework that triggers, directs, and validates all transactions between merchants, customers, and payment providers, covering every step of the payment process from routing through to reconciliation.

## Payrails routing: A configurable solution

The Payrails platform makes it easy for merchants to configure routing rules, allowing them to optimize their payment processing strategy in response to changing market conditions, regulatory requirements, or other factors. By adjusting their routing rules within the Payrails platform, merchants can quickly switch between PSPs or services, ensuring that they always have the best available options for processing their transactions.

<img src="https://mintcdn.com/payrails-42074109/sujy1gNo9mr-Fy-6/images/docs/orchestration/workflow-studio/routing.png?fit=max&auto=format&n=sujy1gNo9mr-Fy-6&q=85&s=319af48acfda73b6cb2811f2495cefe0" alt="Routing" className="mx-auto block rounded-lg object-cover" width="80%" data-path="images/docs/orchestration/workflow-studio/routing.png" />

### Cost optimization

By routing transactions through the most cost-effective PSP or service, merchants can significantly reduce their payment processing fees. Payrails' configurable routing rules enable merchants to take advantage of lower fees or better exchange rates offered by different PSPs for specific currencies or transaction types.

### Fraud prevention

Routing can help merchants minimize their exposure to fraud by directing high-risk transactions to specialized fraud prevention providers or PSPs with advanced fraud detection capabilities. Payrails' dynamic routing feature enables merchants to better protect themselves and their customers from fraudulent activities.

### Improved efficiency

Payrails routing ensures that transactions are processed as quickly and efficiently as possible. By directing transactions to the most appropriate PSP or service based on factors such as transaction volume, processing capacity, or response times, merchants can improve the overall customer experience and reduce the likelihood of transaction failures or delays.

### Enhanced flexibility

The dynamic nature of Payrails routing allows merchants to quickly adapt their payment processing strategy as needed. By leveraging the configurable routing rules within the Payrails platform, merchants can easily switch between PSPs or services, ensuring optimal outcomes for their payment transactions.

<br />

For more details how to configure Routing in your workflow go to [Configure your workflow -> Routing](/docs/overview/routing-configuration) page.


## Related topics

- [Managing Connections](/docs/token-vault/vault-proxy/proxy-connections/managing-connections.md)
- [Test payments](/docs/orchestration/payment-acceptance/test-payments.md)
- [Checkout](/docs/overview/checkout.md)
