So I am building an app that acts similarly to kickstarter/gofundme etc. in that once a price goal is met, it charges all the contributing customers. My process is, when a customer contributes towards the price goal I create a stripe customer and store their id:
customer = stripe.Customer.create(
email = <user_email>,
source = <stripe_customer_token>
)
I store this information in an array in my database. Once the price goal is met, I iterate over the array charging each customer using that initial card that stripe verified as legitimate.
for customer in customer_array:
charge = stripe.Charge.create(
amount = <amount>,
customer = <customer>,
)
The problem I foresee is that sometimes these price goals will be up for weeks. On day 1, a customer could contribute and be verified by stripe as a legitimate card, but in 3 weeks that card could expire or be cancelled etc. Is there any way to run some sort of verification on a customer token before charging it to make sure it's still legitimate? I would hate to iterate over 9/10 customers in an array and charge them for being legit, then hit the final customer in the array with an invalid card. I am using stripe.js so hopefully there's a solution without incorporating the stripe api. Thanks.