Webhooks
Coupon Webhooks
Detailed information about coupon webhook events including coupon.created and coupon.updated.
coupon.created
Note: The
coupon.createdwebhook event is planned for future release and is not yet available.
The coupon.created event will be triggered when a new coupon is created in the system.
Event Properties
| Property | Type | Description |
|---|---|---|
| id | string | The unique identifier of the coupon |
| code | string | The unique code used to redeem the coupon |
| name | string | The name of the coupon (maximum 255 characters) |
| description | string | The description of the coupon (maximum 500 characters) |
| state | string | The current state of the coupon |
| coupon_type | string | The type of coupon ("fixed_amount" or "percentage") |
| amount | decimal | The discount amount or percentage |
| started_at | string | The timestamp when the coupon becomes valid (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
| expired_at | string | The timestamp when the coupon expires (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
| redemption_limit | integer | The maximum number of times the coupon can be redeemed |
| applied_count | integer | The number of times the coupon has been applied |
| active | boolean | Whether the coupon is active |
| once_per_user | boolean | Whether the coupon can only be used once per user |
| single_product | boolean | Whether the coupon can only be applied to a single product |
| items | array | Specific items the coupon applies to |
| created_at | string | The timestamp when the coupon was created (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
| updated_at | string | The timestamp when the coupon was last updated (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
Example Payload
{
"type": "coupon.created",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440001",
"code": "SUMMER2023",
"name": "Summer Discount",
"description": "Special discount for summer courses",
"state": "active",
"coupon_type": "percentage",
"amount": 20.0,
"started_at": "2023-06-01T00:00:00Z",
"expired_at": "2023-08-31T23:59:59Z",
"redemption_limit": 100,
"applied_count": 0,
"active": true,
"once_per_user": true,
"single_product": false,
"items": ["course-123", "course-456"],
"created_at": "2023-05-15T14:30:00Z",
"updated_at": "2023-05-15T14:30:00Z"
}
}coupon.updated
Note: The
coupon.updatedwebhook event is planned for future release and is not yet available.
The coupon.updated event will be triggered when an existing coupon is updated in the system.
Event Properties
| Property | Type | Description |
|---|---|---|
| id | string | The unique identifier of the coupon |
| code | string | The updated code used to redeem the coupon |
| name | string | The updated name of the coupon (maximum 255 characters) |
| description | string | The updated description of the coupon (maximum 500 characters) |
| state | string | The current state of the coupon |
| coupon_type | string | The type of coupon ("fixed_amount" or "percentage") |
| amount | decimal | The updated discount amount or percentage |
| started_at | string | The updated timestamp when the coupon becomes valid (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
| expired_at | string | The updated timestamp when the coupon expires (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
| redemption_limit | integer | The updated maximum number of times the coupon can be redeemed |
| applied_count | integer | The current number of times the coupon has been applied |
| active | boolean | Whether the coupon is currently active |
| once_per_user | boolean | Whether the coupon can only be used once per user |
| single_product | boolean | Whether the coupon can only be applied to a single product |
| items | array | Updated specific items the coupon applies to |
| created_at | string | The timestamp when the coupon was created (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
| updated_at | string | The timestamp when the coupon was last updated (ISO 8601 format, e.g. "2023-12-04T18:45:44+08:00" or "2023-12-04T10:45:44Z") |
Example Payload
{
"type": "coupon.updated",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440001",
"code": "SUMMER2023EXTENDED",
"name": "Extended Summer Discount",
"description": "Extended special discount for summer courses",
"state": "active",
"coupon_type": "percentage",
"amount": 25.0,
"started_at": "2023-06-01T00:00:00Z",
"expired_at": "2023-09-30T23:59:59Z",
"redemption_limit": 200,
"applied_count": 45,
"active": true,
"once_per_user": true,
"single_product": false,
"items": ["course-123", "course-456", "course-789"],
"created_at": "2023-05-15T14:30:00Z",
"updated_at": "2023-07-01T09:15:00Z"
}
}