Make purchases in mobile app in Android SDK
Displaying paywalls within your mobile app is an essential step in offering users access to premium content or services. However, presenting a paywall supports purchases on its own only when Adapty renders the screen — that is, a flow, or a paywall from the old Paywall Builder.
If you render the screen in your own code, you must use a separate method called .makePurchase() to complete a purchase and unlock the desired content. This method serves as the gateway for users to engage with the paywalls and proceed with their desired transactions.
If your paywall has an active promotional offer for the product a user is trying to buy, Adapty will automatically apply it at the time of purchase.
Keep in mind that the introductory offer will be applied automatically only if Adapty renders the screen.
In other cases, you’ll need to verify the user’s eligibility for an introductory offer on iOS. Skipping this step may result in your app being rejected during release. Moreover, it could lead to charging the full price to users who are eligible for an introductory offer.
Make sure you’ve done the initial configuration without skipping a single step. Without it, we can’t validate purchases.
Make purchase
Does Adapty render your screen? For a flow or a Paywall Builder paywall, purchases are processed automatically—you can skip this step.
Looking for step-by-step guidance? Check out the quickstart guide for end-to-end implementation instructions with full context.
Request parameters:
| Parameter | Presence | Description |
|---|---|---|
| Product | required | An AdaptyPaywallProduct object retrieved from the paywall. |
Response parameters:
| Parameter | Description |
|---|---|
| Profile | If the request has been successful, the response contains this object. An AdaptyProfile object provides comprehensive information about a user’s access levels, subscriptions, and non-subscription purchases within the app. Check the access level status to ascertain whether the user has the required access to the app. |
If the user chose a delayed payment method, such as cash at a store, makePurchase returns AdaptyPurchaseResult.Pending, and the user doesn’t get access yet. Starting with Adapty SDK 4.3.0, the SDK validates the purchase with Adapty when Google Play approves it. If the app is closed at that moment, the SDK validates the purchase the next time the user opens the app. To grant access at that moment, listen for profile updates.
Adapty’s server acknowledges the purchase once Google Play reports it as completed through real-time developer notifications, or consumes it if it’s a consumable product. Google Play therefore doesn’t refund the purchase automatically, even if the user doesn’t open the app within three days. The SDK version and the next app launch affect only when the purchase is linked to the user’s profile.
Change subscription when making a purchase
When a user opts for a new subscription instead of renewing the current one, the way it works depends on the app store. For Google Play, the subscription isn’t automatically updated. You’ll need to manage the switch in your mobile app code as described below.
To replace the subscription with another one in Android, call .makePurchase() method with the additional parameter:
Pass subscriptionUpdateParams only when the user switches from an active subscription purchased on the same Google account. For a new purchase, call makePurchase without this parameter — passing it makes the purchase fail with the CURRENT_SUBSCRIPTION_TO_UPDATE_NOT_FOUND_IN_HISTORY error, whose message misleadingly points to an inactive subscription or a different Google account.
You can read more about subscriptions and replacement modes in the Google Developer documentation:
- About replacement modes
- Recommendations from Google for replacement modes
- Replacement mode
CHARGE_PRORATED_PRICE. Note: this method is available only for subscription upgrades. Downgrades are not supported. - Replacement mode
DEFERRED. Note: A real subscription change will occur only when the current subscription billing period ends.
Manage prepaid plans
If your app users can purchase prepaid plans (e.g., buy a non-renewable subscription for several months), you can enable pending transactions for prepaid plans.