For SaaS applications, I think Lago is pretty neat, for example: https://www.getlago.com/ (open source, YC S21)
And for ecommerce, there’s so much solutions that I don’t know what to recommend. If you’re looking for something headless, I’ve heard good things about Medusa (open source): https://medusajs.com/
> [...] use Stripe in a way that allows you to switch to another payment provider
You can still use Stripe via self hosted Lago, and replace it with something else if they ban you.
For subscriptions, achieving portability is much trickier.
I would ensure that any payment processing can be done through a range of processors, so that if any one of them becomes unavailable my store is not affected and I can continue taking payments.
I would also route payments through the processors dependent on cost. Some rails are more expensive for particular transaction types or countries, etc. Being able to switch between them at will is extremely useful.
It’d be unreasonable for most folks who just want to sell regular products and deal with marketing and sales. Those become the biggest tasks once they start getting traction (ask any relatively successful indie hacker). Paying the processor’s fee is worth it for most