fix: optionally add name to customer creation (#43486)

pull/43501/head
Ahmad Abdolsaheb 2021-09-20 10:56:42 +03:00 committed by GitHub
parent 3a4889942b
commit cf309b5349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -184,7 +184,7 @@ export async function createStripeCardDonation(req, res, stripe) {
user
} = req;
if (!tokenId || !amount || !duration || !name || !userId || !email) {
if (!tokenId || !amount || !duration || !userId || !email) {
throw {
message: 'Request is not valid',
type: 'InvalidRequest'
@ -203,7 +203,7 @@ export async function createStripeCardDonation(req, res, stripe) {
const customer = await stripe.customers.create({
email,
card: tokenId,
name
...(name && { name })
});
customerId = customer?.id;
} catch {