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
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.
Complete the payment
Connect a wallet funded with testnet tokens and approve the transaction. The SDK handles network switching automatically.
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:
| Status | When It Fires |
|---|---|
PENDING | Session created |
FUNDED | Testnet tokens received at the one-time wallet |
SUCCEEDED | Simulated sweep to settlement |
CANCELED | Payment cancelled (timeout or user action) |
ERROR | Simulated error condition |
Sandbox vs Production
| Behavior | Sandbox | Production |
|---|---|---|
| Blockchain network | Sepolia (testnet) | Ethereum, Base (mainnet) |
| Tokens | Test USDC (no real value) | Real USDC |
| Settlement | Simulated | Real on-chain settlement |
| Webhooks | Delivered to your endpoint | Delivered to your endpoint |
| API host | api.sandbox.pay.grain.inc | api.pay.grain.inc |