我正在尝试在 ReactJS 中实现 Stripe 函数“重定向到结帐”。我一直在环顾四周,似乎没有任何软件包可以帮助您做到这一点。
const stripe =
Stripe('key');
stripe.redirectToCheckout({
items: [
// Replace with the ID of your SKU
{sku: 'sku_123', quantity: 1}
],
successUrl: 'https://your-website.com/success',
cancelUrl: 'https://your-website.com/canceled',
}).then(({error}) => {
// If `redirectToCheckout` fails due to a browser or
network
// error, display the localized error message to your
customer
// using `error.message`.
});
这是我得到这个源代码的地方:https : //stripe.com/docs/stripe-js/reference#stripe-redirect-to-checkout
StripeJS 似乎只支持不接收产品 SKU 作为参数的标准结账