Comment by agreeahmed

4 days ago

This would be awesome, it's just really hard to manifest because every payment processor is different, has different life cycle events, etc. They also have different risk and antifraud functions, which you have to consider because they shape how their checkout components behave. And then they also all have slightly different payment methods that they support, each of which behave slightly differently.

You can kind of get something that approximates this with a PCI vault or a payments orchestrator, but it's really hard -- maybe impossible -- to fully abstract away all the differences.

or maybe you dont abstract it away, let each payment api behave the way their service supports, add some common functions on top that users can use and for specific functions they always look for specific classes. Ex class Gateway { abstract function send(), abtstract function receive() } class Visa extends Gateway { send()...receive()..., otherVisaSupportedFunctions() } class MasterCard extends Gateway { ....}