MagicWP Docs
Coupons

Verify / preview coupon

POST
/v1/coupons/verify

Permission: billing.manage

Authorization

apiToken
headerAuthorizationBearer <token>

An API token (mwp_…) from Settings → API tokens. Only accepted on this host.

Request Body

application/json
  1. body
code*Code

Coupon code to validate.

plan_id?|

If set, validates plan restriction and fills plan_price / discount_preview / final_price.

billing_cycle?Billing Cycle

"monthly" or "yearly" — used with plan_id to compute price preview.

Default"monthly"

Response Body

Successful Response

application/json
  1. response
success*boolean
data*

The result; on an error, details such as code and permission.

message*string
status_code*integer
timestamp*string
Formatdate-time
meta?|null
curl -X POST "https://example.com/v1/coupons/verify" \  -H "Content-Type: application/json" \  -d '{    "billing_cycle": "monthly",    "code": "FIRST50",    "plan_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"  }'
{  "message": "string",  "status_code": 0,  "timestamp": "2019-08-24T14:15:22Z",  "meta": {},  "success": true,  "data": {    "valid": true,    "code": "string",    "type": "string",    "value": "string",    "duration": "string",    "duration_months": null,    "applicable_plan_ids": null,    "billing_cycle": "both",    "discount_preview": null,    "plan_price": null,    "final_price": null,    "message": ""  }}