question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

STPPaymentHandler does not support concurrent calls to its API.

See original GitHub issue

Describe the bug We have a user that is unable to complete a payment. After completing the 3d secure flow the user receives the following error message: The current action is not yet completed. STPPaymentHandler does not support concurrent calls to its API.

Could not find any relevant pointers on what causes this error. Would appreciate some suggestions.

Thanks in advance.

Smartphone:

  • Device: iPhone 12 Prop
  • OS: iOS14.8

Lib version: “@stripe/stripe-react-native”: “^0.1.5”

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

2reactions
Sascha1251commented, Mar 7, 2022

I have the same issue on iOS and figured out, that it depends on the “deepLink” (whether a urlScheme is provided or not). In case I don’t set the urlScheme, then I have to close the browser manually and everything is working fine. In that case (see the following code), the await returns with a paymentIntent, and afterward, I can create another payment and everything is fine. const { error, paymentIntent } = await confirmPayment(clientSecret, { type: "Card" });

However, if I set the urlScheme and the application is opened from the “deep link” after a successful payment, it seems like the code above doesn’t return and therefore the action is not yet completed. In case I create another paymentIntent and try to confirm that, it doesn’t work, as the old action isn’t completed yet.

Therefore I think that the root cause of this issue is the missing handling in case the application is opened from a deep link. The issue only occurs in case you have a 3d secure flow (e.g. using the credit card “4000 0025 0000 3155”).

Edit: I found a solution for the issue with the deep linking. You need to call the “handleURLCallback” in the listener that is registered then stripe will resolve the action and afterward everything is fine. Below is the bare minimum of code that is needed in my case:

import { useStripe } from "@stripe/stripe-react-native";
const { handleURLCallback } = useStripe();

const handleDeepLink = async (url: string) => {
    if (url && url.includes("safepay")) {
        await handleURLCallback(url);
    }
};

useEffect(() => {
    const urlCallback = (event) => {
        console.log("event: ", event);
        handleDeepLink(event.url);
    };

    Linking.addEventListener("url", urlCallback);
    // should remove event listener here
}, []);

@scesbron: Maybe this will help you as well. In case something is not clear, please let me know and I will try to help.

0reactions
charliecruzan-stripecommented, Aug 9, 2022

We have docs for the URL callback handling that @Sascha1251 mentions above: https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url 😃

@Roundups I would double-check those docs, and maybe there is a missing step in the URL scheme setup for a plain RN app that’s missed and needs to be handled by an Expo Config plugin or similar?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stripe Error: "Should not handle multiple payments at once."
The problem is that it gets verified in Stripe. The SetupIntent appears in logs but the app crashes. I will share my code...
Read more >
Stripe Implementation problem on Swift 5. Please help.
In this task I am trying to implement Stripe into the app. The error I get is from "card": Cannot convert value of...
Read more >
Stripe API reference – SetupIntents – curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >
STPPaymentHandler Class Reference
It can present authentication UI on top of your app or redirect users out of your app (to e.g. their banking app). Seealso....
Read more >
stripe - Bountysource
This works to collect credit card payments. However when using ApplePay, the sheet shows an error that no API key was provided. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found