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

Not closing the webview after payment is successful #37

Open
eskiesirius opened this issue Jul 7, 2020 · 11 comments
Open

Not closing the webview after payment is successful #37

eskiesirius opened this issue Jul 7, 2020 · 11 comments

Comments

@eskiesirius
Copy link

No description provided.

@mitesh-db
Copy link

can you show me your code please
@eskiesirius

@nzankich
Copy link
Contributor

make sure you have this code in your AppDelegate.m

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [[RNPaypal sharedInstance] application:application openURL:url options:options];
}

@jitenderbadoni
Copy link

Face same issue while implementing this. After doing some search on linked braintree sdk. I found the issue is with Chrome as per the issue mention here. Putting this comment so due to this issue people won't avoid using this.

@nzankich
Copy link
Contributor

@eskiesirius check to make sure you have the code I've written above. If you're still having issues check out the example app in the newest version of the app. If you are still seeing issues lmk and I will reopen

@nzankich
Copy link
Contributor

Had another report of this bug with some more details here so I'm going to reopen
#49 (comment)

@nzankich nzankich reopened this Oct 22, 2020
@edc123
Copy link

edc123 commented Dec 8, 2020

Hey all, just an idea... and new to this whole NativeModule stuff: but could a solution be to use NativeEvents (see example: https://reactnative.dev/docs/native-modules-android#sending-events-to-javascript) rather than promises?

That way we get the nonce back (which has no problem being created as far as I can see) - we then wouldn't care about the tabs that open / don't close in the background. The known issue would then become a bunch of tabs potentially but relatively harmless?

Seems less terrible than no nonce at all.

For example in RNPaypalModule.java,

private void sendEvent(String eventName,
                       @Nullable WritableMap params) {
    _reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}

...

WritableMap cancelResult = Arguments.createMap();
cancelResult.putString("message", "User cancelled one time payment");
sendEvent("user_cancellation", cancelResult);

...

sendEvent("success_nonce_created", result);

@DangKhoi1997
Copy link

DangKhoi1997 commented Dec 8, 2020

@edc123 @nzankich hi Bros , i'm facing issue with android device. I 've tested many times but it still didn't work. The problem is the requestOneTimePayment or requestBillingAgreement only run 1 time and after that it does nothing. I try it in try catch but not catching anything. Any workaround guys ...

@nzankich
Copy link
Contributor

@edc123 generally it's a good idea to use promises rather than a listener in a case where an event is only going to be triggered once. I would rather fix this the right way rather than adding a hack but worse case it's something we could do

@nzankich
Copy link
Contributor

@edc123 @DangKhoi1997 have you tried reproducing this with the example app? I'm curious if there's a setup step missing

Also the device/version of android would help too

@edc123
Copy link

edc123 commented Dec 21, 2020

Hey @nzankich - I'd be happy to give that a go, but would need time as I have recently switched to a replacement laptop. This was both on a Pixel 4 with Android 11, an old Moto X with Lollipop, and also tested using Android devices on browserstack.

@aganov
Copy link

aganov commented May 19, 2021

This issue is supposed to be resolved in the recent v4 beta versions of the Braintree SDKs

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

6 participants