> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swipelux.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test in sandbox

> Controlla i risultati di capability, task, wallet e transfer mentre costruisci la tua integrazione.

Sandbox usa lo stesso host API della produzione. Una chiave API sandbox seleziona l'ambiente di test, dove gli helper simulano i risultati senza spostare fondi reali.

Mantieni la chiave sul tuo backend. Gli helper sandbox non sostituiscono la compliance o l'onboarding di produzione.

```bash theme={null}
export API_BASE='https://platform.swipelux.com'
export SWIPELUX_SANDBOX_API_KEY='replace-with-your-sandbox-key'
```

## Testa la readiness di una capability

Dopo aver richiesto una capability, imposta il suo stato sandbox con [`POST /v3/sandbox/customers/{customerId}/capabilities/{capabilityId}/status`](/api-reference/sandbox/post-v3-sandbox-customers-by-customer-id-capabilities-by-capability-id-status):

```bash theme={null}
curl --request POST \
  "${API_BASE}/v3/sandbox/customers/${CUSTOMER_ID}/capabilities/${CAPABILITY_ID}/status" \
  --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{"status":"ready"}'
```

Rileggi la capability dopo aver usato l'helper. Considera il suo `status` corrente e gli `openTaskIds` come il risultato che il tuo prodotto deve gestire.

## Testa un task aperto

Crea un task con scope di capability con [`POST /v3/sandbox/tasks`](/api-reference/sandbox/post-v3-sandbox-tasks):

```bash theme={null}
curl --request POST \
  "${API_BASE}/v3/sandbox/tasks" \
  --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
  --header "Content-Type: application/json" \
  --data @- <<JSON
{
  "scope": {
    "type": "capability",
    "customerId": "${CUSTOMER_ID}",
    "capabilityId": "${CAPABILITY_ID}"
  },
  "items": [
    {
      "type": "explanation",
      "request": "Explain the source of funds."
    }
  ]
}
JSON
```

Salva `data.id` come `TASK_ID`, `data.revision` come `TASK_REVISION` e l'attuale `data.requirements[0].id` come `REQUIREMENT_ID`. Invia la risposta tramite [`POST /v3/customers/{customerId}/tasks/{taskId}/submissions`](/api-reference/task-submissions/create-customer-task-submission):

```bash theme={null}
curl --request POST \
  "${API_BASE}/v3/customers/${CUSTOMER_ID}/tasks/${TASK_ID}/submissions" \
  --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
  --header "Idempotency-Key: sandbox-task-submission-001" \
  --header "Content-Type: application/json" \
  --data @- <<JSON
{
  "taskRevision": ${TASK_REVISION},
  "answers": [
    {
      "requirementId": "${REQUIREMENT_ID}",
      "answer": {
        "type": "text",
        "value": "Sandbox requirement completed."
      }
    }
  ]
}
JSON
```

Poi accetta o rifiuta la submission corrente con [`POST /v3/sandbox/tasks/{taskId}/review`](/api-reference/sandbox/post-v3-sandbox-tasks-by-task-id-review):

```bash theme={null}
curl --request POST \
  "${API_BASE}/v3/sandbox/tasks/${TASK_ID}/review" \
  --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{"outcome":"accepted"}'
```

Usa [Capability e task](/it/integration/onboarding/capabilities-and-requirements) per il pattern di completamento dei task in produzione.

## Finanzia un wallet sandbox

Accredita un wallet emesso con [`POST /v3/sandbox/accounts/{accountId}/topup`](/api-reference/sandbox/post-v3-sandbox-accounts-by-account-id-topup):

```bash theme={null}
curl --request POST \
  "${API_BASE}/v3/sandbox/accounts/${ACCOUNT_ID}/topup" \
  --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{"amount":"250.00","currency":"USDC"}'
```

Salva il `data.id` restituito come `TRANSFER_ID` quando vuoi ispezionare il transfer di finanziamento simulato.

## Completa o fai fallire un transfer

Imposta il risultato con [`POST /v3/sandbox/transfers/{transferId}/state`](/api-reference/sandbox/post-v3-sandbox-transfers-by-transfer-id-state):

<Tabs>
  <Tab title="Completa">
    ```bash theme={null}
    curl --request POST \
      "${API_BASE}/v3/sandbox/transfers/${TRANSFER_ID}/state" \
      --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
      --header "Content-Type: application/json" \
      --data '{"state":"completed"}'
    ```
  </Tab>

  <Tab title="Fallisci">
    ```bash theme={null}
    curl --request POST \
      "${API_BASE}/v3/sandbox/transfers/${TRANSFER_ID}/state" \
      --header "X-API-Key: ${SWIPELUX_SANDBOX_API_KEY}" \
      --header "Content-Type: application/json" \
      --data @- <<'JSON'
    {
      "state": "failed",
      "stateDetail": {
        "code": "sandbox_review",
        "message": "Sandbox transfer failed."
      }
    }
    JSON
    ```
  </Tab>
</Tabs>

Successivamente, esegui un flusso di [pay-in](/it/integration/receive-funds), [payout](/it/integration/send-funds) o [conto bancario emesso](/it/integration/issue-bank-account) in sandbox.


## Related topics

- [Autenticazione](/it/integration/authentication.md)
- [Quickstart](/it/integration/quickstart.md)
- [Go live](/it/integration/go-live.md)
- [Migrare a v3](/it/api-reference/versioning/migrate-to-v3.md)
- [Panoramica dell'integrazione](/it/integration/overview.md)
