#mahesh dhaka-charge-multiple

1 messages · Page 1 of 1 (latest)

wet zenith
#

Unfortunately I don't think there is a way to batch create them like that

#

Can I ask what you are trying to do with that?

spark vine
#

Everyday, I get a list of customers with their stripe customer id and amount, and I charge them by running a loop on the above mentioned code

#

I wanna do something like this : const charges = await stripe.charges.create([{
amount: amount1,
currency: 'cad',
customer: 'cus_abcd1',
capture: false
},{
amount: amount2,
currency: 'cad',
customer: 'cus_abcd2',
capture: false
},{
amount: amount3
currency: 'cad',
customer: 'cus_abcd3',
capture: false
}]);"

#

At the moment I am doing this: for(let customer of customers){const charge = await stripe.charges.create({
amount: customer.amount,
currency: 'cad',
customer: customer.id,
capture: false
});}

wet zenith
#

Ah gotcha, unfortunately we don't have an interface for batch creation like that.

#

And I am assuming it is the time to make multiple calls that is the issue for you, not the interface?

spark vine
#

correct