> 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 # CreatePackageV2 # Package: resellers # Namespace: Packages # Method link: https://dev.wix.com/docs/api-reference/account-level/resellers/packages-and-product-instances/create-package-v2.md ## Introduction Creates a package of product instances. You must pass the relevant Wix account ID in the header of the call. In the DIY flow, we recommend to pass the customer's sub-account ID instead of your main reseller account ID. You may also pass a Wix site ID for each product in the body of the call. If you omit the site ID, a floating product instance is created. When Wix customers purchase a specific paid service or product, Wix may offer them time-limited free access to a different product. For example, customers get a voucher for a free 1-year domain registration when purchasing any Wix Premium plan. If you want to offer your customers the same benefit, create a package containing the original product first. Then, create a second package with the additional product. In the second Create Package call, pass the instance ID of the original product as `referenceProductInstanceId`. This way, Wix doesn't charge you for the additional product. Make sure that the status of the referenced product is either `"PENDING"` or `"ACTIVE"`. Note that you can use each product instance only a single time as reference instance. You need to pass a `countryCode` to specify where customers can claim vouchers that may come with a product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get information about vouchers and supported locations. > **Important**: This call requires an account level API key and cannot be > authenticated with the standard authorization header. --- ## REST API ### Schema ``` Method: createPackageV2 Description: Creates a package of product instances. You must pass the relevant Wix account GUID in the header of the call. In the DIY flow, we recommend to pass the customer's sub-account GUID instead of your main reseller account GUID. You may also pass a Wix site GUID for each product in the body of the call. If you omit the site GUID, a floating product instance is created. When Wix customers purchase a specific paid service or product, Wix may offer them time-limited free access to a different product. For example, customers get a voucher for a free 1-year domain registration when purchasing any Wix Premium plan. If you want to offer your customers the same benefit, create a package containing the original product first. Then, create a second package with the additional product. In the second Create Package call, pass the instance GUID of the original product as `referenceProductInstanceId`. This way, Wix doesn't charge you for the additional product. Make sure that the status of the referenced product is either `"PENDING"` or `"ACTIVE"`. Note that you can use each product instance only a single time as reference instance. You need to pass a `countryCode` to specify where customers can claim vouchers that may come with a product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get information about vouchers and supported locations. > **Important**: This call requires an account level API key and cannot be > authenticated with the standard authorization header. URL: https://www.wixapis.com/resellers/v2/packages Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: products, products.countryCode Method parameters: param name: externalId | type: externalId | description: External reference. For example, an external subscription GUID. **Note:** This field is not validated by Wix. param name: idempotencyKey | type: idempotencyKey | description: Idempotency key. param name: products | type: array | description: Wix services that are resold. | required: true - ONE-OF: - name: billingInfo | type: Cycle | description: Billing information for the contract between the reseller and Wix. - name: type | type: CycleDescriptorType | description: Payment type. - enum: - ONE_TIME: The reseller pays Wix in a single payment. - RECURRING: The reseller pays Wix on a recurring schedule. - name: cycleDuration | type: Interval | description: Duration of the billing cycle. Available only for `RECURRING` payments. - name: unit | type: IntervalUnit | description: Unit of the billing cycle. - enum: - DAY: Day - WEEK: Week - MONTH: Month - YEAR: Year - name: count | type: integer | description: Count of units that make up the billing cycle. - name: siteId | type: string | description: GUID of the Wix site that the product instance is assigned to. See the [Query Sites API](https://dev.wix.com/api/rest/account-level-apis/sites/query-sites) for more information. - name: catalogProductId | type: string | description: Product GUID, as defined in the Wix Premium Product Catalog. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more details about available Wix services. - name: countryCode | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. Specifies where customers can claim vouchers that may come with the product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get more information about vouchers and supported locations. | required: true - name: discountCode | type: string | description: Discount code indicating that the reseller provisioned the product instance during a sale. Wix doesn't guarantee that a discount code reduces the price between Wix and the reseller, even when it's valid. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more information. Max: 25 characters - name: referenceProductInstanceId | type: string | description: GUID of a different product instance that you can use to offer your customers time-limited free access to an additional product or service. For example, Wix offers a 1-year free domain registration to all customers who purchase a Premium plan. The referenced product instance must have either status `"PENDING"` or `"ACTIVE"`. You can use each product instance only a single time as reference instance. Return type: CreatePackageResponse - name: idempotencyKey | type: string | description: Idempotency key. - name: package | type: Package | description: Created package. - name: id | type: string | description: Package GUID. - name: accountId | type: string | description: Wix account GUID. See [Account Level APIs](https://dev.wix.com/docs/rest/account-level/about-account-level-apis.md) for more details. - name: externalId | type: string | description: External reference. For example, an external subscription GUID. This field isn't validated by Wix. Max: 100 characters - name: productInstances | type: array | description: Product instances that are included in the package. Min: 1 product instance Max: 1000 product instances - ONE-OF: - name: billingInfo | type: Cycle | description: Billing information for the contract between the reseller and Wix. - name: type | type: CycleDescriptorType | description: Payment type. - enum: - ONE_TIME: The reseller pays Wix in a single payment. - RECURRING: The reseller pays Wix on a recurring schedule. - name: cycleDuration | type: Interval | description: Duration of the billing cycle. Available only for `RECURRING` payments. - name: unit | type: IntervalUnit | description: Unit of the billing cycle. - enum: - DAY: Day - WEEK: Week - MONTH: Month - YEAR: Year - name: count | type: integer | description: Count of units that make up the billing cycle. - name: instanceId | type: string | description: GUID of the instance of the resold Wix service. **Note:** Differs from the `catalogProductId`. Allows you to identify different instances of the same product in a package. - name: siteId | type: string | description: GUID of the Wix site that the product instance is assigned to. See the [Query Sites API](https://dev.wix.com/api/rest/account-level-apis/sites/query-sites) for more information. - name: catalogProductId | type: string | description: Product GUID, as defined in the Wix Premium Product Catalog. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more details about available Wix services. - name: status | type: Status | description: Status of the product instance. - enum: - PENDING: The product instance isn't yet available to the customer. - ENABLED: The customer can use the product instance. - CANCELED: The product instance isn't any longer available to the customer. - FAILED: The product instance couldn't be delivered successfully and has never been available to the customer. - AWAITING_ACTION: The product instance isn't yet available to the customer, because an external provider or the customer must take an action. - name: failure | type: FailureReason | description: Failure object. Only present for status `FAILED`. Describes why the product instance `FAILED`. - name: code | type: FailureReasonCode | description: Failure code. - enum: - DELIVERY_TIMEOUT: The product instance couldn't be created because the Resellers API timed out. - EXTERNAL_FAILURE: The product instance couldn't be created because an external process failed. - name: message | type: string | description: Failure message. - name: createdDate | type: string | description: Date and time the product instance was created. - name: updatedDate | type: string | description: Date and time the product instance was last updated. - name: countryCode | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. Specifies where customers can claim vouchers that may come with the product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get more information about vouchers and supported locations. - name: expirationDate | type: string | description: Date and time the product instance expires in `YYYY-MM-DDThh:mm:ss.sssZ` format. Used only for instances that don't auto renew at the end of the current billing cycle. - name: discountCode | type: string | description: Discount code indicating that the reseller provisioned the product instance during a sale. Wix doesn't guarantee that a discount code reduces the price between Wix and the reseller, even when it's valid. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more information. Max: 25 characters - name: referenceProductInstanceId | type: string | description: GUID of a different product instance that you can use to offer your customers time-limited free access to an additional product or service. For example, Wix offers a 1-year free domain registration to all customers who purchase a Premium plan. The referenced product instance must have either status `"PENDING"` or `"ACTIVE"`. You can use each product instance only a single time as reference instance. - name: createdDate | type: string | description: Date and time the package was created. - name: updatedDate | type: string | description: Date and time the package was last updated. ``` ### Examples ### Create a package ```curl curl -X POST \ 'https://www.wixapis.com/resellers/v1/packages' \ -H 'wix-account-id: ' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "products": [ { "catalogProductId": "00ba7923-2655-402a-852d-2b2100568bcf", "siteId": "918aa943-ab4f-40bc-88c3-8dfd02fae7cd", "billingInfo": { "type": "RECURRING", "cycleDuration": { "unit": "YEAR", "count": 1 } }, "countryCode": "BR" } ], "external_id": "some-external-id" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.resellers.Packages.createPackageV2(options) Description: Creates a package of product instances. You must pass the relevant Wix account GUID in the header of the call. In the DIY flow, we recommend to pass the customer's sub-account GUID instead of your main reseller account GUID. You may also pass a Wix site GUID for each product in the body of the call. If you omit the site GUID, a floating product instance is created. When Wix customers purchase a specific paid service or product, Wix may offer them time-limited free access to a different product. For example, customers get a voucher for a free 1-year domain registration when purchasing any Wix Premium plan. If you want to offer your customers the same benefit, create a package containing the original product first. Then, create a second package with the additional product. In the second Create Package call, pass the instance GUID of the original product as `referenceProductInstanceId`. This way, Wix doesn't charge you for the additional product. Make sure that the status of the referenced product is either `"PENDING"` or `"ACTIVE"`. Note that you can use each product instance only a single time as reference instance. You need to pass a `countryCode` to specify where customers can claim vouchers that may come with a product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get information about vouchers and supported locations. > **Important**: This call requires an account level API key and cannot be > authenticated with the standard authorization header. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: options.products, options.products.countryCode, options Method parameters: param name: options | type: CreatePackageV2Options none | required: true - name: idempotencyKey | type: string | description: Idempotency key. - name: externalId | type: string | description: External reference. For example, an external subscription GUID. **Note:** This field is not validated by Wix. - name: products | type: array | description: Wix services that are resold. | required: true - ONE-OF: - name: billingInfo | type: Cycle | description: Billing information for the contract between the reseller and Wix. - name: type | type: CycleDescriptorType | description: Payment type. - enum: - ONE_TIME: The reseller pays Wix in a single payment. - RECURRING: The reseller pays Wix on a recurring schedule. - name: cycleDuration | type: Interval | description: Duration of the billing cycle. Available only for `RECURRING` payments. - name: unit | type: IntervalUnit | description: Unit of the billing cycle. - enum: - DAY: Day - WEEK: Week - MONTH: Month - YEAR: Year - name: count | type: integer | description: Count of units that make up the billing cycle. - name: siteId | type: string | description: GUID of the Wix site that the product instance is assigned to. See the [Query Sites API](https://dev.wix.com/api/rest/account-level-apis/sites/query-sites) for more information. - name: catalogProductId | type: string | description: Product GUID, as defined in the Wix Premium Product Catalog. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more details about available Wix services. - name: countryCode | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. Specifies where customers can claim vouchers that may come with the product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get more information about vouchers and supported locations. - name: discountCode | type: string | description: Discount code indicating that the reseller provisioned the product instance during a sale. Wix doesn't guarantee that a discount code reduces the price between Wix and the reseller, even when it's valid. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more information. Max: 25 characters - name: referenceProductInstanceId | type: string | description: GUID of a different product instance that you can use to offer your customers time-limited free access to an additional product or service. For example, Wix offers a 1-year free domain registration to all customers who purchase a Premium plan. The referenced product instance must have either status `"PENDING"` or `"ACTIVE"`. You can use each product instance only a single time as reference instance. Return type: PROMISE - name: idempotencyKey | type: string | description: Idempotency key. - name: package | type: Package | description: Created package. - name: _id | type: string | description: Package GUID. - name: accountId | type: string | description: Wix account GUID. See [Account Level APIs](https://dev.wix.com/docs/rest/account-level/about-account-level-apis.md) for more details. - name: externalId | type: string | description: External reference. For example, an external subscription GUID. This field isn't validated by Wix. Max: 100 characters - name: productInstances | type: array | description: Product instances that are included in the package. Min: 1 product instance Max: 1000 product instances - ONE-OF: - name: billingInfo | type: Cycle | description: Billing information for the contract between the reseller and Wix. - name: type | type: CycleDescriptorType | description: Payment type. - enum: - ONE_TIME: The reseller pays Wix in a single payment. - RECURRING: The reseller pays Wix on a recurring schedule. - name: cycleDuration | type: Interval | description: Duration of the billing cycle. Available only for `RECURRING` payments. - name: unit | type: IntervalUnit | description: Unit of the billing cycle. - enum: - DAY: Day - WEEK: Week - MONTH: Month - YEAR: Year - name: count | type: integer | description: Count of units that make up the billing cycle. - name: instanceId | type: string | description: GUID of the instance of the resold Wix service. **Note:** Differs from the `catalogProductId`. Allows you to identify different instances of the same product in a package. - name: siteId | type: string | description: GUID of the Wix site that the product instance is assigned to. See the [Query Sites API](https://dev.wix.com/api/rest/account-level-apis/sites/query-sites) for more information. - name: catalogProductId | type: string | description: Product GUID, as defined in the Wix Premium Product Catalog. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more details about available Wix services. - name: status | type: Status | description: Status of the product instance. - enum: - PENDING: The product instance isn't yet available to the customer. - ENABLED: The customer can use the product instance. - CANCELED: The product instance isn't any longer available to the customer. - FAILED: The product instance couldn't be delivered successfully and has never been available to the customer. - AWAITING_ACTION: The product instance isn't yet available to the customer, because an external provider or the customer must take an action. - name: failure | type: FailureReason | description: Failure object. Only present for status `FAILED`. Describes why the product instance `FAILED`. - name: code | type: FailureReasonCode | description: Failure code. - enum: - DELIVERY_TIMEOUT: The product instance couldn't be created because the Resellers API timed out. - EXTERNAL_FAILURE: The product instance couldn't be created because an external process failed. - name: message | type: string | description: Failure message. - name: _createdDate | type: Date | description: Date and time the product instance was created. - name: _updatedDate | type: Date | description: Date and time the product instance was last updated. - name: countryCode | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. Specifies where customers can claim vouchers that may come with the product. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) to get more information about vouchers and supported locations. - name: expirationDate | type: Date | description: Date and time the product instance expires in `YYYY-MM-DDThh:mm:ss.sssZ` format. Used only for instances that don't auto renew at the end of the current billing cycle. - name: discountCode | type: string | description: Discount code indicating that the reseller provisioned the product instance during a sale. Wix doesn't guarantee that a discount code reduces the price between Wix and the reseller, even when it's valid. Contact the [Wix B2B sales team](mailto:bizdev@wix.com) for more information. Max: 25 characters - name: referenceProductInstanceId | type: string | description: GUID of a different product instance that you can use to offer your customers time-limited free access to an additional product or service. For example, Wix offers a 1-year free domain registration to all customers who purchase a Premium plan. The referenced product instance must have either status `"PENDING"` or `"ACTIVE"`. You can use each product instance only a single time as reference instance. - name: _createdDate | type: Date | description: Date and time the package was created. - name: _updatedDate | type: Date | description: Date and time the package was last updated. ``` ### Examples ### Create a package with an API key ```javascript import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { packages } from "@wix/packages"; const wixClient = createClient({ modules: { packages }, auth: ApiKeyStrategy({ siteId: "MY-SITE-ID", apiKey: "MY-API-KEY", }), }); async function createPackageV2(options) { const response = await packages.createPackageV2(options); } ``` ### createPackageV2 (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 { packages } from '@wix/packages'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { packages }, // Include the auth strategy and host as relevant }); async function createPackageV2(options) { const response = await myWixClient.packages.createPackageV2(options); }; ``` ---