简体   繁体   中英

StripeInvalidRequestError: You cannot accept payments using this API as it is no longer supported in India

I have been building an ecommerce web application and wanted to Integrate my Checkout with the Stripe API, but when i run the application and make a transaction. I get the following message error..

I came to find that Payment Intent API are to be used as per new RBI regulations, I cannot get how to change my code so that it again accepts my transaction with a 201 response. Here is my code snippet.

import StripeCheckout from "react-stripe-checkout";

const STRIPE_PUBLISHABLE =
  "my_api_key";

const onToken = (user, checkout) => (token) => checkout(user, token.id);

const Checkout = ({ amount, user, checkout }) => (
  <StripeCheckout
    amount={amount * 100}
    token={onToken(user, checkout)}
    currency="INR"
    stripeKey={STRIPE_PUBLISHABLE}
  />
);

export default Checkout;

Your code is using Stripe's Legacy Checkout product which was deprecated back in 2019 already. You can't really "modify" that code since it's not supported in India due to the new RBI regulations. You have to rewrite your integration instead to use a different product.

The easiest option is to use Stripe's "newer" product called Payment Links. This allows you to configure a payment flow with a URL for a certain product: https://stripe.com/docs/payments/payment-links

Alternatively, you can use the newer version of Checkout which is hosted by Stripe and handles all the payment collection for you: https://stripe.com/docs/payments/checkout

Finally, if those solutions don't work for you, you will have to use the Payment Intents API to accept a payment and the Payment Element to collect card details: https://stripe.com/docs/payments/accept-a-payment

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM