Я пытаюсь обновить имя и дату истечения срока годности кредитной карты в Stripe с использованием облачных функций Firebase, основываясь на документации https://stripe.com/docs/api/cards/update. Вот мой код ...
exports.updateStripeCard = functions.https.onRequest((request, response) => {
console.log(request.body);
return cors(request, response, () => {
stripe.customers.updateSource(
request.body.customerId,
request.body.cardId,
{ name: request.body.name
,exp_month: request.body.exp_month
,exp_year: request.body.exp_year}
).then((update) => {
// asynchronously called
response.send(update);
return true;
})
.catch(err =>{
console.log(err);
response.send(err);
return err;
});
})
});
Когда я проверяю его с помощью customerId, cardId, имени, месяца и года, я получаю сообщение об ошибке
'Received unknown parameters: name, exp_month, exp_year'
Я даже пытался обновить только name, как в примере из документации, и получил ошибку «Получены неизвестные параметры: имя». Как же я могу обновить название карты, месяц и год? Неверный синтаксис?
Вот мой пакет. json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"dependencies": {
"firebase": "7.14.0",
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.6.0",
"geofire": "^4.1.2",
"stripe": "^8.39.2"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
Любая помощь будет принята с благодарностью!
Спасибо.