Create a Promotion
POST
/api/promotions
deprecated
Requires: Promotions.Promotions, Promotions.Promotions.Create, merchant scope.
Create a new Promotion
Signed in, you can send this request to your own sandbox merchant from the console and read the answer. Sign in to try it.
Example request
Every block below sends the same request. Replace {{BASE_URL}} with the address of the API you are calling and {{API_KEY}} with your own key.
The request body is a CreatePromotionDto. See the Request body section below for its fields.
Parameters
Request body
application/json
, required
| Field | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
merchantId
required |
string (uuid) | The merchant that owns this promotion. Required on create, and immutable afterwards: an update
that names a different merchant is refused rather than silently moving the promotion and the
ledger entries that point at it.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
code
required |
string | The code a payer types. Stored trimmed and upper-cased, and unique among the merchant's
promotions, so `save10` and `SAVE10` are the same code rather than two.
Conditional: When Code is not empty.
nullablemax length 64
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
name
required |
string | Operator-facing promotion name. Never shown to payers.
nullablemax length 128
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
description
required |
string | Free-text description of the promotion.
nullablemax length 1024
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
discountType
required |
PromotionDiscountType PromotionDiscountType | Whether the value is a percentage or a flat amount.
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
value
required |
number (double) | The percentage, or the flat amount in `currency`.
Conditional: When DiscountType == Percent. Must be <= 100.
Conditional: When DiscountType == Flat. Must be <= 1000000.
greater than 0
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
currency
required |
string | The ISO 4217 currency. Required for a flat amount, and optional for a percentage, where it
narrows the promotion to one currency rather than denominating anything.
Required: When DiscountType == Flat.
Conditional: When Currency is not empty. Length: 3 to 3.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
startsAtUtc
required |
string (date-time) | UTC moment the promotion starts being accepted. `null` starts it immediately.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
endsAtUtc
required |
string (date-time) | UTC moment the promotion stops being accepted. `null` leaves it open.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
maxRedemptions
required |
integer (int32) | How many times the promotion may be redeemed in total. `null` for no ceiling.
Conditional: When MaxRedemptions is not null. Must be > 0.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
maxRedemptionsPerCustomer
required |
integer (int32) | How many times one customer may redeem it. `null` for no ceiling. A promotion that
carries one refuses a redemption that identifies no customer.
Conditional: When MaxRedemptionsPerCustomer is not null. Must be > 0.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
minimumSubtotal
required |
number (double) | The smallest amount the promotion applies to. `null` for no floor.
Conditional: When MinimumSubtotal is not null. Must be >= 0.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
appliesToScope
required |
PromotionAppliesToScope PromotionAppliesToScope | What the promotion may be applied to.
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
appliesToTargetIds
required |
array of string (uuid) array of | The pages, products or plans the scope names. Required by every scope except
`Any`, which ignores it.
Conditional: When AppliesToScope != Any.
Conditional: When AppliesToTargetIds is not null.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
durationMode
required |
PromotionDurationMode PromotionDurationMode | How long the discount runs on a recurring charge.
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
durationCycles
required |
integer (int32) | How many billing cycles the discount runs for. Required by
`Cycles`, and ignored by every other mode.
Required: When DurationMode == Cycles.
nullable
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
| ||||||||
isActive
required |
boolean | Whether the promotion is accepted. A deactivated promotion keeps its ledger.
Values:
Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
|
This request body has no documented fields.
Responses
Errors
A failed request returns the platform error envelope. The
error reference lists every value
error.code can carry and shows the four response shapes.
Authentication
ApiKeywith scopes