Documentation Index
Fetch the complete documentation index at: https://docs.mavapay.co/llms.txt
Use this file to discover all available pages before exploring further.
Payment Simulation
The simulation endpoint allows you to test payment flows in the staging environment without making actual payments. This is useful for testing your integration and webhook handlers.Endpoint
How It Works
- Create a quote using the Create Quote endpoint
- Use the
quoteId(ororderIdif you don’t have the quote) from the response - Call the simulation endpoint to simulate payment
- Your webhook will receive
payment.receivedevent - If autopayout is enabled, you’ll also receive
payment.sentevent
Nigerian Naira (NGN) Simulation
Request
Response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
currency | string | Yes | Must be "NGN" |
quoteId | string (UUID) | No* | The quote ID from your created quote |
orderId | string (UUID) | No* | The order ID (use if you don’t have the quote ID) |
amount | number | Yes | Amount in kobo (must match quote amount) |
quoteId or orderId is required.
Bitcoin (BTC) Simulation
Request
Response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
currency | string | Yes | Must be "BTC" |
quoteId | string (UUID) | No* | The quote ID from your created quote |
orderId | string (UUID) | No* | The order ID (use if you don’t have the quote ID) |
quoteId or orderId is required.
For BTC simulations, the
amount parameter is not required as it’s determined by the Lightning invoice.Payment Link Simulation
For Payment Links (including on-chain Bitcoin purchases), you need to first retrieve the order ID.Step 1: Get the Order ID
Retrieve the order ID associated with your payment link:Step 2: Simulate Payment
Use the order ID to simulate the bank transfer:For Payment Link simulations, use
orderId instead of quoteId. The amount should match the payment link amount in kobo.Complete Testing Flow
Step 1: Create a Quote
Step 2: Simulate Payment
Step 3: Receive Webhook
Your registered webhook endpoint will receive apayment.received event:
payment.sent event shortly after.
Testing Different Scenarios
Test Successful Payment
Use the simulation endpoint as shown above to test successful payment flows.Using Order ID Instead of Quote ID
If you don’t have access to the quote ID, you can use the order ID instead:Test Different Currency Pairs
Create quotes for different currency pairs and simulate payments:Test Webhook Handling
- Set up a webhook endpoint using webhook.site or ngrok
- Register your webhook in staging
- Create a quote and simulate payment
- Verify your webhook receives and processes the events correctly
Common Errors
| Error | Description | Solution |
|---|---|---|
Invalid quote ID | Quote doesn’t exist or has expired | Create a new quote and use the fresh quote ID |
Amount mismatch | Simulation amount doesn’t match quote amount | Use the exact amount from the quote response |
Quote already paid | Quote has already been paid (simulated or real) | Create a new quote for testing |
Invalid currency | Currency doesn’t match quote parameters | Use the correct currency from your quote |
Best Practices
- Fresh Quotes: Create new quotes for each test to avoid “already paid” errors
- Webhook Testing: Test both
payment.receivedandpayment.sentevents - Error Handling: Test how your system handles different payment statuses
- Idempotency: Verify your webhook handler processes duplicate events correctly
- Timing: Test scenarios where webhooks arrive out of order
Integration Checklist
- Create quotes successfully
- Simulate NGN payments
- Simulate BTC payments
- Receive
payment.receivedwebhooks - Receive
payment.sentwebhooks - Handle webhook signature verification
- Implement idempotent webhook processing
- Test error scenarios
- Verify beneficiary payouts work correctly
Next Steps
- Learn about webhook integration
- View quote examples for all currency pairs
- Explore beneficiary formats
- Test in production with small amounts first
