# Simulate Deposit

Ask the bank ramp's sandbox to simulate a bank transfer to a sandbox virtual account, in that account's own currency, to test your pay-in flow without real money.

## Overview

- First create a sandbox virtual account with [Initiate Deposit](https://docs.aureahub.com/docs/payin-initiate.md) on a sandbox network (for example `SolanaDevnet`), and pass its `paymentMethodId` — Aurea's ID, also listed by [Payment Methods](https://docs.aureahub.com/docs/payin-methods.md) with `isTestnet=true`.
- Only the user's own **sandbox** accounts can be used: an account of another user, or a production account, answers `404` and the bank ramp isn't called.
- **The transfer is in the account's own currency**, the `currency` the account was created in: a USD account is paid in dollars, an EUR account in euros. `amount` is in that currency.
- Pay-in must be switched on for your tenant in the sandbox ([Tenant Settings](https://docs.aureahub.com/docs/bank-settings.md)), otherwise `403` `NOAH_FUNCTION_OFF`.
- Aurea asks the bank ramp's **sandbox** to simulate the transfer for your tenant. It doesn't create the deposit itself: the deposit appears in [Get Deposits](https://docs.aureahub.com/docs/payin-deposits.md) (with `isTestnet=true`) when the bank ramp reports the deposit to Aurea, which it does once the bank ramp is connected for your tenant in the sandbox ([Bank Ramp Setup](https://docs.aureahub.com/docs/bank-setup.md)).

> ℹ️ There is no separate sandbox host: call the base URL of the Aurea deployment you use. The simulation works on any deployment, because it only ever reaches the bank ramp's sandbox.

## Endpoint

### `POST /v1/ramp/bank/payin/sandbox/simulate-deposit`

Authentication: bearer token required.

Triggers a simulated bank transfer in the bank ramp's sandbox to the given virtual account, in the account's own currency.

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `paymentMethodId` | string | yes | Aurea payment method UUID of a sandbox virtual account |
| `amount` | number | yes | Amount in the account's currency, greater than 0 and at most 15000 |
| `reference` | string | no | Reference the bank ramp attaches to the simulated deposit |

**Responses**

`200` OK

```json
{
  "success": true,
  "message": "Deposit simulated successfully. Webhook events will be triggered shortly."
}
```

`404` Not a sandbox account of the user

```json
{ "statusCode": 404, "error": "NotFoundError", "message": "Payment method not found" }
```

`403` Pay-in switched off

```json
{
  "statusCode": 403,
  "error": "ForbiddenError",
  "message": "The bank ramp's pay-in is not switched on for this tenant in sandbox.",
  "details": { "code": "NOAH_FUNCTION_OFF", "function": "payin", "environment": "sandbox" }
}
```

## Implementation

```javascript
const API = 'https://api.aureahub.com'; // base URL of the Aurea deployment you use
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' };

// 1. Sandbox virtual account (sandbox network -> sandbox profile)
const pm = await fetch(`${API}/v1/ramp/bank/payin/initiate`, {
  method: 'POST', headers,
  body: JSON.stringify({ cryptoCurrency: 'EURC_TEST', network: 'SolanaDevnet' }) // delivered to the user's Solana Devnet wallet
}).then(r => r.json());

// 2. Simulated bank transfer
await fetch(`${API}/v1/ramp/bank/payin/sandbox/simulate-deposit`, {
  method: 'POST', headers,
  body: JSON.stringify({ paymentMethodId: pm.paymentMethodId, amount: 250, reference: 'Test deposit 1' })
});

// 3. The deposit shows up once it has reached Aurea
const { deposits } = await fetch(`${API}/v1/ramp/bank/payin/deposits?isTestnet=true`, { headers }).then(r => r.json());
```

---

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