我正在使用 firebase 函数进行条带支付集成。此特定功能用于使用条带注册客户。
节点版本 10.15.3 ,
npm 版本 6.9.0 ,
"ecmaVersion": 6 in .eslintrc.json
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const stripe = require('stripe')(functions.config().stripe.testkey)
exports.createStripeCustomer = functions.auth.user()
.onCreate(async (user) => {
const customer = await
stripe.customers.create({email: user.email});
await admin.firestore()
.collection('stripe_customers')
.doc(user.uid)
.set({customer_id: customer.id});
});
Run Code Online (Sandbox Code Playgroud)
代码与 github 示例https://github.com/firebase/functions-samples/blob/master/stripe/functions/index.js上提供的 firebase 平台相同
解析错误:意外的令牌 =>
如果我将 .eslintrc.json 中的 "ecmaVersion": 6 更改为 "ecmaVersion": 8
then error is .onCreate(async (user) => {
^
SyntaxError: Unexpected token (
Run Code Online (Sandbox Code Playgroud)
我想正确部署功能,以便用户可以在 firebase 存储中的条带和日期存储上注册
javascript node.js stripe-payments firebase google-cloud-functions