> ## 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.

# Sandbox-testing

> Styr utfall for capability, oppgave, lommebok og overføring mens du bygger integrasjonen.

Sandbox bruker samme API-vert som produksjon. En sandbox-API-nøkkel velger testmiljøet, der hjelpere simulerer utfall uten å flytte reelle midler.

Hold nøkkelen på backend-en din. Sandbox-hjelpere erstatter ikke produksjons-compliance eller onboarding.

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

## Test capability-klarhet

Etter at du har bedt om en capability, sett dens sandbox-status med [`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"}'
```

Hent capability-en på nytt etter at du har brukt hjelperen. Behandle gjeldende `status` og `openTaskIds` som resultatet produktet ditt må håndtere.

## Test en åpen oppgave

Opprett en capability-avgrenset oppgave med [`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
```

Lagre `data.id` som `TASK_ID`, `data.revision` som `TASK_REVISION`, og gjeldende `data.requirements[0].id` som `REQUIREMENT_ID`. Send inn svaret via [`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
```

Deretter aksepterer eller avviser du gjeldende innsending med [`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"}'
```

Bruk [Capabilities og oppgaver](/no/integration/onboarding/capabilities-and-requirements) for produksjonsmønsteret for oppgavefullføring.

## Finansier en sandbox-lommebok

Krediter en utstedt lommebok med [`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"}'
```

Lagre den returnerte `data.id` som `TRANSFER_ID` når du vil inspisere den simulerte finansieringsoverføringen.

## Fullfør eller la en overføring feile

Sett utfallet med [`POST /v3/sandbox/transfers/{transferId}/state`](/api-reference/sandbox/post-v3-sandbox-transfers-by-transfer-id-state):

<Tabs>
  <Tab title="Fullfør">
    ```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="Feil">
    ```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>

Deretter, kjør en [pay-in](/no/integration/receive-funds), [payout](/no/integration/send-funds) eller [utstedt bankkonto](/no/integration/issue-bank-account)-flyt i sandbox.


## Related topics

- [Autentisering](/no/integration/authentication.md)
- [Migrere til v3](/no/api-reference/versioning/migrate-to-v3.md)
- [Hurtigstart](/no/integration/quickstart.md)
- [Go live](/no/integration/go-live.md)
- [Integrasjonsoversikt](/no/integration/overview.md)
