paypal-android icon indicating copy to clipboard operation
paypal-android copied to clipboard

SDK gives error when I use it as intended

Open emartynov opened this issue 2 years ago • 9 comments

PayPal Android SDK Version

0.0.10

Environment

Sandbox

Android Version & Device

No response

PayPal dependencies

paypal-payments-sdk = { module = "com.paypal.android:paypal-native-payments", version.ref = "0.0.10" }

Describe the bug

The SDK doesn't work when I pass the client id. The SDK works fine when I pass the token instead.

To reproduce

All PayPal calls are done by our server.

I call SDK with the next code:

        val coreConfig = CoreConfig(
            clientId = providerTokens!!.clientId,
            environment = Environment.SANDBOX
        )

        val returnUrl = "${applicationContext.resources.getString(R.string.deep_link_scheme)}://paypalpay/"
        val payPalNativeClient = PayPalNativeCheckoutClient(
            application = applicationContext as Application,
            coreConfig = coreConfig,
            returnUrl = returnUrl
        )

This doesn't work. However if I do it next

        val coreConfig = CoreConfig(
            clientId = providerTokens!!.paymentAccessToken, // <<----- this is the change
            environment = Environment.SANDBOX
        )

        val returnUrl = "${applicationContext.resources.getString(R.string.deep_link_scheme)}://paypalpay/"
        val payPalNativeClient = PayPalNativeCheckoutClient(
            application = applicationContext as Application,
            coreConfig = coreConfig,
            returnUrl = returnUrl
        )

It works great for me.

As you can see, I pass the token instead of the client id.

Expected behavior

SDK works fine with API it is provided.

Screenshots

No response

emartynov avatar Jul 11 '23 13:07 emartynov

@emartynov thanks for filing this issue. Can you share the error message provided by the SDK when it fails with client ID?

sshropshire avatar Jul 11 '23 15:07 sshropshire

It is the same as in the case of #152

emartynov avatar Jul 11 '23 15:07 emartynov

@emartynov is this resolved?

sshropshire avatar Aug 15 '23 18:08 sshropshire

@sshropshire was something changed in this regard?

emartynov avatar Aug 15 '23 20:08 emartynov

Hello @sshropshire

I'm experiencing the same issue. This is the output that I get https://gist.github.com/fobos531/3d3c53cb9cc1a0e601972a7d760790bb

I'm using the Client ID as per the official documentation

fobos531 avatar Nov 14 '23 19:11 fobos531

I can confirm that the workaround provided by @emartynov works (using the access token)

fobos531 avatar Nov 14 '23 19:11 fobos531

@fobos531 are you using the latest 1.0.0 version?

sshropshire avatar Nov 14 '23 19:11 sshropshire

@fobos531 are you using the latest 1.0.0 version?

Yes. Same on 1.0.1-SNAPSHOT

fobos531 avatar Nov 14 '23 20:11 fobos531

Quite unmotivating, the question asked about the latest version usage with no fix/changes in it.

emartynov avatar Nov 14 '23 20:11 emartynov