(node:26431) UnhandledPromiseRejectionWarning: Error: Stripe: Unknown arguments ([object Object]). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to POST `/charges`)
at getRequestOpts (/home/fractaluser/Desktop/upwork/dylan/facebook_marketing/marketing_backend/node_modules/stripe/lib/makeRequest.js:37:11)
at /home/fractaluser/Desktop/upwork/dylan/facebook_marketing/marketing_backend/node_modules/stripe/lib/makeRequest.js:68:18
at new Promise (<anonymous>)
at makeRequest (/home/fractaluser/Desktop/upwork/dylan/facebook_marketing/marketing_backend/node_modules/stripe/lib/makeRequest.js:66:10)
at Constructor.create (/home/fractaluser/Desktop/upwork/dylan/facebook_marketing/marketing_backend/node_modules/stripe/lib/StripeMethod.js:31:7)
at /home/fractaluser/Desktop/upwork/dylan/facebook_marketing/marketing_backend/server.js:50:20
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:26431) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26431) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
app.post("/payment", (req, res) => {
const { product, token } = req.body;
const { idempontencyKey } =product.idempontencyKey;
return stripe.customers.create({
email: token.email,
source: token.id
}).then(customer => {
stripe.charges.create({
amount: product.price * 100,
currency: "usd",
customer: customer.id,
receipt_email: token.email,
description: product.name,
shipping: {
name: token.card.name,
address: {
country: token.card.address_country
}
}
}, {idempontencyKey})
})
.then(result => res.status(200).json(result))
.catch(err => console.log(err))
})
Здесь я пытаюсь интегрировать и совершать платежи (тестовый режим), используя полосу из node.js Но, делая запрос, я получаю ошибку выше.
Ошибка для меня совершенно не понятна
Пожалуйста, посмотрите, где я делаю ошибку