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 to specific plans.

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.

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

POST
/promo-codes

application/json

curl -X POST "https://commet.co/api/v1/promo-codes" \  -H "Content-Type: application/json" \  -d '{    "code": "string",    "discountType": "percentage",    "discountValue": 0  }'
code*string
Length1 <= length
discountType*string
Value in"percentage" | "amount"
discountValue*integer
Range0 < value
durationCycles?integer
Range0 < value
maxRedemptions?integer
Range0 < value
expiresAt?string
Formatdate-time
planIds?array<>

application/json

Promo code string

Discount amount (percentage 1-100 or amount in rate scale)

Number of billing cycles the discount applies

Maximum number of times the code can be redeemed

Expiration date (ISO 8601)

Restrict to specific plan IDs

Create a new promo code. Optionally restrict to specific plans.

{
  "success": true,
  "data": {
    "object": "promo_code",
    "livemode": true,
    "id": "string",
    "code": "string",
    "discountType": "percentage",
    "discountValue": 0,
    "durationCycles": 0,
    "maxRedemptions"





{
  "success": false,
  "error": {
    "type": "validation_error",
    "code": "string",
    "message": "string",
    "doc_url": "string",
    "param": "string"
  }
}
{
  "success": false,
  "error": {
    "type": "validation_error",
    "code": "string",
    "message": "string",
    "doc_url": "string",
    "param": "string"
  }
}
{
  "success": false,
  "error": {
    "type": "validation_error",
    "code": "string",
    "message": "string",
    "doc_url": "string",
    "param": "string"
  }
}
:
0
,
"expiresAt": "2019-08-24T14:15:22Z",
"active": true,
"redemptionCount": 0,
"createdAt": "2019-08-24T14:15:22Z"
}
}