Kotlin | Making Purchase SDK 6.0.0

  • 30 September 2023
  • 1 reply

Badge +1

I can see in docs how to make Purchases with Kotlin like this:

PurchaseParams.Builder(this, aPackage).build(),
onError = { error, userCancelled -> /* No purchase */ },
onSuccess = { storeTransaction, customerInfo ->
if (customerInfo.entitlements["my_entitlement_identifier"]?.isActive == true) {
// Unlock that great "pro" content

But how can I can the attribute of (aPackage) on line.2? Please answer with code if possible.

N.B: I have a 1 monthly subscription and I need to make when click on a button it directly opens Google default Paywall to make the purchase. So any other way to achieve this threw RevenueCat is appreciated.

1 reply

Userlevel 5
Badge +8

Hey @Aziz.cs,

Do you mean how do you get the `aPackage` object? You’ll want to configure Offerings in our dashboard, then fetch them as described here:

Offerings contain packages which you can forward to the purchase method. You can read more about configuration Offerings here: