Using Multiple Gateways?

27 views
Skip to first unread message

.jonah

unread,
Aug 21, 2015, 6:57:20 PM8/21/15
to cfpayment
Hello! I've got a site using a standard payment gateway (Authorize.net) and now want to add a PayPal Express checkout option. cfPayment supports PP Express, so that's straightforward.

What I'm wondering is if any of you have used multiple gateways in a single app?  (Mine is Coldspring/Mach-II) There's talk of a High-Availability API in the docs but that doesn't seem to be  built out. Any thoughts/recommendations/approaches? 

Thanks!
.jonah

Brian G

unread,
Aug 22, 2015, 1:15:32 AM8/22/15
to cfpayment
Jonah,

I use 4 different gateways in my app under Coldspring with Model-Glue. I never released a high-availability API because I didn't wind up using it in that way, but rather different gateways for different purposes (e.g., USD vs. CAD, direct deposit/ACH vs. credit cards). Technically speaking most merchant agreements forbid you to have other merchant processing agreements so there's that, but if you have specific questions about using it, ask away.

Personally I have a PaymentService which I pass in my four gateways and then the service determines which one to use based on various app-specific conditions.  Sometimes as simple as:

function charge() {

if (type = cc)
    if (currency = usd)
      cfpayment-usd-cc.charge(args)
    else if (currency = cad)
      cfpayment-cad-cc.charge(args)
else if (type = eft)
   cfpayment-usd-eft.charge(args);
/if

}

The idea is to abstract away from the app how the charging is done so you can pass in whatever normal domain objects you have in your app.  In my case, I pass in a club and a club has a locale and currency associated with it and I make my gateway choice based on that.  I have a private getGateway() method in my PaymentService which takes a club as an argument and returns the appropriate cfpayment gateway.

I'm in the process of moving payment providers right now and I can say without a doubt cfpayment has made the whole thing a lot less painful.  I'm running multiple systems in parallel right now and slowly migrating customers without rewriting the whole deal.


Brian
Reply all
Reply to author
Forward
0 new messages