Hey.
I asked about payment gateways on LaraChat (Slack). Still not fully sure on how to go about it, so it'd probably be more clear to ask here.
Essentially, I'm trying to dynamically be able to provide multiple payment gateways to my customers (or the website users, if you like). The solution we came to in the Slack was to use an abstract gateway and gateways extend that abstract gateway. Having a bit of trouble with the implementation. I have a PaymentInterface and an AbstractGateway, but I have no idea how to go about it tbh.
Essentially, I have multiple payment gateways, let's say Stripe and PayPal for saying. So I want to process a payment so I want to dynamically get the gateway, and then process the payment. Processing payments is simple since Stripe will POST to /callback/stripe and PayPal to /callback/paypal so they're all separate.
Problem comes with refunds, invoice management (admins), etc. I need to dynamically get the gateway from its identifier and then perform actions, so I was thinking like:
$gatewayId = 'paypal'; Gateway::get($gatewayId)->refund($transactionId)
But if the gateway was Stripe, no difference in code except the ID $gatewayId = 'stripe'; Gateway::get($gatewayId)->refund($transactionId)
How they're processed is completely different. I'm not sure if I'm thinking of it the right way, and if I am, I have no idea how to effectively go about it.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community