1. Make a purchase
When Products and Entitlements are set, you can start making purchases with thepurchaseProduct method for iOS and cross-platform SDKs, and purchase for Android
1.1. Define a specific offer (Android only)
Google Play Billing Library allows you to sell a subscription with different offers. You can get information about available offers fromQProduct.storeDetails. Use one of the following options to provide the chosen offer for the purchase.
removeOffer method of purchase options builder:
2. Handle a purchase result
iOS, Android, React-Native, Flutter SDKs
The product purchase method returns a result object containing all the information about the purchase, including its status, user entitlements after the purchase, store transaction, or an error (if it happened). You should first check the status and then the entitlements, if the purchase was successful. See the examples above.Other cross-platform SDKs
The product purchase method returns a dictionary with the user’s entitlements on success (either via callback/completion block or as return value depending on the platform). If something goes wrong, the method returns an error or throws an exception with the failure description. There is aisCancelled flag available, which equals true if a user cancels the purchasing process on Unity. For other platforms, there is an additional field in the thrown exception for that purpose (see the code examples above).
Entitlement IDs are the keys to the entitlements dictionary. The values are the objects of the Qonversion.Entitlement class.
3. Update purchases (Android only)
Upgrading, downgrading, or changing a subscription on Google Play Store requires setting additional options through thePurchaseOptions builder. See Google Play Documentation for more details.
| Name | Description |
|---|---|
ChargeFullPrice | The new plan takes effect immediately, and the user is charged full price of new plan and is given a full billing cycle of subscription, plus remaining prorated time from the old plan. |
ChargeProratedPrice | The new plan takes effect immediately, and the billing cycle remains the same. |
WithTimeProration | The new plan takes effect immediately, and the remaining time will be prorated and credited to the user. |
Deferred | The new purchase takes effect immediately, the new plan will take effect when the old item expires. |
WithoutProration | The new plan takes effect immediately, and the new price will be charged on next recurrence time. |
WithTimeProration.
4. Multi-quantity purchases (iOS only)
When buying in-app products, you have the option to choose how many items you want to purchase. On Android, you can adjust the quantity directly in the purchase pop-up. However, on iOS, you’ll need to set the quantity beforehand. You can do it while building purchase options as follows:5. Check user entitlements
Use thecheckEntitlements() SDK method in case you want to check users’ entitlements separately from a purchase. Learn more here.
6. Restore purchases
When users, for example, upgrade to a new phone, they need to restore purchases so they can keep access to your premium features. Call therestore() method to restore purchases:
7. Consumable in-app purchases
How to handle consumable in-app purchases in your application. Since consumable in-app purchases do not make sense to tie to a specific entitlement, when making a purchase, you only need to look at the purchase outcome (success/error). If there is an error, do not grant bonuses for the consumable purchase; if the purchase is successful, then grant bonuses. Let’s go through the scenario step by step:- The customer initiates the consumable in-app purchase.
- You call the Qonversion purchase method.
-
You receive a response after the purchase is made.
- Is the response successful? Grant the user bonuses.
- Was there an error? No bonuses should be granted.
Displaying Products Subscription Status