Every B2B platform hits the same wall when expanding internationally: the payout infrastructure that worked for domestic transfers breaks down the moment money needs to cross a border. SWIFT wires are slow, expensive, and opaque. Manual bank processes don't scale. And building direct relationships with local payment networks in dozens of countries requires years of licensing and integration work. A cross-border payments API integration solves this by abstracting the complexity of international money movement into a single interface — routing payouts through local rails, handling FX conversion, and managing compliance in every corridor.
This guide is for developers and engineering leads at fintechs, marketplaces, payroll platforms, and neobanks who are ready to build. It covers the payout lifecycle at the infrastructure level, includes working code examples, and walks through authentication, FX mechanics, and compliance handling — everything you need to scope and execute a cross-border payments API integration.
How a Cross-Border Payments API Integration Works
At its core, a cross-border payments API is a programmatic interface that accepts a payout instruction — recipient details, amount, destination currency, and payment method — and handles everything required to deliver funds to the recipient's local account. But the simplicity of the API call masks a complex orchestration layer underneath.
The Payout Lifecycle: From API Call to Local Delivery
A typical cross-border payout flows through five stages, all triggered by a single API request:
- Initiation: Your platform submits a payout request with the recipient's bank details, destination country, amount, and preferred delivery method. The API validates the request against required fields for that corridor.
- Compliance screening: The payment is screened against sanctions lists, PEP databases, and AML rules specific to the destination country. This happens in real time — compliant payments proceed, flagged payments return a status code with the reason.
- FX conversion: If the payout requires currency conversion, the API either applies a pre-locked rate (if you've used a quote endpoint) or converts at the current mid-market rate plus a transparent spread. You see the exact exchange rate and fees before confirming.
- Rail selection and routing: The orchestration layer selects the optimal payment rail for delivery — local ACH, real-time payment networks (like PIX in Brazil, UPI in India, or Faster Payments in the UK), or SWIFT as a fallback for corridors without local rail coverage.
- Settlement and confirmation: Funds are delivered to the recipient's local account. The API returns status webhooks at each stage: processing, in-transit, delivered, or failed with error details.
The entire flow — from API call to funds delivered — takes minutes on real-time rails and one to two business days on batch local rails. Compare that to three to five business days and unpredictable intermediary fees on SWIFT.
Local Rails vs. SWIFT: Why Routing Matters for Cross-Border Payments
The biggest architectural difference between modern cross-border payments APIs and legacy infrastructure is rail selection. Traditional correspondent banking routes every international payment through SWIFT, which means each transaction passes through one to three intermediary banks — each adding fees, delays, and opacity.
How Local Rail Routing Works
Local rails are domestic payment networks that move money within a single country: ACH in the United States, SEPA in Europe, PIX in Brazil, SPEI in Mexico, Faster Payments in the UK, and hundreds more. A well-architected cross-border payments API maintains direct connections or banking partnerships in each destination country, allowing it to 'land' payments on these local networks rather than routing through SWIFT.
The result is measurably better for both the sender and recipient:
- Cost: Local rail payouts typically cost a fraction of SWIFT wire fees because there are no intermediary banks taking a cut. SWIFT wires commonly incur $25–$50 in fees per transaction; local rail payouts often cost under $5.
- Speed: Real-time payment networks like PIX and Faster Payments deliver funds in seconds. Even batch networks like SEPA settle same-day or next-day. SWIFT averages two to five business days.
- Transparency: With local rails, the recipient gets the full amount — no surprise deductions from correspondent banks. The sender sees the exact cost upfront via the API.
- Recipient experience: Funds arrive in the recipient's local currency through their normal banking channel. No need for the recipient to have a USD account or deal with incoming wire conversion.
When SWIFT Still Makes Sense
Local rails don't cover every corridor. For high-value B2B payments to countries without accessible domestic payment networks, SWIFT remains the fallback. A good cross-border payments API uses multi-rail orchestration — routing through local rails when available and falling back to SWIFT when necessary, without requiring the integrating developer to manage that logic. This is the approach Routefusion takes: a single API that automatically selects the fastest, cheapest rail for each payout based on destination country, amount, and speed requirements.
API Integration Patterns and Code Examples
How you integrate a cross-border payments API depends on your platform's architecture and use case. Below are the three most common patterns, with code examples showing what the integration looks like in practice.
Direct API Integration: Payout Request Example
Your backend calls the payment API directly. This is the standard approach for platforms that want full control over the payout flow. A typical integration involves four core endpoint groups: beneficiary management, quote/FX, transfer initiation, and status/webhooks. Here's what a payout request looks like:
``` POST /v1/transfers Authorization: Bearer rf_live_sk_... Content-Type: application/json { "source_currency": "USD", "destination_currency": "BRL", "destination_country": "BR", "amount": 5000.00, "quote_id": "qt_8f2a1b3c", "beneficiary": { "name": "Empresa Exemplo Ltda", "bank_code": "001", "branch_code": "1234", "account_number": "12345678-9", "tax_id": "12.345.678/0001-90", "account_type": "checking" }, "purpose_of_payment": "contractor_payment", "reference": "INV-2026-0042", "callback_url": "https://yourplatform.com/webhooks/payouts" } ```
Note the Brazil-specific fields: `tax_id` (CNPJ for businesses, CPF for individuals), `branch_code`, and `purpose_of_payment`. These corridor-specific requirements are the kind of detail that trips up integrations — a well-designed API returns clear validation errors specifying exactly which fields are missing or malformed for each destination country.
Handling Webhook Status Updates
Cross-border payouts are asynchronous. Your integration needs to handle status updates via webhooks to keep your users informed and your reconciliation accurate. Here's a typical webhook payload for a completed payout:
``` POST https://yourplatform.com/webhooks/payouts X-Signature: sha256=a1b2c3d4e5f6... Content-Type: application/json { "event": "transfer.completed", "transfer_id": "tr_9d4e2f1a", "status": "delivered", "source_amount": 5000.00, "source_currency": "USD", "destination_amount": 25420.50, "destination_currency": "BRL", "exchange_rate": 5.0841, "fee": 4.50, "rail": "PIX", "delivered_at": "2026-02-12T14:32:01Z", "reference": "INV-2026-0042" } ```
Key details to note: the `X-Signature` header lets you verify the webhook originated from the payment provider (more on this in the security section below). The payload includes the exact exchange rate applied, the fee, and the rail used — giving your platform full transparency for reconciliation and reporting. Build your webhook handler to process events idempotently using the `transfer_id`, since retries can deliver the same event more than once.
Embedded Payout Flows
For platforms that want to offer cross-border payouts as a feature within their product — think payroll platforms letting employers pay international contractors, or marketplaces disbursing to global sellers — embedded flows abstract the payment experience into pre-built UI components or white-label interfaces. The API handles the backend orchestration while your platform controls the user experience. This pattern reduces integration time and shifts compliance burden to the payment provider.
Batch Payout Processing
Payroll providers and marketplaces that process hundreds or thousands of payouts at regular intervals need batch capabilities. Instead of individual API calls, you submit a file or array of payout instructions that the API processes in parallel — applying FX rates, screening compliance, and routing to local rails for each recipient. Batch endpoints should support partial success (some payouts succeed while others fail validation) and return detailed per-payout status reporting.
API Security and Authentication
Developers evaluating a cross-border payments API integration need to understand the security model before writing a line of code. Payment APIs handle sensitive financial data and PII — authentication and encryption aren't features, they're requirements.
Authentication Methods
Most cross-border payment APIs authenticate via API keys passed in the Authorization header as a Bearer token. You'll typically receive a pair of keys: a test key for sandbox requests and a live key for production. Treat live API keys like database credentials — store them in environment variables or a secrets manager, never in client-side code or version control. Some providers also support OAuth 2.0 for more complex multi-tenant architectures where your platform needs to act on behalf of sub-accounts.
Encryption and Transport Security
All API communication should occur over TLS 1.2 or higher — reject any provider that doesn't enforce this. Beyond transport encryption, evaluate how the provider handles data at rest. Beneficiary bank details and identity documents should be encrypted in storage using AES-256 or equivalent. Routefusion enforces TLS 1.2+ on all API endpoints and encrypts sensitive data at rest, backed by SOC 2 Type II certification that covers the full payments infrastructure.
Webhook Signature Verification
Webhooks are an attack surface. Without verification, a malicious actor could send fake status updates to your callback URL — marking payouts as delivered when they haven't been, or triggering duplicate disbursements. Always verify webhook signatures by computing an HMAC of the request body using your webhook secret and comparing it to the signature in the request header. Reject any webhook that doesn't match. Additionally, restrict inbound webhook traffic to the provider's published IP ranges using allowlisting on your firewall or load balancer.
FX Handling in Cross-Border Payment APIs
Currency conversion is where cross-border payment APIs diverge most in quality. Poor FX handling quietly erodes your margins on every transaction. Here's what to evaluate.
Quote-and-Lock vs. Auto-Conversion
The best APIs offer a quote endpoint that returns the exact exchange rate, fees, and recipient amount before you commit to the transfer. You lock the rate for a window (typically 30 seconds to several minutes), then initiate the transfer at that guaranteed rate. This eliminates FX slippage — the difference between the rate you expected and the rate applied. Auto-conversion APIs that apply the rate at settlement time expose you to market movements between initiation and delivery, which adds up fast on high volumes.
Transparent Spreads vs. Hidden Markups
Every payment provider makes money on FX — the question is whether you can see exactly how much. Transparent APIs show the mid-market rate alongside the applied rate, so you can calculate the exact spread. Some providers bury markup in opaque 'wholesale rates' that are impossible to benchmark. If you're evaluating a cross-border payments API, request the mid-market rate comparison for several currency pairs during your sandbox testing. Routefusion provides transparent FX pricing with clear spread visibility on every quote, so platforms can model their own margins accurately.
FX Hedging for Predictable Costs
Platforms processing recurring cross-border payouts — monthly payroll, weekly marketplace disbursements — face cumulative currency risk. An FX hedging API lets you lock rates for future payouts, protecting margins against adverse currency movements. This is especially critical in volatile corridors involving emerging market currencies. Without hedging, a platform paying contractors in Brazilian real or Nigerian naira can see payout costs swing significantly month to month.
Compliance and Beneficiary Validation
Cross-border payment compliance isn't optional — it's the reason most platforms choose an API provider instead of building in-house. Every corridor has different regulatory requirements, and getting them wrong means failed payments, frozen funds, or regulatory action.
What the API Should Handle
A production-ready cross-border payments API should manage three compliance layers automatically:
- Sanctions screening: Real-time checks against OFAC, EU, and UN sanctions lists for every transaction. Flagged payments should return structured error responses with the match reason.
- KYC/KYB verification: The API should collect and verify identity documents for senders and recipients as required by each corridor. For B2B payouts, this includes business verification (KYB) for the sending entity.
- Purpose of payment codes: Many countries require a specific purpose code for incoming international payments — remittance, trade settlement, contractor payment, etc. The API should either auto-apply the correct code or require it as a field in the payout request.
- Beneficiary bank validation: Before initiating a transfer, the API should validate that the recipient's bank details (IBAN, SWIFT/BIC, local account number, branch code) are correctly formatted for the destination country. This catches errors before they become failed transactions.
Field Requirements Vary by Country
One of the most common integration pain points is discovering that required fields differ by destination. Sending to Mexico via SPEI requires a CLABE number. India requires an IFSC code. Brazil requires a CPF or CNPJ tax ID for the recipient. A well-designed API handles this by providing corridor-specific field requirements through a metadata endpoint, or by returning clear validation errors that specify exactly which fields are missing or malformed.