Coupons
Reusable discounts on subscription invoices, applied by id or through a promotion code.
A coupon is a percentage or a fixed amount off a subscription's cycle invoices: for the next invoice (once), for a number of months (repeating) or for good (forever). Apply it to a subscription by id, or hand out promotion codes that redeem it. The subscription keeps a snapshot of the discount, so editing or retiring the coupon never changes a running discount. The discount is taken off the lines' total and VAT is computed on what the customer pays; see subscriptions.
The coupon object
cpn_.couponcurrency.amount_off.once, repeating or forever.repeating.false once retired. Running discounts keep going.Create a coupon
Body
amount_off.currency. Give this or percent_off.amount_off. Subscriptions in another currency cannot use the coupon.once, repeating or forever.repeating, refused otherwise.curl https://api.borga.is/v1/coupons \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{ "name": "Spring 20%", "percent_off": 20, "duration": "repeating", "duration_in_months": 3 }'Errors: invalid_field for both or neither of percent_off and amount_off, missing_field for currency or duration_in_months.
Retrieve a coupon
Update a coupon
The discount itself cannot change; create a new coupon and retire this one.
Body
false retires the coupon.