【发布时间】:2019-11-10 01:20:31
【问题描述】:
我想知道是否可以直接从前端发送 Stripe 请求,因为我没有后端。请注意,安全不是问题,因为我不会部署该项目,甚至不会以任何形式或形式使用它。
我正在考虑使用 axios 代替 curl,它应该看起来像这样:
On the Stripe official doc, they use curl on the back-end
我还想知道是否还有其他需要传递的密钥。有一个密钥和一个可发布的密钥。我认为不需要可发布的密钥。另外,我需要激活我的帐户才能使用它吗?我不打算在宠物项目之外使用它。
axios({
method: 'post',
url: 'https://api.stripe.com/v1/charges',
header: {
Authorization: 'sk_test_IvnLvlpEpskxJA8u7eEsAOBr00e7fmPyMZ'
},
data: {
amount: '999',
currency: 'cad',
description: '',
source: 'tok_visa'
}
});
我希望 curl 请求会产生相同的结果。
【问题讨论】:
标签: javascript stripe-payments