Discount codes
Percent or fixed-amount promotion codes reduce the product price at checkout. Create codes in the dashboard or API, then let buyers enter them on payment links (when enabled) or pass a code when creating a checkout session.
Rules
- Percent codes are 1–100% off the product amount.
- Fixed codes subtract cents; the charged amount never drops below $0.50.
- Redemptions increment only after payment succeeds.
- Paused or deleted codes cannot be applied to new checkouts.
Create a discount code
Example request
POST /v1/discount_codes
Authorization: Bearer rk_live_...
Content-Type: application/json
{
"code": "SAVE20",
"type": "percent",
"value": 20,
"max_redemptions": 100
}Example response
{
"id": "disc_01H...",
"object": "discount_code",
"code": "SAVE20",
"type": "percent",
"value": 20
}How to handle it
Store code (uppercase) for marketing. Use id when deleting via API.
Apply at checkout
Example request
POST /v1/checkout_sessions
Authorization: Bearer rk_live_...
Content-Type: application/json
{
"price": "price_...",
"discount_code": "SAVE20",
"success_url": "https://example.com/thanks"
}Example response
{
"id": "cs_...",
"object": "checkout_session",
"amount": 3920,
"currency": "usd",
"status": "open",
"mode": "live",
"plan_type": "one_time",
"url": "https://rollopayments.com/pay/cs_...",
"expires_at": 1723014400000,
"livemode": true
}How to handle it
The returned amount already reflects the discount. Redirect to url as usual; fulfill on payment webhooks.
Delete a code
Example request
DELETE /v1/discount_codes/disc_01H... Authorization: Bearer rk_live_...
Example response
{
"id": "disc_01H...",
"deleted": true
}How to handle it
The code can no longer be applied. Existing open sessions that already locked in a discount are unaffected.
Payment links
Enable “Allow promotion codes” on a payment link so buyers see a code field. Without that flag, only API-created sessions can attach a discount via discount_code.