Overview
The Grid sandbox environment allows you to test your payouts integration without moving real money. All API endpoints work the same way in sandbox as they do in production, but money movements are simulated and you can control test scenarios using special test values.Getting Started with Sandbox
Sandbox Credentials
To use the sandbox environment:- Contact Lightspark to get your inital sandbox credentials configured. Email support@lightspark.com to get started.
- Add your sandbox API token and secret to your environment variables.
- Use the normal production base URL:
https://api.lightspark.com/grid/2025-10-13
- Authenticate using your sandbox token with HTTP Basic Auth
Simulating Money Movements
Funding Internal Accounts
In production, internal accounts are funded by following the payment instructions (bank transfer, wire, etc.). In sandbox, you can instantly add funds to any internal account using the following endpoint:InternalAccount
object with the new balance.
Alternatively, you can also fund internal accounts using the /quotes
or /transfer-in
endpoints as described below.
Testing Transfer Scenarios
Adding Test External Accounts
The flows for creating external accounts in sandbox are the same as in production. However, when creating external accounts in sandbox, you can use special account number patterns to simulate different transfer behaviors. The last 3 digits of the account number determine the test scenario:Last Digits | Behavior | Use Case |
---|---|---|
002 | Insufficient funds | Transfer-in fails immediately |
003 | Account closed/invalid | All transfers fail immediately |
004 | Transfer rejected | Bank rejects the transfer |
005 | Timeout/delayed failure | Transaction stays pending ~30s, then fails |
Any other | Success | All transfers complete normally |
These patterns apply to the primary identifier for any account type: US account numbers, IBANs, CLABEs, Spark wallet addresses, etc. Just ensure the identifier ends with the appropriate test digits.
For scenarios like PIX and UPI, where there’s a domain part involved, append the test digits to the user name part. For example, if testing email addresses as a PIX key, the full identifier would be
“testuser.002@pix.com.br” to trigger the insufficient funds scenario.
Testing Transfer-In (Pull from External Account)
When you call/transfer-in
with an external account created using test patterns, the transfer will complete instantly in sandbox with the behavior determined by the account number:
- Success (default): Transaction completes immediately with status
COMPLETED
- Insufficient funds (002): Transaction fails immediately with appropriate error
- Account closed (003): Transaction fails immediately with account validation error
- Transfer rejected (004): Transaction fails immediately with rejection error
- Timeout (009): Transaction shows
PENDING
status for ~30 seconds, then transitions toFAILED
Testing Transfer-Out (Push to External Account)
Transfer-out works the same way - the destination external account’s test pattern determines the outcome:Testing Cross-Currency Quotes
Creating Quotes with Test Accounts
When creating quotes with theexternalAccountDetails
destination type, you can provide test account patterns inline:
Executing Quotes in Sandbox
For quotes from an external account source, execute as in production via/quotes/{quoteId}/execute
. The sandbox will:
- Instantly process the currency conversion
- Apply the test behavior based on any external accounts involved
- Update transaction statuses immediately (no waiting for bank processing)
- Trigger webhooks for state changes
/sandbox/send
endpoint to simulate payment:
Testing Webhooks
All webhook events fire normally in sandbox. To test your webhook endpoint:- Configure your webhook URL in the dashboard
- Perform actions that trigger webhooks (transfers, quote execution, etc.)
- Receive webhook events at your endpoint
- Verify signature using the sandbox public key
Common Testing Workflows
Complete Payout Flow Test
Here’s a complete test workflow for a USD → EUR payout:- Create customer and internal accounts (via regular API)
-
Fund customer’s USD internal account:
-
Create a test external EUR account:
-
Create and execute a quote:
- Verify transaction status and webhooks
Testing Error Scenarios
Test each failure mode systematically:Sandbox Limitations
While sandbox closely mimics production, there are some differences:- Instant settlement: All transfers complete immediately (success cases) or fail immediately (error cases), except timeout scenarios (005)
- No real bank validation: Account numbers aren’t validated against real banking networks
- Simplified KYC: KYC processes are simulated and complete instantly. You must add customers via the
/customers
endpoint, rather than using the KYC link flow. - Fixed exchange rates: Currency conversion rates may not reflect real-time market rates.
Do not try sending money to any sandbox addresses or accounts. These are not real addresses and will not receive money.
Moving to Production
When you’re ready to move to production:- Generate production API tokens in the dashboard
- Swap those credentials for the sandbox credentials in your environment variables
- Remove any sandbox-specific test patterns from your code
- Configure production webhook endpoints
- Test with small amounts first
Next Steps
- Review Webhooks for event handling
- Check out the Postman Collection for API examples
- See Error Handling for production error strategies