POST: /wp-json/coupons/v1/virtualcoupons/
Requirements:
user role with manage_woocommerce
user capability
Create virtual coupon
POST: http://example.com/wp-json/coupons/v1/virtualcoupons/
JSON Body:
{
"coupon_id": 207
}
Create virtual coupon with date expire
POST: http://example.com/wp-json/coupons/v1/virtualcoupons/
JSON Body:
{
"coupon_id": 207,
"date_expire": "January 1, 2022 10:00 am",
"date_format": "F j, Y g:i a"
}
Status: 200 OK
Create Virtual Coupon
{
"message": "Successfully created virtual coupon.",
"data": {
"key": "467",
"id": 467,
"code": "S4WXTUG8DT",
"main_code": "bogo1",
"coupon_code": "bogo1-s4wxtug8dt",
"status": "pending",
"coupon_id": 207,
"user_id": 0,
"user_fullname": "",
"user_email": "",
"date_created": "2021-06-28 13:48:20",
"date_expire": ""
}
}
Create virtual coupon with date expire
{
"message": "Successfully created virtual coupon.",
"data": {
"key": "468",
"id": 468,
"code": "QVJS2UYQFQ",
"main_code": "bogo1",
"coupon_code": "bogo1-qvjs2uyqfq",
"status": "pending",
"coupon_id": 207,
"user_id": 0,
"user_fullname": "",
"user_email": "",
"date_created": "June 28, 2021 1:50 pm",
"date_expire": "January 1, 2022 10:00 am"
}
}
Status: 403 Forbidden
{
"code": "rest_forbidden_context",
"message": "Sorry, you are not allowed access to this endpoint.",
"data": {
"status": 401
}
}