You can find out whether a user is paying or not by checking the App Instance. This article tells you how and when to use App Instance.
This is relevant for all dashboard extensions, iframe widgets and iframe pages. You can inspect the App Instance that's returned to the client.
- Inspect the client side App Instance.
- If the value matches the Product ID defined in the Pricing Plans section of the Wix Developers Center this app has a paid pricing plan. This means you need to activate your pricing plan features (if you have more than one plan, the value indicates the specific plan).
- If the value is
nullthis app is free, so activate your app’s free features only.
Keep in mind that if users cancel their paid plan, the
vendorProductId parameter will change to
null when their plan expires. Check the
vendorProductId parameter on every call.
You can call the Get App Instance REST API.
- Call the
- Note the following parameters in the response:
packageName(packageName is the Product ID defined in the Pricing Plans section of the Wix Developers Center).
- Every time there's a renewal, the
expiration dateparameter should update to reflect the new date.
Expired subscription date, but user still marked as premium
If the date expired, but the
isFree parameter is still
False - keep the user's subscription active. This means that the user has a billing issue and once they fix the issue or cancel their subscription the Instance will update.
Get notified when a user's payment status changes by listening to three webhooks. We recommend combining the webhook method with the above approaches:
If you're working with Blocks, then you should read our dedicated article on getting the vendorProductId in Blocks apps.