我正在使用 https://stripe.com/docs/payments/checkout 中所述的 strip 结帐。
在服务器端,我创建了一个新的 strip 客户(如果还没有的话),并使用该客户 ID 创建一个结帐 session 。然后使用 strip api重定向到结帐
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: '{{CHECKOUT_SESSION_ID}}'
}).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`.
});
在结帐页面(由 strip 托管)中,有一个预先填充但可编辑的电子邮件字段。我让客户更改了该电子邮件地址。有没有办法可以在 strip 结帐只读字段上设置电子邮件地址?
最佳答案
一个可能的解决 :
您可以使用客户邮箱 而是 客户 创建 session 时的参数。
在这种情况下,用户无法更改电子邮件字段的值。
然后,如果您需要使用 API 添加一些数据,您可以获取创建的客户并对其进行更新:https://stripe.com/docs/api/customers/update
但是,问题是 Stripe 会为每次结账创建一个新客户。
关于javascript - Stripe 结帐 - 删除或使电子邮件字段只读,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61726404/