v1

latestOpenAPI 3.1.02026-07-24170121.2 MB

Create a Coupon

This API creates coupons that can be used to avail discounts on the invoice.

post/v1/discounts

Headers

Acceptstring required

Indicates which content types, expressed as MIME types, the client is able to understand.

Content-Typestring

Indicates the media type of the resource sent in the HTTP message body. <br /><br /><b>Possible Values:</b><br /> application/json<br />application/x-www-form-urlencoded

Request body

duration'once' | 'repeating' | 'forever' required

The duration for which the subscription invoices are discounted from the time a coupon is redeemed or applied.

namestring required

Name of the coupon.

amount_offinteger

A number that represents the amount to be subtracted from an invoice total.

percent_offinteger

A number that represents the discount that will be applied when a coupon is used.

discount_idstring

An ID that refers to a coupon when applying to a customer's subscription.

currencystring

Three-letter ISO currency code, in lowercase.

duration_in_monthsinteger

The duration for which the subscription invoices are discounted from the time a coupon is redeemed or applied.

max_redemptionsinteger

Maximum number of times a coupon can be used on subscriptions.

redeem_bystring

Timestamp specifying the last time at which the coupon can be redeemed. After the 'redeem_by date', the coupon can no longer be applied to new subscriptions.

Response

201

Example response

{
  "data": {
    "object": "Discount",
    "discount_id": "dc_ae9c7bd1",
    "amount_off": 10,
    "duration": "once",
    "status": "active",
    "name": "testers",
    "created_at": 1724584416,
    "updated_at": 1724584416,
    "id": "jDg5AYgjzgjYMWlz"
  }
}