【发布时间】:2018-01-16 09:38:03
【问题描述】:
我尝试整合stripe 提供的其他付款方式。我关注了文档,但似乎我过度阅读了一些内容(阅读了 10 次)。
首先我激活了付款方式。
我添加了库:<script src="https://js.stripe.com/v3/"></script>
我创建了一个 Stripe 客户端:var stripe = Stripe('pk_live_512dfvL8d63Kcs9d5Lsp548c6Sp');(使用测试密钥和可发布密钥进行了尝试)
我添加了一个 Elements 实例:var elements = stripe.elements();(虽然没有使用它)
根据选择的付款方式,会触发其他内容。那么这是我的代码:
function buyingProcess() {
console.log(choosenPaymentMethod);
if (choosenPaymentMethod == "mastervisa") {
// This works like a charm
} else if (choosenPaymentMethod == "giropay") {
stripe.createSource({
type: 'giropay',
amount: 1099,
currency: 'eur',
owner: {
name: 'Jenny Rosen',
},
redirect: {
return_url: 'https://shop.example.com/crtA6B28E1',
},
}).then(function(result) {
console.log(result);
// handle result.error or result.source
});
}
}
最后一个console.log 函数显示了源对象。在使用测试密钥console.log(result.error) 时指出,我必须使用可发布密钥。
感谢您的帮助。我写了 Stripe 团队。昨天这个时候,但我感谢任何帮助。谢谢。
【问题讨论】:
-
如果您正在寻找最新的 ASP.NET Web 表单中的 Stripe 结账解决方案,请查看演示:techtolia.com/Stripe - 从信用卡或借记卡、支付宝、微信支付、Bancontact、EPS 接收付款、giropay、iDEAL、Multibanco、Przelewy24、SOFORT、Secure Remote Commerce 和 Payment Request Button(Apple Pay、Google Pay、Microsoft Pay 和浏览器支付请求 API),通过 Stripe。
标签: javascript stripe-payments