我注册了一个Stripe帐户,并遵循了一些简单的步骤来启动和运行Node。我只是安装了这个包,并用我的测试密钥测试了一个支付意图:
const Stripe = require('stripe');
const handleStripe = async () => {
const stripe = Stripe(testKeyString);
console.log(“we make it here”);
try {
const paymentIntent = await stripe.paymentIntents.create({
amount: 1000,
currency: 'usd',
payment_method_types: ['card'],
receipt_email: '[email protected]',
});
//we never make it here
console.log(paymentIntent);
}
catch(err){
//we never make it here either
console.log(err);
}
}
控制台记录了“我们在这里制造”,但没有其他内容。诺言永远不会被解决。
我怀疑这可能是stripe npm包的一个bug。有没有人知道为什么诺言永远不会退还?
编辑:对不起,我在这里浪费了大家的时间。我按照文档的QuickStart,它说“安装一个客户端库”,我认为它是为前端。因此,我犯了一个非常愚蠢的错误,认为从前端使用密钥进行付款意图是一个好主意。我刚刚开始使用条纹API,并且我有一个不好的开始。感谢您的评论和回答
谢谢
转载请注明出处:http://www.0591kyj.com/article/20230328/1264375.html