Create Rule Promotion Codes
POST/v2/rule-promotions/:promotionID/codes
Creates new promotion codes for a specific rule promotion, allowing customers to redeem discounts based on predefined conditions.
- Supports bulk creation of multiple promotion codes in a single request.
- Each code can have individual usage limits.
- Can optionally assign codes to specific users to enforce targeted promotions.
- The promotion codes are case-insensitive.
Regarding first time shopper limitations:
- Orders without payment transactions do not count as completed purchases.
- Canceling or refunding an order does not reinstate first-time shopper status.
- A first-time shopper coupon code cannot have limited uses or be assigned to specific users, meaning the code cannot be restricted by the number of times it can be used or tied to a specific customer ID.
A successful request returns a 201 Created
response with details of the generated promotion codes.
Duplicate Codes
Duplicate promotion codes are supported across different promotions in the store, regardless of their statuses and validity dates. However, duplicate codes cannot be created within the same promotion. This means that shoppers can apply a single coupon code to trigger multiple promotions if those promotions share common coupon codes.
Codes that share the same name can serve different purposes. For example, one code may have per_application
with a limited number of uses, while another identical code can have per_checkout
with unlimited use.
Duplicate Code Handling:
- If a duplicate code is detected within the same promotion, the request will return a
422 Duplicate code
error. - When creating duplicate codes, a message appears with the successful response indicating the duplication.
Please refer to the OpenAPI examples section on this page for sample request structures.
Request
Responses
- 201
- 400
- 422
Created
Bad Request
Unprocessable Entity