3 ms·
I implemented billing at WakaTime with Stripe, Braintree, and Coinbase as swappable payment providers. It's definitely a source of edge case bugs, but overall i
by welder 4y ago
I implemented billing at WakaTime with Stripe, Braintree, and Coinbase as swappable payment providers. It's definitely a source of edge case bugs, but overall it works pretty well. It supports prorating subscriptions across providers, monthly & yearly billing, trails, discounts.
* We don't remit taxes for customers because that would be impossible to build in-house, but everything else was achievable.
* We have tons of logging, and generate transient Quotes on our end, then check that the expected charge matches what the payment provider actually charged.
* Each Quote is reproducible, so if any bugs come up we can give the "create quote" code the same input and see what went wrong.
* What helped when building was hourly tasks running in the background to make sure customers who should be billed were being charged, and make sure we didn't double charge any customers, and then alerts so we could find and fix those bugs.
I would do it again to support both PayPal and Stripe, but it's definitely a source of complexity for the code base.