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

🐛 createPlatformPayPaymentMethod function hangs when payment sheet is closed or if apply pay is completed #1781

Open
manan057 opened this issue Nov 26, 2024 · 0 comments

Comments

@manan057
Copy link

manan057 commented Nov 26, 2024

Describe the bug
In the test environment when processing payments with apple pay the createPlatformPayPaymentMethod function hangs randomly. (Code snippet below) What's strange is that Apple Payment would work once and for subsequent times it will hang, the paymentsheet popups sometimes and disappears right away before the user interacts or sometimes it doesn't even show at all. Google pay works fine as expected.

I believe it has something to do with the Apple Payment Sheet and stripe package interaction with the paymentsheet. Also if you close the apple payment sheet when payment is not complete it would also get hung.

@stripe/stripe-react-native
version: "0.38.6"


initStripe({
    publishableKey: clientKey,
    stripeAccountId: merchantAccount,
    merchantIdentifier: merchantId,
  })
    .then(() =>
      createPlatformPayPaymentMethod({
        applePay: {
          cartItems: parsedApplePayItems,
          currencyCode: currencyCode,
          merchantCountryCode: paymentCountryCode,
        },
        googlePay: {
          merchantCountryCode: paymentCountryCode,
          currencyCode: currencyCode,
          merchantName: merchantConfig.merchantId!,
          testEnv: testMode,
          amount: googlePayAmount,
        },
      }),
    )
    .then(({ paymentMethod, error }) => {
      if (error) {
        if (error.code !== PlatformPayError.Canceled) {
          console.error('error in dynamic platform (Apple Pay / Google Pay) payment hook', {
            error,
          });
        }
        store.dispatch(setActivityIndicator(false));
        throw error;
      }

      return {
        token: paymentMethod?.id,
      };
    });

Expected behavior
The function shouldn't hang. It should error out or return a response.

Screenshots
If the payment sheet is closed in this instance then createPlatformPayPaymentMethod function hangs (the function never returns a result)
Screenshot 2024-11-18 at 11 05 03 AM

Desktop (please complete the following information):

  • OS: iOS
  • Version: 18.0
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

1 participant