过去 4 小时我一直在尝试,但这个问题没有解决。我正在使用 stripe.js 为比特币创建费用。
费用已成功创建,但创建费用后,函数“stripeResponseHandler”未调用。我尝试了很多事情但没有效果。 我的代码是
stripe.createSource({
type: 'bitcoin',
amount: 1000,
currency: 'usd',
owner: {
email: 'jenny.rosen@example.com',
},
}, stripeResponseHandler);
function stripeResponseHandler(status, response) {
console.log("here");
console.log(status);
console.log(response);
}
控制台上没有打印任何内容。我已检查我的仪表板事件和日志,并且正在创建费用。
提前致谢。
最佳答案
我还努力从 Stripe 的创建源响应中提取数据。这对我有用:
stripe.createSource({type: 'card', owner: {
name: 'Jenny Rosen'
}}).then(function(result, err) {
console.log(result.source)
console.log(err.source)
});
如果需要提取Id,请将result.source替换为result.source.id等。这是the API reference.
此外,请确保启用查看测试数据开关并使用 Stripe's test cards 。您可以在仪表板的开发人员> 日志下找到对您的 Stripe 帐户的所有调用。
关于javascript - 使用 stripe.js 在 stripe 中创建源后,stripeResponseHandler 函数未调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45339216/