api - Multiple charges to equal specified amount using Stripe -
getting confused on how should set up. need charge customer 2 separate amounts on 2 separate dates provide. provided total , able choose 2 dates charged , how on each date.
after reading through docs , faqs on stripe's website day, think might know how tackle this.
create customer.
setup plan specified amount want pay , calculate how many days until should charged using trial_end start on specified date.
listen first charge. cancel current plan, take second amount , preferred charge date (stored in database) , create new plan. again, using trial_end charge on correct date provided.
listen second charge , cancel plan.
is ideal way accomplish want? trying not waste bunch of time, have tight deadline project. appreciate insight. thanks!
i'd recommend following.
- create customer , store customer token
- store 2 dates in database
- write script looks 1 of 2 dates , tries run charge customer token. schedule cron or similar scheduler.
- on charge failure or denied, act accordingly
- on success, delete customer token, , act accordingly
Comments
Post a Comment