I’m building a SaaS application that currently uses a single payment gateway for credit card subscriptions.
When a customer subscribes, the payment gateway stores their credit card information and gives us a gateway-specific client id. We use that identifier for subsequent recurring charges.
I’m trying to understand how this problem is normally solved if I want to support multiple payment gateways in the future.
For example:
Customer
|
v
Gateway A
|
+-- stores card
+-- returns gateway client id
Later, I might need to use Gateway B instead of Gateway A, either because I want to migrate providers or because Gateway A is temporarily unavailable.
However, the token from Gateway A cannot be used with Gateway B.
I also cannot store the customer’s credit card number in my own database.
I’m specifically interested in recurring credit card subscriptions, not just one-time payments.
What is the standard way to solve this problem?