akshaaatt / Google-IAP

Android Library for easing Google Play Billing to your apps with support for Subscriptions, Non-Consumable and Consumable Purchases with a beautiful sample app.
GNU General Public License v3.0
250 stars 58 forks source link

OfferToken not found #80

Open mujahid-dzinemedia opened 2 years ago

mujahid-dzinemedia commented 2 years ago
BillingFlowParams.ProductDetailsParams.newBuilder()
                                .setOfferToken(offerToken)
                                .setProductDetails(productDetails)
                                .build()

https://stackoverflow.com/questions/72351444/android-in-app-billing-v5-subscription-with-trial-period https://developer.android.com/google/play/billing/subscriptions

@akshaaatt Please update library its crashing when subscribe

dhirajved commented 2 years ago

.setOfferToken("") try this way.

If you want to give offer than refer this doc. https://developer.android.com/google/play/billing/integrate Hope this will be helpful:)

tracer8 commented 2 years ago

Bump, this error make sub crash! @akshaaatt

nikunjparadva commented 2 years ago

yes, it crashed... here is the logcat.


        at com.google.android.gms.internal.play_billing.zzm.zzc(com.android.billingclient:billing@@5.0.0:1)
        at com.android.billingclient.api.BillingFlowParams$ProductDetailsParams$Builder.build(com.android.billingclient:billing@@5.0.0:2)
        at com.aemerse.iap.BillingService$launchBillingFlow$1.invoke(BillingService.kt:105)
        at com.aemerse.iap.BillingService$launchBillingFlow$1.invoke(BillingService.kt:99)
        at com.aemerse.iap.BillingService.toProductDetails(BillingService.kt:326)
        at com.aemerse.iap.BillingService.launchBillingFlow(BillingService.kt:99)
        at com.aemerse.iap.BillingService.subscribe(BillingService.kt:95)
        at com.aemerse.iap.IapConnector.subscribe(IapConnector.kt:65)```
gitkobold commented 1 year ago

java.lang.NullPointerException: offerToken is required for constructing ProductDetailsParams. at com.google.android.gms.internal.play_billing.zzm.zzc(com.android.billingclient:billing@@5.0.0:1) at com.android.billingclient.api.BillingFlowParams$ProductDetailsParams$Builder.build(com.android.billingclient:billing@@5.0.0:2) at com.aemerse.iap.BillingService$launchBillingFlow$1.invoke(BillingService.kt:115) at com.aemerse.iap.BillingService$launchBillingFlow$1.invoke(BillingService.kt:105) at com.aemerse.iap.BillingService.toProductDetails(BillingService.kt:335) at com.aemerse.iap.BillingService.launchBillingFlow(BillingService.kt:105) at com.aemerse.iap.BillingService.buy(BillingService.kt:92) at com.aemerse.iap.IapConnector.purchase(IapConnector.kt:61)`