Coupon_Insert
#
Description#
This function allows you to insert a coupon and assign it to a price group.
Request Body Parameters#
Parameter |
Type | Description |
---|---|---|
Code |
Number | Coupon Code customers enter during checkout. |
Description |
String | Description of the coupon. |
CustomerScope |
Number | Scope of customers: “A” (all shoppers), “X” (specific customers), or “L” (all logged-in shoppers). |
DateTime_Start |
Unix Timestamp | Start time of the coupon. Use 0 if no start time. |
DateTime_End |
Unix Timestamp | End time of the coupon. Use 0 if no end time. |
Max_Use |
Number | Maximum times the coupon can be used. Use 0 for unlimited use. |
Max_Per |
Number | Maximum times the coupon can be used per customer. Use 0 for unlimited use. |
Active |
Boolean | Indicates if the coupon is active. |
PriceGroup_ID |
Number | ID of the price group to which the coupon is assigned. |
Response Parameters#
Parameter |
Type | Description |
---|---|---|
success |
Boolean | Indicates if the request was successful. |
id |
Number | ID of the created coupon. |
Example Request#
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "Coupon_Insert",
"Code": "20OFF",
"Description": "20 Percent Off",
"CustomerScope": "A",
"DateTime_Start": 0,
"DateTime_End": 0,
"Max_Use": 0,
"Max_Per": 0,
"Active": true,
"PriceGroup_ID": 2
}
Example Response#
{
"success": 1,
"data": {
"id": 21
}
}
Error Responses#
Error Code | Error Message | Error Description |
---|---|---|
MER-JSN-00023 | One or more parameters are invalid | One of the required fields is missing. |