我正在使用 Nodejs 和 ReactJS 在 Web 应用程序中实现条纹支付。
如果我在 localhostm 上测试我的付款,一切正常!但是,如果我在http://beta.mywebsite.com上推送相同的代码,我会在服务器端收到此错误。客户端一切似乎都有效..
信息:
尽管您确实将授权标头设置为“null”,但您没有提供 API 密钥。使用承载身份验证,您的授权标头应类似于“Authorization: Bearer YOUR_SECRET_KEY”。有关详细信息,请参阅https://stripe.com/docs/api#authentication ,或者我们可以通过https://support.stripe.com/提供帮助
服务器端
const stripeClient = stripe('sk_test*************')
stripeClient.setApiVersion('2017-06-05')
const Stripe = {
pay (payload) {
return new Promise((resolve, reject) => {
if (!payload || !isObject(payload)) throw new BadCreateRequest('Stripe: pay. Unexpected parameters.')
let { user, total, token, cartId } = payload
stripeClient.customers.create({
email: token.email,
source: token.id
})
.then(customer => {
return stripeClient.charges.create({
amount: total * 100,
currency: 'eur',
customer: customer.id,
description: `Paid …Run Code Online (Sandbox Code Playgroud)