braintree / braintree_android

Braintree SDK for Android
https://developer.paypal.com/braintree/docs/start/hello-client/android/v4
MIT License
409 stars 233 forks source link

Migration to v5: Invalid URL #1177

Open mikkoville opened 2 weeks ago

mikkoville commented 2 weeks ago

Braintree SDK Version

5.0.0

Environment

Sandbox

Android Version & Device

Pixel 8 pro

Braintree dependencies

com.braintreepayments.api:paypal

Describe the bug

I tried to migrate to v5 following the migration guide.

We are only using the PayPal payment method.

After I call payPalClient.createPaymentAuthRequest() it returns me an error "Invalid URL". I can see this error coming from: BraintreeClient#sendpost() statusCode=422& errorResponse="{"error":{"message":"Invalid URL"},"fieldErrors":[]}"

Which url is this error pointing to?

I have setup app links following the APP_LINK_SETUP.md

I am setting same url in PayPal control panel & when I init PayPalClient like in the migration guide.

Here is my vaultRequest:

val vaultRequest = PayPalVaultRequest(false)
vaultRequest.billingAgreementDescription = "test"
payPalClient.createPaymentAuthRequest(this, vaultRequest)

To reproduce

val vaultRequest = PayPalVaultRequest(false) vaultRequest.billingAgreementDescription = "test" payPalClient.createPaymentAuthRequest(this, vaultRequest)

And create the request following v5 migration guide

Expected behavior

I should be shown the PayPal web view

Screenshots

No response

tdchow commented 2 weeks ago

Hey @mikkoville - Can you double-check that your App Link is a web link that uses the HTTP and HTTPS schemes?

https://developer.android.com/training/app-links#android-app-links

Note that this is different than the deep link URIs used in the previous deep link implementation.

mikkoville commented 1 week ago

@tdchow yes we are using HTTPS scheme for the app link.

I also specified the intent filter with autoVerify like in the demo app.

Do you have any insights which url is the error pointing to? Is it about our app link we pass to the PayPalClient?

tdchow commented 1 week ago

@mikkoville I believe the error is related to the appLinkReturnUrl passed into the PayPalClient constructor. This error is not defined in the SDK but is an API error response.

https://github.com/braintree/braintree_android/blob/45816f3d48591bd3ab2ba8a25270f9d1a816d2df/Demo/src/main/java/com/braintreepayments/demo/PayPalFragment.java#L68