# Sandbox Playbook

Run the fiat flows end to end against the bank ramp's sandbox before going live.

## Overview

There is **no separate sandbox API host**: every call goes to the base URL of the Aurea deployment you use (`https://api.aureahub.com`). Test mode is chosen per request, and the simulation endpoints act only on sandbox records.

## How Test Mode Works

| What | How it is selected |
| --- | --- |
| bank ramp sandbox | isTestnet on onboarding sessions, sync-status, payouts and the pay-in and payout reads; a sandbox network (SolanaDevnet, PolygonTestAmoy) on Initiate Deposit; isTestnet on Currencies & Networks. A user has a separate profile in each environment. Card checkout is switched off in both environments. Details: Bank Ramp Setup. |
| Blockchain testnets | isTestnet on wallet endpoints — for example POST /v1/wallets/import accepts isTestnet: true. |
| Simulations | POST /v1/ramp/bank/payin/sandbox/simulate-deposit works only on the user's own sandbox payment method, and POST /v1/ramp/bank/payout/sandbox/simulate only on a sandbox payout; anything else answers 404. GET /v1/ramp/bank/payin/debug/customer-status works only on non-production deployments; production answers 400. |

## Before You Start

1. Have Aurea connect the bank ramp for your tenant in the **sandbox** and switch on the functions you test — [Bank Ramp Setup](https://docs.aureahub.com/docs/bank-setup.md).
2. Create a test user and log in ([Authentication](https://docs.aureahub.com/docs/authentication.md)).
3. With the Aurea wallets mode, a pay-in is delivered only to one of the user's Aurea wallets, and a watch-only import is not one. The sandbox onboarding session in step 1 creates the user's Solana Devnet wallet when they have none, so leave `destinationAddress` out on `SolanaDevnet`. With the standalone mode only, prove a Solana address for the sandbox first and send it ([Standalone Pay-In](https://docs.aureahub.com/docs/guide-standalone-payin.md)).

## Pay-in Dry Run

```typescript
const API = 'https://api.aureahub.com';
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' };
const post = (path: string, body?: object) =>
  fetch(API + path, { method: 'POST', headers, body: body ? JSON.stringify(body) : undefined }).then(r => r.json());

// 1. Hosted KYC in the sandbox
const session = await post('/v1/ramp/bank/payin/onboard-session', { returnUrl: 'https://app.example.com/kyc/done', isTestnet: true });
// ...open session.onboardingUrl and complete the sandbox KYC...

// 2. Pull the result
const kyc = await post('/v1/ramp/bank/payin/sync-status', { isTestnet: true });   // expect canInitiateDeposit: true

// 3. Sandbox virtual IBAN
const pm = await post('/v1/ramp/bank/payin/initiate', { cryptoCurrency: 'EURC_TEST', network: 'SolanaDevnet' }); // delivered to the user's Solana Devnet wallet

// 4. Simulated bank transfer (on the sandbox payment method from step 3)
await post('/v1/ramp/bank/payin/sandbox/simulate-deposit', { paymentMethodId: pm.paymentMethodId, amount: 100 });

// 5. Once the deposit has reached Aurea, it is listed
const { deposits } = await fetch(API + '/v1/ramp/bank/payin/deposits?isTestnet=true', { headers }).then(r => r.json());
```

## Payout Dry Run

```typescript
// isTestnet: true selects the sandbox (production payouts are refused)
const payout = await post('/v1/ramp/bank/payout/initiate', {
  cryptoCurrency: 'EURC_TEST',
  cryptoAmount: '20000000',          // 20, 6 decimals
  fiatCurrency: 'EUR',
  returnUrl: 'myapp://payout/done',
  isTestnet: true
});

// Skip the hosted page and force the result
await post('/v1/ramp/bank/payout/sandbox/simulate', { payoutId: payout.payoutId, outcome: 'completed' });

const current = await fetch(API + `/v1/ramp/bank/payout/transactions/${payout.payoutId}?isTestnet=true`, { headers }).then(r => r.json());
// current.status === 'completed'
```

## Limits

- Simulations act only on sandbox records: a payment method created on a sandbox network, and a payout created with `isTestnet: true`.
- Simulated deposits appear once the bank ramp's sandbox reports them to Aurea, a few seconds after the call: Aurea receives those reports as soon as it has connected the bank ramp for your tenant in the sandbox.
- Payout creation checks the sandbox balance Aurea keeps for your tenant and the channel limits, just like production.
- How KYC behaves in the bank ramp's sandbox is defined by the bank ramp — see the bank ramp's documentation.

---

Web version: https://docs.aureahub.com/#guide-sandbox-playbook
