Skip to main content
Question

Kotlin | Making Purchase SDK 6.0.0

  • 30 September 2023
  • 1 reply
  • 63 views

Forum|alt.badge.img+2

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

Purchases.sharedInstance.purchaseWith(
  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

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 492 replies
  • October 4, 2023

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: https://www.revenuecat.com/docs/displaying-products#fetching-offerings

Offerings contain packages which you can forward to the purchase method. You can read more about configuration Offerings here: https://www.revenuecat.com/docs/entitlements#offerings


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings