Create a discount code
create_couponCreates a coupon (percent or fixed amount) with optional expiry, usage limits and category restriction. Preview first, then confirm. Always show the preview to the user and get their explicit approval before calling again with confirm=true and the preview_id. Paid plans only. To apply it later instead of now, call with confirm=true, the preview_id AND apply_at (the store's local time, YYYY-MM-DDTHH:MM).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| store | No | Store address or id. Leave empty if you have only one store. | |
| amount | No | ||
| confirm | No | Set true ONLY after the user approved the preview. | |
| expires | No | Last valid day, YYYY-MM-DD (valid until the end of that day). | |
| apply_at | No | Only with confirm=true: apply later. Store local time, YYYY-MM-DDTHH:MM, between 5 minutes and 90 days from now. | |
| preview_id | No | The preview_id returned by the preview call (required with confirm=true). | |
| usage_limit | No | ||
| discount_type | No | ||
| minimum_amount | No | ||
| usage_limit_per_user | No |