> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Package: giftCards # Namespace: giftCardProducts # Webhook link: https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/gift-card-product-created.md ## Introduction Triggered when a gift card product is created. --- ## REST API ### Schema ``` Webhook: Gift Card Product Created Description: Triggered when a gift card product is created. Event body: - name: id | type: string | description: Unique event ID. Allows clients to ignore duplicate events. - name: entityFqdn | type: string | description: Fully qualified domain name of the entity associated with the event. - name: slug | type: string | description: Event name. - name: entityId | type: string | description: ID of the entity associated with the event. - name: eventTime | type: string (date-time) | description: Event timestamp. - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application such as GDPR. - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event. - name: createdEvent | type: object | description: Created event details. - name: entity | type: GiftCardProduct | description: The created entity. - ONE-OF: - name: fixedExpirationDate | type: string | description: Fixed expiration date for all gift cards created from this product. - name: relativeExpirationDate | type: RelativeExpirationDate | description: Expiration period relative to the date of purchase. - name: value | type: integer | description: Number of time periods until expiration. For example, a `value` of `6` with a `period` of `MONTHS` means the gift card expires 6 months after purchase. - name: period | type: TimePeriod | description: Unit of time for the expiration period. - enum: DAYS, WEEKS, MONTHS, YEARS - name: id | type: string | description: Gift card product GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the gift card product is updated. To prevent conflicting changes, the current revision must be passed when updating the gift card product. Ignored when creating a gift card product. - name: createdDate | type: string | description: Date and time the gift card product was created. - name: updatedDate | type: string | description: Date and time the gift card product was last updated. - name: name | type: string | description: Gift card product name. - name: description | type: string | description: Gift card product description. - name: image | type: Image | description: Gift card product image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager. When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: WixMedia image GUID. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: expirationType | type: ExpirationType | description: Expiration type for gift cards created from this product. - enum: - NONE: Gift cards created from this product don't expire. - FIXED: Gift cards expire on a specific date. - RELATIVE: Gift cards expire after a set period from the date of purchase. - name: presetVariants | type: array | description: List of preset variants with predefined denominations that buyers can choose from. A product can have both preset variants and a custom variant. When updating, the entire list is replaced. There's no way to update an individual preset variant. - name: id | type: string | description: Preset variant GUID. - name: price | type: MultiCurrencyPrice | description: Price the buyer pays for the gift card. The currency is the site's default currency. - name: amount | type: string | description: Amount. - name: convertedAmount | type: string | description: Converted amount. - name: formattedAmount | type: string | description: Amount formatted with currency symbol. - name: formattedConvertedAmount | type: string | description: Converted amount formatted with currency symbol. - name: value | type: MultiCurrencyPrice | description: Balance loaded onto the gift card. Can differ from `price` to support promotional pricing. For example, a gift card with a `value` of $50 could have a `price` of $45. - name: image | type: Image | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager. When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`. - name: customVariant | type: CustomVariant | description: Custom variant that allows buyers to choose their own gift card amount within a defined range. A product can have both preset variants and a custom variant. - name: minValue | type: MultiCurrencyPrice | description: Minimum gift card amount a buyer can choose. The currency is the site's default currency. - name: maxValue | type: MultiCurrencyPrice | description: Maximum gift card amount a buyer can choose. The currency is the site's default currency. - name: image | type: Image | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager. When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`. - name: extendedFields | type: ExtendedFields | description: Custom field data for the gift card product object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). ``` ### Examples ```curl { "id": "a3ef3e5d-a004-4dff-b27c-2b7dcff9377a", "entityFqdn": "wix.gift_cards.v1.gift_card_product", "slug": "created", "entityId": "6a26e172-8734-4600-8a25-649b789aa52d", "createdEvent": { "entityAsJson": { "id": "6a26e172-8734-4600-8a25-649b789aa52d", "revision": "1", "createdDate": "2024-11-12T12:59:57.522Z", "updatedDate": "2024-11-12T12:59:57.522Z", "name": "eGift Card", "description": "You can't go wrong with a gift card. Choose an amount and write a personalized message to make this gift your own.", "image": { "id": "e90a2a_c3de803545f340df9dd4aa88a72e0718~mv2.png", "url": "https://static.wixstatic.com/media/e90a2a_c3de803545f340df9dd4aa88a72e0718~mv2.png", "height": 600, "width": 600 }, "expirationType": "UNKNOWN_EXPIRATION_TYPE", "presetVariants": [ { "id": "85054341-352e-4d2f-8b7b-526a081f6c6f", "price": { "amount": "25", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" }, "value": { "amount": "25", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" } }, { "id": "cea8352c-06a0-4e67-8f44-08f64596d6f3", "price": { "amount": "50", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" }, "value": { "amount": "50", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" } }, { "id": "905c38ca-c224-40dc-a3ca-94fb22f1ece2", "price": { "amount": "100", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" }, "value": { "amount": "100", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" } }, { "id": "8801bec2-46d5-4aca-83b1-394544261b95", "price": { "amount": "150", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" }, "value": { "amount": "150", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" } }, { "id": "a0c4ba35-d366-4a37-9f85-b264c7ceed26", "price": { "amount": "200", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" }, "value": { "amount": "200", "convertedAmount": "", "formattedAmount": "", "formattedConvertedAmount": "" } } ] } }, "eventTime": "2024-11-12T12:59:57.529933592Z", "triggeredByAnonymizeRequest": false, "entityEventSequence": "1" } ``` --- ## JavaScript SDK ### Schema ``` Webhook: onGiftCardProductCreated Description: Triggered when a gift card product is created. Payload: GiftCardProductCreatedEnvelope - name: entity | type: GiftCardProduct | description: none - ONE-OF: - name: fixedExpirationDate | type: Date | description: Fixed expiration date for all gift cards created from this product. - name: relativeExpirationDate | type: RelativeExpirationDate | description: Expiration period relative to the date of purchase. - name: value | type: integer | description: Number of time periods until expiration. For example, a `value` of `6` with a `period` of `MONTHS` means the gift card expires 6 months after purchase. - name: period | type: TimePeriod | description: Unit of time for the expiration period. - enum: DAYS, WEEKS, MONTHS, YEARS - name: _id | type: string | description: Gift card product GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the gift card product is updated. To prevent conflicting changes, the current revision must be passed when updating the gift card product. Ignored when creating a gift card product. - name: _createdDate | type: Date | description: Date and time the gift card product was created. - name: _updatedDate | type: Date | description: Date and time the gift card product was last updated. - name: name | type: string | description: Gift card product name. - name: description | type: string | description: Gift card product description. - name: image | type: string | description: Gift card product image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager. When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`. - name: expirationType | type: ExpirationType | description: Expiration type for gift cards created from this product. - enum: - NONE: Gift cards created from this product don't expire. - FIXED: Gift cards expire on a specific date. - RELATIVE: Gift cards expire after a set period from the date of purchase. - name: presetVariants | type: array | description: List of preset variants with predefined denominations that buyers can choose from. A product can have both preset variants and a custom variant. When updating, the entire list is replaced. There's no way to update an individual preset variant. - name: _id | type: string | description: Preset variant GUID. - name: price | type: MultiCurrencyPrice | description: Price the buyer pays for the gift card. The currency is the site's default currency. - name: amount | type: string | description: Amount. - name: convertedAmount | type: string | description: Converted amount. - name: formattedAmount | type: string | description: Amount formatted with currency symbol. - name: formattedConvertedAmount | type: string | description: Converted amount formatted with currency symbol. - name: value | type: MultiCurrencyPrice | description: Balance loaded onto the gift card. Can differ from `price` to support promotional pricing. For example, a gift card with a `value` of $50 could have a `price` of $45. - name: image | type: string | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager. When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`. - name: customVariant | type: CustomVariant | description: Custom variant that allows buyers to choose their own gift card amount within a defined range. A product can have both preset variants and a custom variant. - name: minValue | type: MultiCurrencyPrice | description: Minimum gift card amount a buyer can choose. The currency is the site's default currency. - name: maxValue | type: MultiCurrencyPrice | description: Maximum gift card amount a buyer can choose. The currency is the site's default currency. - name: image | type: string | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager. When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`. - name: extendedFields | type: ExtendedFields | description: Custom field data for the gift card product object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: metadata | type: EventMetadata | description: none - name: instanceId | type: string | description: App instance GUID. - name: eventType | type: string | description: Event type. - name: identity | type: IdentificationData | description: The identification type and identity data. - ONE-OF: - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site. - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site. - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.). - name: appId | type: string | description: GUID of an app. - name: identityType | type: WebhookIdentityType | description: - enum: UNKNOWN, ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP - name: accountInfo | type: AccountInfo | description: Details related to the account - name: accountId | type: string | description: GUID of the Wix account associated with the event. - name: parentAccountId | type: string | description: GUID of the parent Wix account. Only included when accountId belongs to a child account. - name: siteId | type: string | description: GUID of the Wix site associated with the event. Only included when the event is tied to a specific site. - name: _id | type: string | description: Event GUID. With this GUID you can easily spot duplicated events and ignore them. - name: entityFqdn | type: string | description: Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. - name: slug | type: string | description: Event action name, placed at the top level to make it easier for users to dispatch messages. For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`. - name: entityId | type: string | description: GUID of the entity associated with the event. - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR). - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event. - name: entityEventSequence | type: string | description: A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number. You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. ``` ### Examples ```javascript import { giftVoucherProducts } from '@wix/gift-vouchers'; giftVoucherProducts.onGiftCardProductCreated((event) => { // handle your event here }); ``` ```javascript import { createClient, AppStrategy } from '@wix/sdk'; import { giftVoucherProducts } from '@wix/gift-vouchers'; const wixClient = createClient({ auth: AppStrategy({ appId: 'MY-APP-ID', publicKey: 'YOUR_APP_PUBLIC_KEY', }), modules: { giftVoucherProducts, }, }); wixClient.giftVoucherProducts.onGiftCardProductCreated((event) => { // handle your event here }); ``` ---