# Apa Quickstart

Canonical: https://apa.app/developers/quickstart

Apa lets a merchant create a payment link or API checkout session, send the customer to hosted checkout, and confirm settlement through signed webhooks. Apa is non-custodial: funds settle to the merchant payout wallet, not to an Apa-held balance.

## Steps

1. Connect the wallet you want to be paid in.
2. Save a payout wallet with asset, network and address.
3. Generate an API key only if you are building an integration.
4. Create a checkout session from your backend.
5. Redirect the customer to the hosted checkout URL.
6. Verify signed webhooks on your backend.
7. Fulfill only after a terminal success state such as `paid`.

## Create a payout wallet

```bash
curl https://apa.app/v1/payout-wallets \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"asset":"USDC","network":"solana","address":"8dK3...p91A"}'
```

## Create a checkout session

```bash
curl https://apa.app/v1/checkout/sessions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"payout_wallet_id":"pp_123","amount":"100.00","currency":"USD","order_id":"ord_1042"}'
```

Expected response:

```json
{
  "data": {
    "id": "cs_123",
    "object": "checkout_session",
    "status": "created",
    "amount": "100.00",
    "currency": "USD",
    "payout_wallet_id": "pp_123",
    "payment_link_id": null,
    "checkout_url": "https://apa.app/checkout/cs_123",
    "deposit_addresses": [
      {
        "asset": "USDC",
        "network": "solana",
        "address": "8dK3...p91A",
        "kind": "direct",
        "reference": "apa_3aF2k9Lm7Qp1"
      }
    ]
  },
  "request_id": "req_3aF2k9Lm"
}
```

## Webhook rule

Use signed webhooks for backend order truth. Browser redirects are useful for customer experience, but the webhook is what should update the order.

Related:

- https://apa.app/developers/api-reference
- https://apa.app/developers/webhooks
- https://apa.app/openapi.json
