Assigns a coupon to an order, or unassigns it. Identify the coupon by Coupon_ID or Coupon_Code, and set Assigned to true or false.
Before you begin#
- The API token needs
OrderCoupon_Update_Assigned, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the order’s
Order_IDand the coupon’s ID or code.
Example requests#
Assign a coupon#
Assigns coupon SAVE10 to order 1.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "OrderCoupon_Update_Assigned",
"Order_ID": 1,
"Coupon_Code": "SAVE10",
"Assigned": true
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Order_ID |
Number | The ID of the order. | |
Coupon_ID |
Number | The ID of the coupon. | |
Coupon_Code |
String | The code of the coupon. | |
Assigned |
Boolean | Yes | Whether the coupon should be assigned to the order. |
Example response#
{
"success": 1
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
Boolean | Boolean value for if the request was successful. |
Related functions#
| Function | Use it to |
|---|---|
CouponList_Load_Query |
Find coupons and their codes |
Coupon_Insert |
Create a coupon |
OrderPriceGroup_Update_Assigned |
Assign a price group to an order |
OrderList_Load_Query |
Find the order |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Orders > OrderCoupon_Update_Assigned. See Set Up Postman.