Overview
This guide walks through the complete flow of integrating Yala payout APIs into your application, from your end user’s perspective to your backend implementation.Integration Flow
The integration follows this pattern:- User initiates payout in your app
- Your frontend sends request to your backend
- Your backend calls Yala API
- Yala processes and responds
- Your backend updates your database
- Your frontend displays status to user
- User sees updated status
Step-by-Step Flow
1. Your user selects a payout corridor
What happens:- User visits your app/website
- User selects source currency (e.g., NGN) and destination currency (e.g., CNY)
- User enters amount they want to send
- Display available currency pairs (you can cache this or call GET /pairs periodically)
- Call GET /wallets to show the user’s balance per currency. Debit is always from the source currency wallet—when they initiate a payout in NGN, the NGN wallet is debited.
- Validate user has sufficient balance in the selected source currency before calling initiate
2. Your backend calls Yala API to get rates and methods
What happens:- Your backend calls GET /methods with the selected corridor
- Yala returns current exchange rate, available payment methods, and required beneficiary fields
3. Your frontend displays options to user
What happens:- Your frontend receives rates and methods from your backend
- User sees exchange rate and available payment methods
- User selects a payment method (e.g., ALIPAY)
- Display exchange rate: “1 NGN = [rate.rate] CNY” (replace [rate.rate] with the actual rate value from the response)
- Show available methods with settlement times and fees
- Let user select preferred method
- Show estimated destination amount: sourceAmount multiplied by the rate value
4. User fills beneficiary form
What happens:- Your frontend renders a dynamic form based on requiredFields from the selected method
- User enters beneficiary details (name, Alipay ID, address, etc.)
- User confirms payout
- accountName (string, required)
- alipayId (string, required, validation: “email_or_phone”)
- address (string, required)
- city (string, required)
- postCode (string, required)
- email (email, optional)
- phoneNumber (phone, optional)
4a. (Recommended) Show quote before confirm
What happens:- Before the user clicks “Confirm”, call POST /quote with the same amount, currencies, and method
- Yala returns
totalDeductible(amount debited from wallet),destinationAmount(amount beneficiary receives), andincludedFees - Your frontend shows: “You will pay X. Recipient gets Y. Fee: Z.”
- Call
POST /v1/payout-api/payouts/quotewithsourceAmount,sourceCurrency,destinationCurrency,destinationCountryCode, andmethod - Display
quote.totalDeductible,quote.destinationAmount, andquote.includedFeesto the user - When the user confirms, proceed to POST /initiate (see Get Payout Quote)
5. Your backend creates payout
What happens:- Your backend calls POST /initiate with beneficiary details
- Yala creates payout and returns payout details including id
- Your backend saves payout.id to your database
- id - Save this! Use for tracking and webhook matching
- status - Initial status (PENDING)
- sourceAmount, destinationAmount - Conversion details
- exchangeRate - Rate used for conversion
- payoutRef - Human-readable reference
6. Track payout status
Option A: Polling (Simple but less efficient)- Activate webhooks in your Yala dashboard
- Configure your webhook endpoint URL
- Receive webhook notifications when status changes
eventType, deliveryId, occurredAt, and data. Status values in data.oldStatus and data.newStatus are always one of the five below:
7. User sees status updates
What happens:- Your backend receives webhook or polls status
- Your frontend displays status to user
- Status transitions: PENDING → PROCESSING → SUCCESSFUL
- Update your database when status changes (use
data.newStatusfrom webhook payload) - Push status update to your frontend (WebSocket, polling, or push notification)
- Display status in user’s dashboard/order page
- PENDING - Payout created or awaiting approval; not yet sent for processing
- PROCESSING - Payout is being processed (ops, bank, or treasury)
- SUCCESSFUL - Completed; funds have been sent
- FAILED - Processing failed (e.g. bank failure)
- REJECTED - Rejected (e.g. compliance, initiation checks, or bank)
Key Integration Points
Store payout.id
Always save payout.id from the initiate response:- Link it to your order/transaction record
- Use it to query status via GET /:id
- Match it with webhook notifications (webhook payload includes payoutId)
Idempotency
Generate idempotency key per payout:- Use UUID or order-[orderId] format (replace [orderId] with your actual order ID)
- Store with your order record
- Retry with same key + same body if request fails (prevents duplicates)
Error Handling
Handle common errors:- INSUFFICIENT_FUNDS - User’s wallet balance too low
- CORRIDOR_NOT_ENABLED - Currency pair not enabled in dashboard
- MISSING_REQUIRED_FIELDS - Beneficiary form incomplete
- IDEMPOTENCY_KEY_CONFLICT - Same key used with different request
Webhook Security
Validate webhook requests:- Verify source IP (Yala will provide IP ranges)
- Verify shared secret (provided during webhook setup)
- Implement idempotency for webhook processing (avoid duplicate processing)
Next Steps
- Quickstart - Get started with your first payout
- API Reference - Explore all endpoints
- Error Handling - Handle errors gracefully
- Authentication - Secure your API calls