Giter VIP home page Giter VIP logo

chargebee-android's People

Contributors

cb-amutha avatar cb-dinesh avatar cb-haripriyan avatar cb-imayaselvan avatar cb-palanim avatar cb-prabu avatar cb-prem avatar cb-sabuj avatar cb-seenivasan avatar cb-venkateshravichandran avatar cb-vinay avatar haripriyan avatar lovubuntu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chargebee-android's Issues

Incorrect error message

The error message is:

PlatformException(null, The Billing API version is not supported

The actual error code is BILLING_UNAVAILABLE, which has many more causes.

Documentation: https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#BILLING_UNAVAILABLE

The error message is therefore misleading.


We technically got this error message via your Flutter sdk, but the error is thrown here:
https://github.com/chargebee/chargebee-android/search?q=BillingUnavailable

BillingClient.BillingResponseCode.BILLING_UNAVAILABLE -> {
callBack.onError(CBException(ErrorDetail(GPErrorCode.BillingUnavailable.errorMsg)))
Log.i(TAG, "onBillingSetupFinished() -> with error: ${billingResult.debugMessage}")
}

create automated unit tests for the sample application

All SDK users will take inspiration from the sample application
They will all integrate the SDK into application that contain automated tests
It would be very useful to confirm that, for example, the SDK doesn't preclude the use of Robolectric in the application main module
More generally, this would help you identify any restrictions the SDK might create on application architecture (and to fix them once identified)

Crash when no network

I have a crash if I starts the Example without network.

Steps to reproduce:

1/ put any values as parameters of Chargebee.configure in app/src/main/java/com/chargebee/example/ExampleApplication.kt

IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/com/chargebee/example/ExampleApplication.kt b/app/src/main/java/com/chargebee/example/ExampleApplication.kt
--- a/app/src/main/java/com/chargebee/example/ExampleApplication.kt	(revision 4108c279587dfb36bb3f320f95bfb7e5e4912f82)
+++ b/app/src/main/java/com/chargebee/example/ExampleApplication.kt	(date 1654608992857)
@@ -9,7 +9,7 @@
         super.onCreate()
 
         // Please add site/app details as required
-        Chargebee.configure(site = "", publishableApiKey= "",sdkKey= "", packageName = this.packageName)
+        Chargebee.configure(site = "a", publishableApiKey= "b",sdkKey= "c", packageName = this.packageName)
 
     }
 }
\ No newline at end of file

2/ disable network of the device
3/ run. It crashes

2022-06-07 15:36:36.327 14953-14988/com.chargebee.example I/LoggerResource: logData :{key=cb.logging, ref_module=cb_android_sdk, site=a, action=Authenticate SDK Key, log_data_type=info, device_model=null, platform=null, os_version=null, sdk_version=null}
2022-06-07 15:36:36.330 14953-14991/com.chargebee.example D/OpenGLRenderer: RenderThread::requireGlContext()
2022-06-07 15:36:36.336 14953-14991/com.chargebee.example I/libEGL: EGL_ANDROID_blob_cache_path advertised, but unable to get eglSetBlobCachePathANDROID
2022-06-07 15:36:36.339 14953-14991/com.chargebee.example D/OpenGLRenderer: RenderThread::setGrContext()
2022-06-07 15:36:36.350 14953-15000/com.chargebee.example D/OkHttp: --> POST https://a.chargebee.com/api/internal/track_info_error
2022-06-07 15:36:36.351 14953-15000/com.chargebee.example D/OkHttp: Content-Type: application/json; charset=UTF-8
2022-06-07 15:36:36.351 14953-15000/com.chargebee.example D/OkHttp: Content-Length: 138
2022-06-07 15:36:36.351 14953-15000/com.chargebee.example D/OkHttp: {"data":{"key":"cb.logging","ref_module":"cb_android_sdk","site":"a","action":"Authenticate SDK Key","log_data_type":"info"},"type":"kvl"}
2022-06-07 15:36:36.351 14953-15000/com.chargebee.example D/OkHttp: --> END POST (138-byte body)
2022-06-07 15:36:36.356 14953-15000/com.chargebee.example D/OkHttp: <-- HTTP FAILED: java.net.UnknownHostException: Unable to resolve host "a.chargebee.com": No address associated with hostname
2022-06-07 15:36:36.357 14953-14988/com.chargebee.example I/LoggerResource: logData :{key=cb.logging, ref_module=cb_android_sdk, site=a, action=Authenticate SDK Key, log_data_type=error, device_model=null, platform=null, os_version=null, sdk_version=null, error_message=Unable to resolve host "a.chargebee.com": No address associated with hostname}
2022-06-07 15:36:36.361 14953-15004/com.chargebee.example D/OkHttp: --> POST https://a.chargebee.com/api/internal/track_info_error
2022-06-07 15:36:36.361 14953-14953/com.chargebee.example I/DecorView: [INFO] isPopOver=false, config=true
2022-06-07 15:36:36.361 14953-15004/com.chargebee.example D/OkHttp: Content-Type: application/json; charset=UTF-8
2022-06-07 15:36:36.361 14953-14953/com.chargebee.example I/DecorView: updateCaptionType >> DecorView@d28a664[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false
2022-06-07 15:36:36.361 14953-14953/com.chargebee.example D/DecorView: setCaptionType = 0, this = DecorView@d28a664[]
2022-06-07 15:36:36.361 14953-15004/com.chargebee.example D/OkHttp: Content-Length: 237
2022-06-07 15:36:36.361 14953-15004/com.chargebee.example D/OkHttp: {"data":{"key":"cb.logging","ref_module":"cb_android_sdk","site":"a","action":"Authenticate SDK Key","log_data_type":"error","error_message":"Unable to resolve host \"a.chargebee.com\": No address associated with hostname"},"type":"kvl"}
2022-06-07 15:36:36.361 14953-15004/com.chargebee.example D/OkHttp: --> END POST (237-byte body)
2022-06-07 15:36:36.363 14953-15004/com.chargebee.example D/OkHttp: <-- HTTP FAILED: java.net.UnknownHostException: Unable to resolve host "a.chargebee.com": No address associated with hostname
2022-06-07 15:36:36.364 14953-14953/com.chargebee.example I/DecorView: getCurrentDensityDpi: from real metrics. densityDpi=420 msg=resources_loaded
2022-06-07 15:36:36.367 14953-14988/com.chargebee.example E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: com.chargebee.example, PID: 14953
2022-06-07 15:36:36.375 14953-14953/com.chargebee.example W/argebee.exampl: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
2022-06-07 15:36:36.375 14953-14953/com.chargebee.example W/argebee.exampl: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
2022-06-07 15:36:36.381 14953-14988/com.chargebee.example I/Process: Sending signal. PID: 14953 SIG: 9

Unhandled Exception: com.chargebee.android.exceptions.CBException: length=1; index=1

This message is completely useless by itself, but when inspecting the sourcecode, it turns out that it was because we only passed the customer id and not the channel (which is apparently required even if it's not documented anywhere).

Please add a better error message here to check for missing parameters.

Basically, calling retrieveSubscriptions(["customerid"]), we get an unknown error with no error message because it's swallowed earlier.

If we pass retrieveSubscriptions(["customerid", "play_store"]), everything works flawlessly.

(tested in v1.0.5)

retrieveSubscriptions() doesn't support querying for status

As per documentation:

For example, query parameters can be passed as "customer_id" : "id", "subscription_id": "id", or "status": "active".

In reality and when looking at the code, the function only supports ["customerid", "channel"] as its query parameters.

I assume this paragraph was copied from https://github.com/chargebee/chargebee-ios?

Will this functionality be added at some point? It would nice, so we don't need to filter the result we get back manually.

Also, does a status of "active" also include "pending", since pending cancellation is basically the same as active?

(tested in v1.0.5)

Configure completion callback

Can you put a completion callback for Chargebee.configure() as for Chargebee.retrieveSubscription(), etc?

Regards,
O. Jouvenaux

Disable OkHttp logs

Could you please evaluate the possibility to enable or disable the OkHttp Logging interceptor on demand?

App crashes when receiving the PURCHASES_UPDATED intent

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=com.android.vending.billing.PURCHASES_UPDATED flg=0x10 pkg=com.dieringe.workout (has extras) } in u2.f1@c9ed868
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$android-app-LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1929)
at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(:2)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Caused by uj.s: lateinit property product has not been initialized
at com.chargebee.android.billingservice.BillingClientManager.acknowledgePurchase(:6)
at com.chargebee.android.billingservice.BillingClientManager.onPurchasesUpdated(:139)
at u2.f1.onReceive(SourceFile:1)
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$android-app-LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1919)
at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(:2)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Both of these together caused an app crash in production.
Maybe another ProGuard issue due to missing rules?

Expose native subscription stream

In the past, we got weird errors that the purchase failed. However, the purchase didn't fail for those customers.

The native store sdks already send you a stream of purchases, but if the initial call to purchase() failed for some reason, the subscription is never synced to chargebee.

Could you please expose the purchase stream directly from this package?
We could depend on the billingclient directly, but perhaps that's what lead to those "unknown error"s and "purchase failed"s.

It would be great if the purchase stream could be synced to chargebee automatically, but it would be enough if this package just provided a way of extracting the tokens so we can import them into chargebee ourselves.

Plan id is always null when calling retrieveSubscriptions()

This happens on all the 4 Playstore subscriptions I've created on a test account:
Bildschirmfoto 2022-06-30 um 00 51 31

it.data.list[...].cb_subscription.id is alwaysnull.

Am I missing something here? Is this intentional?

When viewing the subscriptions in the Chargebee Dashboard, they all have correct (or at least existent ids).

(tested in v1.0.5)

sdk key

my chargebee account.i have only get access key.that same key i use publish key,sdk key,encoded api key.any one clarify.that same key i use that i face following error.
{"message":"Application with id test_RVrhtiJuetHjOXnaLsb2272BlTxXuPEs is not found","type":"invalid_request","api_error_code":"resource_not_found","error_code":"resource_not_found","error_msg":"Application with id test_RVrhtiJuetHjOXnaLsb2272BlTxXuPEs is not found","http_status_code":404}

Configuration for using tokenization only doesn't work

The docs say that I should be able to configure chargebee for tokenizing credit card details by

import com.chargebee.android.Chargebee

Chargebee.configure(site = "your-site", publishableApiKey = "api_key")

But that api doesn't seem to exist. And attempting to pass in "" or null for packageName and sdkKey doesn't work.

Stuck in BillingManager 2.0.0 beta-1

I've tried to integrate 2.0.0 beta-1 in our app but can't make a purchase.
After debugging I can see that execution goes until line 214 of BillingClintManager.kt
val productDetailsParamsList = listOf(productDetailsBuilder.build())
And nothing happens after it.
No crashes or any activity from the app.

Switch to ProductDetails

Check the warning at the top of this page:
https://developer.android.com/reference/com/android/billingclient/api/SkuDetails

Reasons for switching:

  • Don't rely on deprecated functionality
  • Is probably a requirement to support the new subscription types in the Play Console (don't quote me on this, just an assumption)
  • Much more information available.

validateReceipt() fails

I've called retrieveProducts(), followed by purchaseProduct() (for the first product returned by retrieveProducts(). The Google Play Purchase dialog opens, I click 1-tap-buy and it says "success". The dialog closes and I get back this error message.

Here's the full error message:

Exception from server - validateReceipt() : {"message":"The Token data sent is not correct or Google service is temporarily down","type":"invalid_request","api_error_code":"invalid_request","error_code":"operation_not_supported","error_msg":"The Token data sent is not correct or Google service is temporarily down","http_status_code":400}

I have absolutely no clue what to make of it. I highly doubt that the "Google service" is down and I'm not creating the token so I wouldn't know what could be wrong with it.

Any idea what went wrong here?

Crash when building in release mode

When configuring the library in release mode, our app is crashing at the end of the Chargebee.configure().

For example, using your Example code.

Steps to reproduce:
1/ put valid configuration in ExampleApplication.kt
2/ enable minifyEnabled true in build.gradle
3/ build release variant & sign
4/ sideload & run. It crashes:

I/c: Environment Setup Completed
I/c:  Response :CBAuthResponse(in_app_detail=null)
I/c: Note: pre-requisites configuration is mandatory for SDK to work. Learn more - https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html
E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: com.chargebee.example, PID: 5802
    java.lang.NullPointerException
        at e.a.a.c$a.g(:5)
        at e.a.a.s.q.i(:6)
        at h.n.j.a.a.e(:2)
        at f.a.c0.run(:2)
        at f.a.m1.a.x(Unknown Source:0)
        at f.a.m1.a$a.run(:7)
I/Process: Sending signal. PID: 5802 SIG: 9

App crashes: "Reply already submitted"

This currently affects a high percentage of our users.
Interestingly, 91% of the devices are "background state" according to Crashlytics.

Fatal Exception: java.lang.IllegalStateException: Reply already submitted
at bh.c$g.a(SourceFile:1)
at lh.k$a$a.b(SourceFile:1)
at b4.b.f(SourceFile:1)
at b4.b.h(SourceFile:1)
at b4.b.b(SourceFile:1)
at b4.b$i.onError(SourceFile:1)
at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(SourceFile:2)
at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$2.invoke(SourceFile:1)
at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(SourceFile:2)
at com.chargebee.android.billingservice.BillingClientManager$retrieveProducts$3.invoke(SourceFile:1)
at com.chargebee.android.billingservice.BillingClientManager$createBillingClientStateListener$1.onBillingServiceDisconnected(:15)
at u2.v.onServiceDisconnected(SourceFile:1)
at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:2368)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2383)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

OkHttp throws error at launch

logs
W/ieringe.workout( 2152): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setUseSessionTickets(Z)V (max-target-q,core-platform-api, reflection, denied)
W/OkHttp  ( 2152): unable to load android socket classes
W/OkHttp  ( 2152): java.lang.NoSuchMethodException: com.android.org.conscrypt.OpenSSLSocketImpl.setUseSessionTickets [boolean]
W/OkHttp  ( 2152): 	at java.lang.Class.getMethod(Class.java:2103)
W/OkHttp  ( 2152): 	at java.lang.Class.getDeclaredMethod(Class.java:2081)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.android.AndroidSocketAdapter.<init>(AndroidSocketAdapter.kt:34)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.android.StandardAndroidSocketAdapter.<init>(StandardAndroidSocketAdapter.kt:31)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.android.StandardAndroidSocketAdapter$Companion.buildIfSupported(StandardAndroidSocketAdapter.kt:57)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.android.StandardAndroidSocketAdapter$Companion.buildIfSupported$default(StandardAndroidSocketAdapter.kt:50)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.AndroidPlatform.<init>(AndroidPlatform.kt:44)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported(AndroidPlatform.kt:239)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.Platform$Companion.findPlatform(Platform.kt:211)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.Platform$Companion.access$findPlatform(Platform.kt:179)
W/OkHttp  ( 2152): 	at okhttp3.internal.platform.Platform.<clinit>(Platform.kt:180)
W/OkHttp  ( 2152): 	at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:219)
W/OkHttp  ( 2152): 	at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:955)
W/OkHttp  ( 2152): 	at com.chargebee.android.resources.BaseResource.<init>(BaseResource.kt:17)
W/OkHttp  ( 2152): 	at com.chargebee.android.resources.LoggerResource.<init>(LoggerResource.kt:10)
W/OkHttp  ( 2152): 	at com.chargebee.android.loggers.CBLogger.postLog(CBLogger.kt:28)
W/OkHttp  ( 2152): 	at com.chargebee.android.loggers.CBLogger.postLog$default(CBLogger.kt:18)
W/OkHttp  ( 2152): 	at com.chargebee.android.loggers.CBLogger.info(CBLogger.kt:15)
W/OkHttp  ( 2152): 	at com.chargebee.android.models.ResultHandler$Companion$safeExecuter$1.invokeSuspend(ResultHandler.kt:43)
W/OkHttp  ( 2152): 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/OkHttp  ( 2152): 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/OkHttp  ( 2152): 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
W/OkHttp  ( 2152): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
W/OkHttp  ( 2152): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
W/OkHttp  ( 2152): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

We're using an older version of chargebee-android and we had to downgrade the billingclient version for it to work in our usecase. Take this issue with a grain of salt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.