> 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 # CreateGiftCardProduct # Package: giftCards # Namespace: GiftCardProductService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/create-gift-card-product.md ## Permission Scopes: Manage eCommerce - all permissions: SCOPE.DC-ECOM-MEGA.MANAGE-ECOM ## Introduction Creates a gift card product. A site currently supports a maximum of 1 gift card product. This is a temporary limitation that will be removed in a future release. To replace the existing product, call [Delete Gift Card Product](https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/delete-gift-card-product.md) first, or use [Update Gift Card Product](https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/update-gift-card-product.md) to modify it in place. --- ## REST API ### Schema ``` Method: createGiftCardProduct Description: Creates a gift card product. A site currently supports a maximum of 1 gift card product. This is a temporary limitation that will be removed in a future release. To replace the existing product, call [Delete Gift Card Product](https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/delete-gift-card-product.md) first, or use [Update Gift Card Product](https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/update-gift-card-product.md) to modify it in place. URL: https://www.wixapis.com/gift-cards/v1/gift-card-products Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: giftCardProduct, giftCardProduct.name, giftCardProduct.presetVariants.price, giftCardProduct.presetVariants.price.amount Method parameters: param name: giftCardProduct | type: GiftCardProduct | description: A gift card product is a template that defines what a purchasable gift card looks like, including its name, description, image, available denominations, and expiration policy. When a customer buys a gift card, an individual gift card instance is created based on the product's configuration. | required: true - ONE-OF: - required: true - 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: name | type: string | description: Gift card product name. | required: true - 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: altText | type: string | description: Image alt text. - 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: 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: 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). Return type: CreateGiftCardProductResponse - name: giftCardProduct | type: GiftCardProduct | description: Created gift card product. - 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). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CANNOT_CREATE_GIFT_CARD_PRODUCT_WITH_INVALID_CUSTOM_AMOUNTS_RANGE | Description: The custom variant's `minValue` must be less than `maxValue`. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: GIFT_CARD_PRODUCT_ALREADY_EXISTS | Description: A gift card product already exists on this site. A site currently supports a maximum of 1 gift card product. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CANNOT_CREATE_GIFT_CARD_PRODUCT_WITH_PAST_EXPIRATION_DATE | Description: The `fixedExpirationDate` can't be in the past. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CANNOT_CREATE_GIFT_CARD_PRODUCT_WITHOUT_VARIANTS | Description: The gift card product must have at least one preset variant or a custom variant. ``` ### Examples ### Create Gift Card Product Creates a gift card product with basic info. ```curl curl -X POST \ 'https://www.wixapis.com/gift-cards/v1/gift-card-products' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "giftCardProduct": { "name": "eGift Card", "description": "You cannot go wrong with a gift card. Choose an amount and write a personalized message to make this gift your own.", "expirationType": "RELATIVE", "relativeExpirationDate": { "value": 10, "period": "MONTHS" }, "image": { "id": "e90a2a_c3de803545f340df9dd4aa88a72e0718~mv2.png", "url": "https://static.wixstatic.com/media/e90a2a_c3de803545f340df9dd4aa88a72e0718~mv2.png", "height": 600, "width": 600 }, "presetVariants": [ { "price": { "amount": "50" }, "value": { "amount": "50" } }, { "price": { "amount": "100" }, "value": { "amount": "100" } }, { "price": { "amount": "150" }, "value": { "amount": "150" } }, { "price": { "amount": "200" }, "value": { "amount": "200" } } ], "customVariant": { "minValue": { "amount": "10" }, "maxValue": { "amount": "100" } } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.giftCards.GiftCardProductService.createGiftCardProduct(giftCardProduct) Description: Creates a gift card product. A site currently supports a maximum of 1 gift card product. This is a temporary limitation that will be removed in a future release. To replace the existing product, call [Delete Gift Card Product](https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/delete-gift-card-product.md) first, or use [Update Gift Card Product](https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/update-gift-card-product.md) to modify it in place. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: giftCardProduct, giftCardProduct.name, giftCardProduct.presetVariants.price, giftCardProduct.presetVariants.price.amount Method parameters: param name: giftCardProduct | type: GiftCardProduct | description: A gift card product is a template that defines what a purchasable gift card looks like, including its name, description, image, available denominations, and expiration policy. When a customer buys a gift card, an individual gift card instance is created based on the product's configuration. | required: true - ONE-OF: - required: true - 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: name | type: string | description: Gift card product name. | required: true - 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: 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: 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). Return type: PROMISE - 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). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CANNOT_CREATE_GIFT_CARD_PRODUCT_WITH_INVALID_CUSTOM_AMOUNTS_RANGE | Description: The custom variant's `minValue` must be less than `maxValue`. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: GIFT_CARD_PRODUCT_ALREADY_EXISTS | Description: A gift card product already exists on this site. A site currently supports a maximum of 1 gift card product. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CANNOT_CREATE_GIFT_CARD_PRODUCT_WITH_PAST_EXPIRATION_DATE | Description: The `fixedExpirationDate` can't be in the past. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CANNOT_CREATE_GIFT_CARD_PRODUCT_WITHOUT_VARIANTS | Description: The gift card product must have at least one preset variant or a custom variant. ``` ### Examples ### createGiftCardProduct ```javascript import { giftVoucherProducts } from '@wix/gift-vouchers'; async function createGiftCardProduct(giftCardProduct) { const response = await giftVoucherProducts.createGiftCardProduct(giftCardProduct); }; ``` ### createGiftCardProduct (with elevated permissions) ```javascript import { giftVoucherProducts } from '@wix/gift-vouchers'; import { auth } from '@wix/essentials'; async function myCreateGiftCardProductMethod(giftCardProduct) { const elevatedCreateGiftCardProduct = auth.elevate(giftVoucherProducts.createGiftCardProduct); const response = await elevatedCreateGiftCardProduct(giftCardProduct); } ``` ### createGiftCardProduct (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { giftVoucherProducts } from '@wix/gift-vouchers'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { giftVoucherProducts }, // Include the auth strategy and host as relevant }); async function createGiftCardProduct(giftCardProduct) { const response = await myWixClient.giftVoucherProducts.createGiftCardProduct(giftCardProduct); }; ``` ---