Gift certificate definitions (Inventory API)
These events are emitted by the Inventory API when gift certificate definitions are created, updated, or deleted (POST/PUT/DELETE on /gift-certificate-definitions).
Events
| Action | Event name | Endpoint |
|---|---|---|
| Create a new gift certificate definition | giftcertificates.created |
POST /gift-certificate-definitions |
| Update an existing gift certificate definition | giftcertificates.updated |
PUT /gift-certificate-definitions/:giftcertificateId |
| Delete an existing gift certificate definition | giftcertificates.deleted |
DELETE /gift-certificate-definitions/:giftcertificateId |
Payload example – created
{
"attemptId": "16dd2aa7-f6ed-4e68-8e98-270365dd2523",
"created": 1623794091,
"data": {
"_id": "60c921a917bda93f5c896bf4",
"accountId": "52a377ec430c7d4e220001fc",
"createdAt": {
"offset": 0,
"value": "2021-06-15T21:54:49.506Z"
},
"currencyCode": "",
"deleted": false,
"description": "TEst",
"disabled": false,
"image": "",
"name": "Test",
"price": 301000,
"savings": 33000,
"taxable": false,
"updatedAt": {
"offset": 0,
"value": "2021-06-15T21:54:49.510Z"
},
"userId": "55fc2f318791db6e1a0000b6",
"value": 401000
},
"event": "giftcertificates.created",
"id": "1c38da11-2e46-4d8a-bd4f-4e005673b3fd",
"livemode": true
}
Field descriptions – data (created / updated)
| Field | Type | Description |
|---|---|---|
| _id | string | Gift certificate definition id (24 hex characters). |
| accountId | string | Account id. |
| userId | string | User id. |
| name | string | Internal reference only. |
| description | string | Sales pitch shown in the sales flow. |
| price | number | Price. |
| value | number | Value. |
| savings | number | Savings. |
| marketingImage | string | Marketing image. |
| marketingText | string | Marketing text. |
| disabled | boolean | Whether the definition is disabled. |
| taxable | boolean | Whether the certificate is taxable. |
| currencyCode | string | Currency code. |
| availableChannels | object | Channels the product is available for (e.g. websales, backoffice, agency-websales, agency-backoffice). |
| createdBy | string | User id that created the resource. |
| updatedBy | string | User id that last updated the resource. |
| createdAt | object | BzDate – creation date. |
| updatedAt | object | BzDate – last update date. |
Payload example – updated
{
"attemptId": "fe0b9466-f545-488f-8a03-bbfbf12df652",
"created": 1623793883,
"data": {
"_id": "5f3e98216501256cff449715",
"accountId": "52a377ec430c7d4e220001fc",
"createdAt": {
"offset": 0,
"value": "2020-08-20T15:34:57.193Z"
},
"currencyCode": "",
"deleted": false,
"description": "new gift",
"disabled": false,
"image": "",
"name": "new gift",
"price": 5000000,
"savings": 50000,
"taxable": false,
"updatedAt": {
"offset": 0,
"value": "2021-06-15T21:50:40.749Z"
},
"userId": "55fc2f318791db6e1a0000b6",
"value": 7500000
},
"event": "giftcertificates.updated",
"id": "23a37788-7936-43d7-aafa-82714ddc99d6",
"livemode": false
}
(Field descriptions for data are the same as for created.)
Payload example – deleted
The data object for giftcertificates.deleted contains only the id of the deleted definition.
{
"attemptId": "401b9daf-9afe-4c21-98a6-b47970e7e947",
"created": 1623794095,
"data": {
"giftcertificateId": "60c921a917bda93f5c896bf4"
},
"event": "giftcertificates.deleted",
"id": "c4c2b2ed-d6d4-4f8c-ae7b-bace455b11f8",
"livemode": true
}
Field descriptions – data (deleted)
| Field | Type | Description |
|---|---|---|
| giftcertificateId | string | Id of the deleted gift certificate definition (24 hex characters). |