staqlydocs
REST APIAPI referenceBilling

Check a promotion code

Check a promotion code (admin)

Every request sends Authorization: Bearer ...: the access token in local mode, an API key stk_... in cloud mode. Use Send to try it against your cloud instance with your API key.

POST
/v1/billing/promotion-code

Checks a promotion code made in Stripe (active, its coupon valid) and returns what it takes off and the plans it applies to, so a plan picker can show the discounted prices. 422 under promotion_code when the code is unknown, used up or fits no plan. Checkout checks the code again for the plan chosen.

Authorization

headerAuthorizationBearer <token>

API key (stk_...), or in the Community Edition the access token (stk_local_...)

Request Body

application/json
  1. body
promotion_code*string
Lengthlength <= 100

Response Body

The code's discount and plans

application/json
  1. response
code*string
percent_off?number

Percent taken off; absent for an amount off.

amount_off?integer

Amount taken off per invoice, in cents of currency; absent for a percent off.

currency?string
duration?string

How long the discount lasts.

Value in"once""repeating""forever"
duration_in_months?integer

Months the discount lasts when duration is repeating.

plans*array<string>

Ids of the plans the code applies to.

Example Request
curl -X POST 'https://staqly.example.com/v1/billing/promotion-code' \  -H 'Content-Type: application/json' \  -d '{  "promotion_code": "SPRING20"}'
Example Response
{  "code": "SPRING20",  "percent_off": 0,  "amount_off": 0,  "currency": "eur",  "duration": "once",  "duration_in_months": 0,  "plans": [    "plus",    "pro"  ]}