createPackageV2( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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 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.

Method Declaration
Copy
function createPackageV2(
  options: CreatePackageV2Options,
): Promise<CreatePackageResponse>;
Method Parameters
optionsCreatePackageV2Options
Returns
Return Type:Promise<CreatePackageResponse>
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); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getPackage( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a package.

You must pass the ID of the Wix account that the package belongs to in the header of the call. The call fails, if the package and Wix account don't match.

Important: This call requires an account level API key and cannot be authenticated with the standard authorization header.

Method Declaration
Copy
function getPackage(_id: string): Promise<Package>;
Method Parameters
_idstringRequired

Package ID.

Returns
Return Type:Promise<Package>
Get 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({ apiKey: "MY-API-KEY", }), }); async function getPackage(id) { const response = await packages.getPackage(id); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

queryPackages( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a list of packages, given the provided paging, filtering, and sorting.

You must pass the ID of the Wix account that the packages belong to in the header of the call. The call returns packages that belong to the parent account, regardless if you pass the ID of a parent or sub-account. In case you want to retrieve only packages that belong to a sub-account, you must pass the sub-account ID as filter in the query object like this:

Copy

Query Packages runs with these defaults, which you can override:

  • createdDate is sorted in DESC order
  • cursorPaging.limit is 100

By default pagingMetadata.cursors are returned, unless you specifically pass query.paging.

The maximum for cursorPaging.limit is 100.

If you pass a cursor token that you have received in a previous Query Package response, passing additional sort or filter information results in an invalid cursor error. Since the received cursor token already holds all the needed information for sort and filter. Changing the sort and filter properties during the span of a cursor query isn't supported. But you can provide a different limit.

For field support for filters and sorting, see Query Packages: Supported Filters and Sorting.

To learn about working with Query endpoints, see API Query Language, Sorting and Paging, and Field Projection.

Important: This call requires an account level API key and cannot be authenticated with the standard authorization header.

Method Declaration
Copy
function queryPackages(): PackagesQueryBuilder;
Request
This method does not take any parameters
Returns
Query packages with an API key
JavaScript
import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { packages } from "@wix/packages"; const wixClient = createClient({ modules: { packages }, auth: ApiKeyStrategy({ apiKey: "MY-API-KEY", }), }); async function queryPackages() { const { items } = await packages.queryPackages().find(); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

unassignProductInstanceFromSite( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Unassigns a product instance from a site.

You must pass the ID of the Wix account that the product instance belongs to in the header of the call.

The product instance becomes floating and the customer immediately looses access to features included in the unassigned service. It's up to the reseller to decide whether unassigning a product instance affects the customer’s payment.

If an unassigned product instance is a requirement for another service, that service may not be available to the customer any longer. For example, if you unassign a Combo Plan plan from a site, a previously connected domain is disconnected.

You can assign floating product instances to sites using the Assign Product Instance to Site method.

Important: This call requires an account level API key and cannot be authenticated with the standard authorization header.

Method Declaration
Copy
function unassignProductInstanceFromSite(
  instanceId: string,
  options: UnassignProductInstanceFromSiteOptions,
): Promise<UnassignProductInstanceFromSiteResponse>;
Method Parameters
instanceIdstringRequired

ID of the product instance to unassign from a site.


optionsUnassignProductInstanceFromSiteOptions
Returns
Return Type:Promise<UnassignProductInstanceFromSiteResponse>
Unassign a product instance from a site 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 unassignProductInstanceFromSite(instanceId, options) { const response = await packages.unassignProductInstanceFromSite( instanceId, options, ); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

updatePackageExternalId( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Updates a package's external ID field.

Method Declaration
Copy
function updatePackageExternalId(
  identifiers: UpdatePackageExternalIdIdentifiers,
): Promise<UpdatePackageExternalIdResponse>;
Method Parameters
identifiersUpdatePackageExternalIdIdentifiersRequired
Returns
Return Type:Promise<UpdatePackageExternalIdResponse>
Update a package's external ID with an API key
JavaScript
import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { packages } from "@wix/packages"; const wixClient = createClient({ modules: { packages }, auth: ApiKeyStrategy({ apiKey: "MY-API-KEY", }), }); async function updatePackageExternalId(identifiers) { const response = await packages.updatePackageExternalId(identifiers); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?