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

> ## Agent Instructions
> When building application code, use `@naturalpay/sdk` for TypeScript or `naturalpay` for Python.
> When operating Natural directly for a user, use the payments MCP at `https://mcp.natural.com`.
> When searching Natural documentation, use the docs MCP at `https://docs.natural.com/mcp`.
> Use the Natural CLI for terminal and CI automation.
> Use REST only for unsupported languages or when the user explicitly requests raw HTTP.
> Start integration development and testing in the sandbox. Do not use production unless the user explicitly requests it.
> For sandbox requests that require `customerPartyId`, list customers first. Reuse only the intended fixture; otherwise create a customer.
> REST and SDK amounts use integer minor units. Payments MCP amounts use decimal strings with a required currency code.

# Accept in Sandbox

> Test card payments and settlement without moving real money

Create a checkout link, pay with a test card, and simulate settlement into your wallet.

<Snippet file="shared/prerequisites.mdx" />

Set `NATURAL_API_KEY` to your Sandbox API key. The examples use `https://api.sandbox.natural.com`. For MCP, connect to `https://mcp.sandbox.natural.com`.

<Note>
  Testing for a customer? Pass their party ID as `customerPartyId` on each call. Your agent needs
  permission to act on their behalf.
</Note>

## 1. Create an intent

Create a payment intent for \$39.20. Amounts are in cents.

<CodeGroup>
  ```python Python theme={null}
  import uuid
  from naturalpay import Natural

  client = Natural(
      base_url="https://api.sandbox.natural.com",
      instance_id=str(uuid.uuid4()),
  )
  intent = client.payment_intents.create(
      amount=3920,
      currency="USD",
      description="Sandbox test",
      idempotency_key=str(uuid.uuid4()),
  )
  ```

  ```typescript TypeScript theme={null}
  import Natural from "@naturalpay/sdk";

  const client = new Natural({ baseUrl: "https://api.sandbox.natural.com" });
  const intent = await client.paymentIntents.create(
    {
      amount: 3920,
      currency: "USD",
      description: "Sandbox test",
      idempotencyKey: crypto.randomUUID(),
    },
    { instanceId: crypto.randomUUID() },
  );
  ```

  ```bash CLI theme={null}
  export NATURAL_BASE_URL=https://api.sandbox.natural.com

  natural payment-intents create \
    --amount 3920 \
    --currency USD \
    --description "Sandbox test" \
    --x-instance-id "$(uuidgen)" \
    --idempotency-key "$(uuidgen)"
  ```

  ```text MCP theme={null}
  Create a Sandbox checkout link for $39.20 with the description "Sandbox test".
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.sandbox.natural.com/payment-intents \
    -H "Authorization: Bearer $NATURAL_API_KEY" \
    -H "X-Instance-ID: $(uuidgen)" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{
      "data": {
        "attributes": {
          "amount": 3920,
          "currency": "USD",
          "description": "Sandbox test"
        }
      }
    }'
  ```
</CodeGroup>

Keep the intent ID and checkout link from `data.attributes.payUrl`.

## 2. Pay with a test card

Open `payUrl` and enter a test card. Use a future expiration date and any three-digit CVC.

| Card number           | Outcome  |
| --------------------- | -------- |
| `4111 1111 1111 1111` | Approved |
| `4000 0000 0000 0002` | Declined |

## 3. Check the result

[Get the payment intent](/api-reference/payment-intents/get-payment-intent) to check its status.

<CodeGroup>
  ```python Python theme={null}
  result = client.payment_intents.get(intent.data.id)
  ```

  ```typescript TypeScript theme={null}
  const result = await client.paymentIntents.get({
    paymentIntentId: intent.data.id,
  });
  ```

  ```bash CLI theme={null}
  natural payment-intents get --payment-intent-id pmi_019d0a1b2c3d4e5f60718293a4b5c6d7
  ```

  ```text MCP theme={null}
  Has that Sandbox payment been completed?
  ```

  ```bash cURL theme={null}
  curl https://api.sandbox.natural.com/payment-intents/pmi_019d0a1b2c3d4e5f60718293a4b5c6d7 \
    -H "Authorization: Bearer $NATURAL_API_KEY"
  ```
</CodeGroup>

## 4. Settle the payment

Sandbox payments require simulated settlement. Open the payment in the Sandbox dashboard and select **Simulate settlement**, or use the API:

<CodeGroup>
  ```python Python theme={null}
  settlement = client.simulations.settle_card_payment(
      result.data.relationships.card_payment.data.id,
      idempotency_key=str(uuid.uuid4()),
  )
  ```

  ```typescript TypeScript theme={null}
  const settlement = await client.simulations.settleCardPayment(
    {
      cardPaymentId: result.data.relationships.cardPayment.data.id,
      idempotencyKey: crypto.randomUUID(),
    },
    { instanceId: crypto.randomUUID() },
  );
  ```

  ```bash CLI theme={null}
  natural simulations settle-card-payment \
    --card-payment-id cpy_019d0a1b2c3d4e5f60718293a4b5c6d8 \
    --x-instance-id "$(uuidgen)" \
    --idempotency-key "$(uuidgen)"
  ```

  ```text MCP theme={null}
  Simulate settlement for that successful Sandbox card payment.
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.sandbox.natural.com/simulations/card-payments/cpy_019d0a1b2c3d4e5f60718293a4b5c6d8/settle \
    -H "Authorization: Bearer $NATURAL_API_KEY" \
    -H "X-Instance-ID: $(uuidgen)" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{ "data": { "attributes": {} } }'
  ```
</CodeGroup>

<Snippet file="api-examples/simulations.settleCardPayment.response.mdx" />

The response returns the card payment. If `settledAt` is null, [get the card payment](/api-reference/card-payments/get-card-payment) again to check settlement.
