Accept donations with preset amount buttons and custom input.
Enable Donation Mode
Set checkoutMode to "donation" when creating a session.
Tax Exempt: Donation mode is automatically tax-exempt. No tax will be calculated or charged on donations—this is standard for charitable contributions.
{
"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.
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 | [5, 15, 25, 50] | Suggested donation amounts (buttons) |
defaultAmount | number | First preset | 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
What the Donor Sees
- Preset buttons for quick selection (e.g., 10,25, 50,100)
- “Other” option to enter a custom amount (if enabled)
- Standard payment form
- “Donate” button
Example: Simple Preset
{
"checkoutMode": "donation",
"donationConfig": {
"presets": [5, 10, 25]
}
}
Donor sees three buttons: 5,10, $25
Example: Monthly Campaign
{
"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
{
"checkoutMode": "donation",
"donationConfig": {
"presets": [10, 25, 50, 100],
"minAmount": 5,
"maxAmount": 10000,
"allowCustomAmount": true
}
}
- Donors can enter any custom amount between 5and10,000
- If they try to enter less than 5,theysee:"Donationmustbeatleast5.00”
- If they try to enter more than 10,000,theysee:"Donationcannotexceed10,000.00”
Combine with Payment Links
Create a shareable donation link via POST /api/payment-links/create:
{
"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 for full details.