Introduction

This module is available only in Wix Blocks
Wix Blocks is an editor for building Wix apps. To get access to Blocks, join Wix Studio.

To use the wixApplication API, import wixApplication from the wix-application module:

Copy
Did this help?

getAppPageUrl( )


Gets the URL of the new page that was added by a Blocks app, when installed on a site.

The getAppPageUrl() function returns a Promise that resolves to a string with a URL of the new page that was added by a Blocks app, when a widget is installed on a site as a new page. Learn more about app and widget installation settings.

Method Declaration
Copy
Method Parameters
pageIdstringRequired

The ID of the page on which the widget is added, as defined in the Installation Settings.

Returns
Return Type:Promise<string>
Retrieve the new page's URL and go to that page
JavaScript
Did this help?

getDecodedAppInstance( )


Gets the Wix Blocks App data as a decoded Json Web Token (JWT) object.

The getDecodedAppInstance() function returns a Promise that resolves to an object with data about the installation of your app on a specific site. It is useful when managing your application's pricing.

Method Declaration
Copy
function getDecodedAppInstance(): Promise<decodedAppInstance>;
Request
This method does not take any parameters
Returns
Return Type:Promise<decodedAppInstance>
Retrieve the Vendor Product ID
JavaScript
import wixApplication from "wix-application"; // ... let plan; wixApplication .getDecodedAppInstance() .then((instance) => { if (instance.vendorProductId) { plan = instance.vendorProductId; // e.g. ‘basic’ } console.log(plan); }) .catch((error) => { console.error("Error fetching the app instance:", error); // Additional error handling logic });
Did this help?