purchase

fun purchase(context: Context, type: Payment.ProductsType, onSuccess: (Boolean, String) -> Unit = { _, _ -> }, onFailure: (PurchasesError, Boolean) -> Unit = { _, _ -> }): List<Package>?

This function is used to make a purchase request for our products/subscriptions. Remember that in addition to having the products/offers declared in RevenueCat, you must also have them included in the Store.

Parameters

context
type

ProductsType the type of product we want to obtain, either on an annual or monthly basis

onSuccess

Unit if the answer is correct, a boolean with the subscription status and the id of the corresponding product will be returned in the unit.

onFailure

Unit in case the answer is wrong, a PurchaseError with information about the problem and a boolean with the subscription status will be returned in the unit.

See also