Match Fields
Each routing rule can match on multiple criteria:| Field | Type | Description |
|---|---|---|
currency | string | string[] | ISO currency code (e.g., “USD”, “EUR”) |
country | string | string[] | ISO country code (e.g., “US”, “BR”) |
paymentMethod | string | string[] | Payment method type (e.g., “card”, “pix”, “boleto”) |
amountMin | number | Minimum transaction amount in cents |
amountMax | number | Maximum transaction amount in cents |
metadata | Record<string, string> | Exact key/value pairs from request metadata |
default | boolean | Fallback rule (required - at least one) |
Rule Evaluation
The Router evaluates rules sequentially:src/router/router.ts:44
Weighted Selection
If a matching rule has aweight property, the router builds a contiguous weighted group starting at that rule and selects one provider proportionally.
Weighted groups are contiguous. The router stops collecting candidates when it encounters a rule with a different match criteria or no weight.
Per-Request Controls
You can override routing behavior for individual requests:Force Specific Provider
Force Provider
Exclude Providers
Exclude Providers
Provider Capability Validation
The router automatically validates that the selected provider supports the request:src/router/router.ts:109
Complete Example
Multi-Provider Routing
Routing Decision Details
Every payment result includes routing information:- source: Whether the decision came from local rules or platform API
- reason: Human-readable explanation of why this provider was selected
Next Steps
Architecture
Understand the routing component
Error Handling
Handle routing errors