如何解决Stripe 定期支付与 masterpass 集成
有没有办法使用 Stripe 使用 Masterpass 进行定期付款?
Google Pay 和 Apple Pay 可以通过返回用于 Stripe 处理的卡令牌来使用 Stripe 进行定期付款。有没有办法用Masterpass获得这样的卡令牌?
解决方法
是的,您可以,您可以使用从 Secure Remote Commerce 返回的数据创建 PaymentMethod(Masterpass 现在自称),然后使用它开始订阅。
遵循 Stripe 的 SRC 指南,然后当您到达“complete the payment”部分时,您可以这样做:
// create the payment method
const pm = await stripe.paymentMethods.create({
type: 'card',card: {
masterpass: {
cart_id: cartId,// your unique cart ID
transaction_id: req.query.oauth_verifier,// get this from the SRC callback URL
},}
});
// create the Stripe customer
const cust = await stripe.customers.create({
payment_method: pm.id,});
// create the subscription
const sub = await stripe.subscriptions.create({
customer: cust.id,items: [{
price: {{PRICE_ID}},}],default_payment_method: pm.id,});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。