purchase
open suspend override fun purchase(activity: Activity, productDetails: ProductDetails, basePlanId: String?, offerId: String?): PurchaseResult(source)
Deprecated
Implement purchase(activity, product, basePlanId, offerId) instead. It receives a StoreProduct, which also supports custom store products.
Replace with
purchase(activity, product, basePlanId, offerId)Content copied to clipboard
Called when the user initiates purchasing of a product.
Add your purchase logic here and return its result. You can use Android's Billing APIs, or if you use RevenueCat, you can call Purchases.shared.purchase(product).
Return
A PurchaseResult object, which is the result of your purchase logic. Note: Make sure you handle all cases of PurchaseResult.
Parameters
product Details
The ProductDetails the user would like to purchase.
base Plan Id
An optional base plan identifier of the product that's being purchased.
offer Id
An optional offer identifier of the product that's being purchased.