javascript - How can I give a customer a non-refundable credit towards their subscription using the Stripe API? -


my app charges premium customers $x.00 per month, however, actions give customers credit against monthly subscription fee. example, if customer submits record database, given credit (stored in database). each credit earn give them $0.50 off of next month's subscription, however, if cancel subscription, not want seem owe them money (it should usable towards subscription fees). best way achieve through stripe api?

if makes difference, using rails 4, ruby 2, stripe, koudoku subscriptions, , devise authentication.

thanks!

you want set app handle stripe web hooks if haven't done so. when new invoice created, if have web hook url set up, notify via hook , wait hour before processing payment. design setup want.

when notified invoice has been created, if there credits user, create 1 or more negative invoice items represent credits.

since aren't creating credits in stripe until right before payment processing, scenario of them canceling credit doesn't apply.

you can of course other things when adding negative invoice items credits check make sure aren't crediting them more invoice total.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -