Я использую Stripe в качестве способа оплаты в моем проекте, используя Node.js. Я слежу за документами , чтобы заархивировать это.
Мне нужно создать карту со следующей информацией: номер кредитной карты, имя человека, срок действия и код безопасности.
Это мой код:
const createCard = (customer, cardInfo) => {
return new Promise((resolve, reject) => {
stripe.customers.createSource(
customer,
{
source: {
object: 'card',
...cardInfo
}
},
(err, card) => {
if (err) {
debug('There was an error while creating a new card')
reject(err)
}
debug(card)
resolve(card)
}
)
})
}
Объект cardInfo
выглядит так:
{
"number": "4242424242424242",
"exp_month": "11",
"exp_year": "2021",
"cvc": "123",
"name": "My name"
}
Вот что я получаю в ответе обратного вызова:
Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing."
Я использую свой ключ API разработки.