目前我在 angularjs 中使用舊的條帶結帳形式(在彈出視窗中打開),現在我想使用 redirectToCheckout 流程將條帶升級到版本 3。
如何將 angularjs 中的 Stripe v3 與自定義產品集成?我無法將我所有的產品都添加到條帶中。
我目前的代碼是這樣的:
var stripe = Stripe(data.stripeKey);
stripe
.redirectToCheckout({
lineItems: [
// Replace with the ID of your price
// Here i want to add custom product names and price for that product
{price: "123", quantity: 1},
],
mode: 'payment',
successUrl: 'https://your-website.com/success',
cancelUrl: 'https://your-website.com/canceled',
})
.then(function(result) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
還有,angularjs是restapi的前端,所以一切都由request和response來管理,那么如何實作這里面的charge和capture流程呢?(這可以在沒有 webhook 的情況下實作嗎?)
uj5u.com熱心網友回復:
您不能將“ad-hoc”價格與 client-only 一起使用redirectToCheckout。相反,您需要引入一個服務器端組件來創建一個 Checkout Session,您可以在其中使用該price_data引數。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/420640.html
標籤:
