Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK gives error when I use it as intended #162

Open
emartynov opened this issue Jul 11, 2023 · 9 comments
Open

SDK gives error when I use it as intended #162

emartynov opened this issue Jul 11, 2023 · 9 comments

Comments

@emartynov
Copy link

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

@sshropshire
Copy link
Collaborator

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

@emartynov
Copy link
Author

It is the same as in the case of #152

@sshropshire
Copy link
Collaborator

@emartynov is this resolved?

@emartynov
Copy link
Author

@sshropshire was something changed in this regard?

@fobos531
Copy link

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
Copy link

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

@sshropshire
Copy link
Collaborator

@fobos531 are you using the latest 1.0.0 version?

@fobos531
Copy link

@fobos531 are you using the latest 1.0.0 version?

Yes. Same on 1.0.1-SNAPSHOT

@emartynov
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants