Configure for Sandbox
Point the SDK to the sandbox API by setting the host environment variable:NEXT_PUBLIC_CUBEPAY_MERCHANT_ID, CUBEPAY_API_KEY) use your sandbox credentials from the Grain Dashboard.
Run an End-to-End Test
1
Create a payment session
Use your server to create a session against the sandbox API.
2
Open the payment modal
Launch the SDK on the client with the returned session credentials. In sandbox, the SDK connects to test blockchain networks (Sepolia) automatically.
3
Complete the payment
Connect a wallet funded with testnet tokens and approve the transaction. The SDK handles network switching automatically.
4
Verify in the dashboard
Go to the Grain Dashboard and navigate to Transactions. Confirm your test payment appears with the expected status.
Test Webhook Delivery
Sandbox webhooks work identically to production. Configure your webhook URL in the dashboard and use a tunneling tool to receive webhooks locally:Simulate Payment Statuses
Each webhook delivery contains astatus field. In sandbox, payments progress through the full lifecycle:
Verify your webhook handler processes each status correctly by monitoring your server logs as you complete test payments.