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

# Donation Mode

> Accept donations with preset amount buttons and custom input

Accept donations with preset amount buttons and custom input.

## Enable Donation Mode

Set `checkoutMode` to `"donation"` when creating a session.

> [!NOTE]
>
> **Tax Exempt:** Donation mode is automatically tax-exempt. No tax will be calculated or charged on donations—this is standard for charitable contributions.

```json theme={null}
{
  "merchantId": "your_merchant_id",
  "merchantName": "My Charity",
  "successUrl": "https://mycharity.org/thank-you",
  "cancelUrl": "https://mycharity.org/donate",
  "errorUrl": "https://mycharity.org/error",
  "checkoutMode": "donation",
  "donationConfig": {
    "presets": [10, 25, 50, 100],
    "defaultAmount": 25,
    "allowCustomAmount": true
  }
}
```

**Note:** You don't need to specify `amount` – the donor chooses the amount on the checkout page.

> [!WARNING]
>
> Donation mode cannot be combined with `items` array. The API will reject requests that include both `checkoutMode: "donation"` and an `items` array.

## Donation Config Options

| Field | Type | Default | Description |
| :- | :- | :- | :- |
| `presets` | array | — (UI shows `[5, 15, 25, 50]` if omitted) | Suggested donation amounts (buttons). Alias: `suggestedAmounts` |
| `defaultAmount` | number | — (first preset if omitted) | Pre-selected amount |
| `allowCustomAmount` | boolean | `true` | Allow donors to enter custom amount |
| `minAmount` | number | `1` | Minimum donation amount |
| `maxAmount` | number | `999999` | Maximum donation amount |

**Validation:**

* `presets` must be within the `minAmount`-`maxAmount` range
* `defaultAmount` must be within the `minAmount`-`maxAmount` range
* Custom input is limited to 9 characters

## Styling

Use the same `appearance` object as standard checkout (colors, fonts, radius, etc.); values apply via shared CSS variables on the page. See [Customize Appearance](https://docs.ozura.com/guides/payments/checkout/appearance.md).

## What the Donor Sees

1. Preset buttons for quick selection (e.g., $10, $25, $50, $100)
2. "Other" option to enter a custom amount (if enabled)
3. Standard payment form
4. "Donate" button

## Example: Simple Preset

```json theme={null}
{
  "checkoutMode": "donation",
  "donationConfig": {
    "presets": [5, 10, 25]
  }
}
```

Donor sees three buttons: $5, $10, \$25

## Example: Monthly Campaign

```json theme={null}
{
  "checkoutMode": "donation",
  "donationConfig": {
    "presets": [25, 50, 100, 250],
    "defaultAmount": 50,
    "allowCustomAmount": true
  }
}
```

Donor sees $25, $50 (pre-selected), $100, $250, and "Other" option.

## Example: With Min/Max Limits

```json theme={null}
{
  "checkoutMode": "donation",
  "donationConfig": {
    "presets": [10, 25, 50, 100],
    "minAmount": 5,
    "maxAmount": 10000,
    "allowCustomAmount": true
  }
}
```

* Donors can enter any custom amount between $5 and $10,000
* If they try to enter less than $5, they see: "Donation must be at least $5.00"
* If they try to enter more than $10,000, they see: "Donation cannot exceed $10,000.00"

## Combine with Payment Links

Create a shareable donation link via `POST /api/payment-links/create`:

```json theme={null}
{
  "merchantId": "your_merchant_id",
  "merchantName": "My Charity",
  "successUrl": "https://mycharity.org/thank-you",
  "cancelUrl": "https://mycharity.org/donate", 
  "errorUrl": "https://mycharity.org/error",
  "checkoutMode": "donation",
  "donationConfig": {
    "presets": [10, 25, 50, 100]
  }
}
```

Share the resulting `url` on social media, email campaigns, or your website. See [Payment Links](https://docs.ozura.com/guides/payments/checkout/payment-links.md) for full details.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.