post https://{subdomain}.myshoplaza.com/openapi/2022-01/coupons/receive
Requires
price_rulesaccess scope. More access scope
The Receive Coupons API enables assigning specific coupons to a customer.
This API is especially useful for:
- Distributing promotional coupons to targeted customers.
- Managing coupon assignments for specific users.
- Automating coupon distribution in bulk.
Request Parameters
Public Request Parameters
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | Yes | Customer's unique ID to assign the coupons. |
coupon_ids | array of strings | Yes | Array of coupon IDs to be assigned to the customer. |
Response Explanation
Public Response Parameters
Success Response
| Field | Type | Description |
|---|---|---|
status | int | Operation status code. |
items | array | List of assigned coupons and their details. |
items.id | string | The ID of the assigned coupon. |
items.status | Deprecated: Internal field for coupon status. Use progress instead. | |
items.value | float | The value of the coupon. |
items.stock | int | The available stock of the coupon. |
items.coupon_status | int | The current status of the coupon. |
items.received_count | int | The count of times the coupon has been received. |
items.discount_text | string | Description of the discount applied by the coupon. |
items.prerequisite_text | string | Any prerequisite details for using the coupon. |
items.is_first_order | bool | Indicates if the coupon is for first orders only. |
limit | int | The maximum number of coupons that can be received. |
has_more | bool | Indicates if there are more coupons to receive. |
cursor | string | Cursor for pagination. |
Error Response
Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
| Field | Type | Example | Description |
|---|---|---|---|
errors | Array | [ "invalid line_item id"] | A list of errors encountered during the request processing. |
| Field | Type | Example | Description |
|---|---|---|---|
error | String | "store is not active" | Indicates an error encountered during the process |
Error Detail
| Status Code | Message | Possible Reason | Example Response |
|---|---|---|---|
| 400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
| Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized | |
| 404 | Not Found | The Customer's ID provided is not existed. | customer not exist |
| 422 | CouponIds is required | Empty Coupon Id | CouponIds is required |
