PurchaseParams.Builder(this, aPackage) usage

  • 21 September 2023
  • 1 reply

Badge +1

Hello, I just started adding a subscription to an android app using java for the first time.

Following the getting started guide, I got to the “Making a purchase” section. I want to use the code example from this section in my app but there is one parameter I’m not sure where is coming from.

This is the code:

new PurchaseParams.Builder(this, aPackage).build(),
new PurchaseCallback() {
public void onCompleted(@NonNull StoreTransaction storeTransaction, @NonNull CustomerInfo customerInfo) {
if (customerInfo.getEntitlements().get(<my_entitlement_identifier>).isActive()) {
// Unlock that great "pro" content

public void onError(@NonNull PurchasesError purchasesError, boolean b) {
// No purchase

The missing parameter is aPackage in the second line. What should I put there?

Additional info: The app has only one product which is a subscription, it is connected to an entitlement, and there are no offerings.