0

I have a website on MERN STACK in which I have Stripe implemented, the problem is when I try to pay through Stripe on a desktop/PC it works fine but when I try the same thing on a browser using mobile it redirects me to Stripe website and says an error occurred.

Image

This image shows the redirected link when using Stripe payment on mobile.

Below is the code for Stripe:

The request:

  const [stripeToken, setStripeToken] = useState(null);
  //  const navigate = useNavigate();
  const onToken = (token) => {
    setStripeToken(token);
    // console.log(token);
  };

  useEffect(() => {
    const makeRequest = async () => {
      try {
        const res = await userRequest.post("/checkout/payment", {
          tokenId: stripeToken.id,
          // amount: order.totalPrice,
          amount: 172500,
        });

        history.push("/success", {
          stripeData: res.data,
          // products: cart,
        });
      } catch (err) {
        console.log(err);
      }
    };
    stripeToken && makeRequest();
  }, [stripeToken, history]);

  const orderId = match.params.id;

<StripeCheckout
 name="CCBS Shop"
 billingAddress
 shippingAddress
 description={`Your total is ${order.totalPrice}`}
 amount={172500}
 token={onToken}
 stripeKey={KEY}
>
fatihyildizhan
  • 8,614
  • 7
  • 64
  • 88
  • Could you share where you reference the implementation from and how and where the redirection is? It's unclear which Stripe product you use. If you use Stripe Checkout Session for payment, this should be the integration guide: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout – yuting Jan 03 '23 at 01:46
  • The issue is that stripe working fine on my webpage. As i also have an app so once I go through my android app and try to checkout it redirects me to stripe checkout page, not opens stripe modal and also gives an error on stripe checkout page: "Sorry, There was a problem loading Checkout. If this Persist try a different browser". And in the meanwhile when i open my website through android mobile it redirects me to stripe.checkout.com etc page and didnt gave any error but checkout is not completed. – Tauseef Ahmed Jan 03 '23 at 17:55
  • Do you open Stripe Checkout page within your app or use browser such as Chrome on mobile? – yuting Jan 05 '23 at 01:43

0 Answers0