fix: optionally add name to customer creation (#43486)
parent
3a4889942b
commit
cf309b5349
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue