overwolf.profile.subscriptions API
Provides functions and events to help with user profile subscription management.
- Permissions required: profile
Please check the subscriptions API sample app that demonstrates a primary usage in the API.
Please read all the info about app subscriptions here.
Methods Reference
- overwolf.profile.subscriptions.getActivePlans()
- overwolf.profile.subscriptions.getDetailedActivePlans()
Events Reference
Types Reference
- overwolf.profile.subscriptions.SubscriptionChangedEvent Object
- overwolf.profile.subscriptions.GetActivePlansResult Object
- overwolf.profile.subscriptions.Plan Object
- overwolf.profile.SubscriptionState Enum
Sample app
In our APIs sample apps repository, you can find and download a sample app that demonstrate the usage in the subscriptions and Ads API:
- The
subscriptions-sample
- Demonstrates how to purchase a subscription that removes an ad.
It's a great place to get started - All the samples in this repository are built with JS code and demonstrate primary usage in the API.
Functionality
The sample app's functionality is pretty straightforward: You launch it, open the dev console (to see all the debug messages), and hit the Subscribe
button to purchase a subscription and remove the Ads. In addition, you have the Subscribe in-app
button that opens the subscribe page inside the app UI, and allow you to purchase a subscription without leaving the app.
You can look at the dev console to see the status of each call (success, failure, etc.).
Setting up
Download the app's source code from the repository as a zip file, and extract it to a new folder on your machine.
Load the app as an "unpacked extension" (Note that to do that you have to whitelist your OW username as a developer).
- Open the Overwolf desktop client settings (by right-clicking the client and selecting "Packages" Or by clicking on the wrench icon in the dock and going to the "About" tab => "Development Options").
- Click on "Development options".
- In the opened window, click on "Load unpacked extension" and select the extracted
subscriptions-sample
folder. This will add the manual sample app to your Overwolf dock. - Make sure you are logged in to the OW client. Otherwise, you will get an "Unauthorized App" error message. (Click on the "Appstore" icon in the OW dock to login to the OW client).
- Click on the app's icons in your OW dock to run the apps.
getActivePlans(callback)
Version added: 0.134
Returns active subscriptions for the calling extension via callback.
Parameter | Type | Description |
---|---|---|
callback | (Result: GetActivePlansResult) => void | Returns with the result |
Important Notes
- Many users can have the same planID, while subscriptionID is an individual unique ID for a user's subscription.
- When calling getActivePlans(), make sure you use your live app and not the sample app, etc., as subscriptions are pairs to a specific app UID.
- We refresh cache every 2 hours and update it on-demand when the user does an action (cancel, subscribe, extend, etc.)
getDetailedActivePlans(callback)
Version added: 0.170
Returns more details about the active subscriptions for the calling extension via callback.
Parameter | Type | Description |
---|---|---|
callback | (Result: GetDetailedActivePlansResult) => void | Returns with the result |
onSubscriptionChanged
Version added: 0.134
Fired when current extension subscription has changed, with the following structure: SubscriptionChangedEvent Object
SubscriptionChangedEvent Object
Parameter | Type | Description |
---|---|---|
plans | int[] | an array of plan IDs |
GetActivePlansResult Object
Parameter | Type | Description |
---|---|---|
success | boolean | inherited from the "Result" Object |
error | string | inherited from the "Result" Object |
status | string | deprecated. For backward compatibility only |
Reason | string | deprecated. For backward compatibility only |
plans | int[] | an array of plan IDs (only current active plans) |
Example data: Success
{
"plans": [ 4564, 23455 ], //If there is no active plans, a null is returned.
"success": true
}
GetDetailedActivePlansResult Object
Parameter | Type | Description |
---|---|---|
success | boolean | inherited from the "Result" Object |
error | string | inherited from the "Result" Object |
status | string | deprecated. For backward compatibility only |
Reason | string | deprecated. For backward compatibility only |
plans | Plan[] | an array of active plans |
Example data: Success
{
"plans": [
{"planId":23, "state":"cancelled", "expiryDate": "1684244095000", "title": "Forget Ads", "description": "Remvoe all ads from the app", "price":"", "periodMonths": "6"},
{"planId":25, "state":"active", "expiryDate": "1684244095000", "title": "Forget Ads test", "description": "", "price":"", "periodMonths": "12"}
], //If there is no active plans, a null is returned.
"success": true
}
Plan Object
Parameter | Type | Description |
---|---|---|
planId | number | |
state | SubscriptionState Enum | See Subscription states notes. |
expiryDate | number | See Subscription states notes. |
title | string | |
description | string | |
price | number | |
periodMonths | number |
SubscriptionState enum
Option | Value |
---|---|
Active | "active" |
Cancelled | "cancelled" |
Revoked | "revoked" |
Subscription states notes
- If the state is
active
, the expiryDate means when the next renewal is (i.e., next payment). - If the state is
canceled
, the expiryDate means that a user canceled the subscription, and it will expire on this date. BTW, we give a few days of grace, so it could be that even when expired, the state will still be "active". revoked
means an immediate cancellation - the date will be expired automatically. The only way to revoke is via the console.overwolf.com interface.