Commet
  • Precios
Iniciar SesiónRegistrarse
Create promo code POSTGet promo code GETList promo codes GETUpdate promo code PUT
DocumentaciónRecursosConstruir con AIAPI ReferenceWebhooks

Create promo code

Create a new promo code. Optionally restrict it to specific plans and a billing interval. **100% discounts are not supported.** Percentage codes must be strictly less than 100% (`discountValue` < 10000 basis points). For full waivers, use an introductory offer on the plan instead. At checkout, any code — percentage or fixed amount — that would reduce the total below the currency's minimum charge ($0.50 USD equivalent) is silently dropped.

POST
/promo-codes

Create a new promo code. Optionally restrict it to specific plans and a billing interval.

100% discounts are not supported. Percentage codes must be strictly less than 100% (discountValue < 10000 basis points). For full waivers, use an introductory offer on the plan instead. At checkout, any code — percentage or fixed amount — that would reduce the total below the currency's minimum charge ($0.50 USD equivalent) is silently dropped.

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

code*string
Length1 <= length
discountType*string

Value in

  • "percentage"
  • "amount"
discountValue*integer
Range0 < value <= 9007199254740991
durationCycles?integer
Range0 < value <= 9007199254740991
billingInterval?|null
maxRedemptions?integer
Range0 < value <= 9007199254740991
expiresAt?string
Formatdate-time
planIds?array<string>

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/promo-codes" \  -H "Content-Type: application/json" \  -d '{    "code": "string",    "discountType": "percentage",    "discountValue": 1  }'
{  "success": true,  "data": {    "id": "string",    "code": "string",    "discountType": "percentage",    "discountValue": -9007199254740991,    "durationCycles": -9007199254740991,    "billingInterval": "weekly",    "maxRedemptions": -9007199254740991,    "expiresAt": "2019-08-24T14:15:22Z",    "isActive": true,    "redemptionCount": -9007199254740991,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "object": "promo_code",    "livemode": true  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}

Request portal access POST

Generate a customer portal URL. Exactly one identifier (email or customerId) is required.

Get promo code GET

Retrieve a promo code by its public ID.