# Checkout

Checkout creates a hosted payment page. You redirect the customer to its `url`, and IntaSend
shows the payment methods enabled on your account for that currency.

Checkout is authenticated with your **publishable key**, so you can call it from your frontend or your server.

```bash
curl -X POST https://api.intasend.com/api/v1/checkout/ \
  -H "X-IntaSend-Public-API-Key: ISPubKey_test_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1500,
    "currency": "KES",
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Doe",
    "phone_number": "254712345678",
    "api_ref": "order-123",
    "redirect_url": "https://example.com/thank-you"
  }'
```

```json
{
  "id": "0b7d…",
  "url": "https://sandbox.intasend.com/checkout/0b7d…/express/",
  "signature": "eyJ…",
  "amount": 1500,
  "currency": "KES",
  "paid": false
}
```

Redirect the customer to `url`. After they pay, they are sent to `redirect_url`.

## Request

| Field | Required | Description |
|---|---|---|
| `amount` | Yes | Amount to charge, up to 2 decimal places. Minimum 0.10. |
| `currency` | No | `KES` (default), `USD`, `EUR`, `GBP`, `UGX`, `TZS`, `RWF`. UGX and TZS amounts must be between 500 and 5,000,000. |
| `email`, `first_name`, `last_name`, `phone_number` | No | Prefills the customer's details. Names are max 45 characters. |
| `country`, `address`, `city`, `state`, `zipcode` | No | Billing address (card payments). `country` is ISO-2. |
| `api_ref` | No | Your reference (letters, numbers, `-`, `_`, `:` and spaces, max 140 characters) |
| `unique_api_ref` | No | `true` returns the existing checkout for this `api_ref` instead of creating a new one |
| `redirect_url` | No | Where the customer goes after paying |
| `wallet_id` | No | Wallet to credit. Defaults to your settlement wallet for the currency. |
| `host` | No | Your site's URL. Defaults to the caller's IP address. |
| `channel` | No | Where the checkout comes from: `WEBSITE` (default), `WOOCOMMERCE`, `SHOPIFY`, `WORDPRESS`, `BUBBLE` or `MOBILE`. With `WOOCOMMERCE`, the result is also posted to `{host}/wc-api/intasend_webhook/`. With `SHOPIFY`, it is posted to the IntaSend Shopify app. |
| `is_mobile` | No | `true` when the checkout is opened from a mobile app |
| `mobile_tarrif`, `card_tarrif`, `bank_tarrif` | No | Who pays the M-Pesa/mobile money, card and PesaLink fees. See [Fees](https://developers.intasend.com/guides/collections/checkout/#fees). |
| `bitcoin_tarrif`, `pyusd_tarrif`, `ach_tarrif`, `transfi_tarrif` | No | Who pays the crypto (Bitcoin), PYUSD, ACH and TransFi fees: `BUSINESS-PAYS` (default) or `CUSTOMER-PAYS` |
| `public_key` | No | Your publishable key, if you can't send the `X-IntaSend-Public-API-Key` header |

`method` is ignored. The customer picks the method on the page.

## Fees

Each tariff field takes `BUSINESS-PAYS` (the fee is deducted from what you receive) or
`CUSTOMER-PAYS` (the fee is added to what the customer pays). See [Who pays the fees](https://developers.intasend.com/guides/collections/overview/#who-pays-the-fees).

> **Note**
For checkout, `mobile_tarrif`, `card_tarrif` and `bank_tarrif` currently follow the **default tariff**
in your dashboard's payment settings, and the values you send are overridden. To change who pays these fees on checkout, change that setting.

## Methods shown

The page shows the methods enabled on your account:

| Currency | Methods |
|---|---|
| KES | M-Pesa, card, Apple Pay, Google Pay, PesaLink, crypto |
| USD / EUR / GBP | Card, Apple Pay, Google Pay, crypto |
| UGX | MTN, Airtel |
| TZS | M-Pesa TZ, Tigo Pesa, Airtel, HaloPesa |

## Confirming payment

**Don't** treat a redirect to `redirect_url` as proof of payment. Instead, confirm with one of these:

- the `collection_event` [webhook](https://developers.intasend.com/guides/webhooks/) (recommended), or
- [payment status](https://developers.intasend.com/guides/collections/overview/#check-payment-status) using the invoice ID.
