小编Mik*_*995的帖子

Stripe中没有return_url参数如何显示支付成功

我在将 Stripe 集成到我的 React 应用程序中时遇到一个问题。我使用 Stripe 官方文档中的代码。它按预期工作。我的问题是如何在不使用 return_url 的情况下检查付款是否成功?我需要使用返回网址吗?我在 Stripe 文档中找到了重定向:“if_required”选项,但这没有任何作用。如果我将此对象放入confirmPayment 方法中,我只会在控制台中出现错误问题。我希望场景是付款成功,客户端导航到某个确认页面并成功获取消息付款。

\n

应用程序.jsx

\n
import { loadStripe } from "@stripe/stripe-js";\nimport { Elements } from "@stripe/react-stripe-js";\n\nimport CheckoutForm from "./CheckoutForm";\nimport "./App.css";\n\n// Make sure to call loadStripe outside of a component\xe2\x80\x99s render to avoid\n// recreating the Stripe object on every render.\n// This is your test publishable API key.\nconst stripePromise = loadStripe("pk_test_51LmE9VAoYs2flpvClDqeh0f1vhaDUkBM0bRGaJgThjtaMd3PiPUGQOHjn9f7XW1HGgSQBvTq3xoLy9PovlWLPUnR0031srjgyb");\n\nexport default function App() {\n  const [clientSecret, setClientSecret] = useState("");\n\n  useEffect(() => {\n    // Create PaymentIntent as soon as the page loads\n …
Run Code Online (Sandbox Code Playgroud)

stripe-payments

5
推荐指数
1
解决办法
4162
查看次数

标签 统计

stripe-payments ×1