fix: optionally add name to customer creation (#43486)
This commit is contained in:
@ -184,7 +184,7 @@ export async function createStripeCardDonation(req, res, stripe) {
|
|||||||
user
|
user
|
||||||
} = req;
|
} = req;
|
||||||
|
|
||||||
if (!tokenId || !amount || !duration || !name || !userId || !email) {
|
if (!tokenId || !amount || !duration || !userId || !email) {
|
||||||
throw {
|
throw {
|
||||||
message: 'Request is not valid',
|
message: 'Request is not valid',
|
||||||
type: 'InvalidRequest'
|
type: 'InvalidRequest'
|
||||||
@ -203,7 +203,7 @@ export async function createStripeCardDonation(req, res, stripe) {
|
|||||||
const customer = await stripe.customers.create({
|
const customer = await stripe.customers.create({
|
||||||
email,
|
email,
|
||||||
card: tokenId,
|
card: tokenId,
|
||||||
name
|
...(name && { name })
|
||||||
});
|
});
|
||||||
customerId = customer?.id;
|
customerId = customer?.id;
|
||||||
} catch {
|
} catch {
|
||||||
|
Reference in New Issue
Block a user