Using Multiple Gateways?

已查看 27 次
跳至第一个未读帖子

.jonah

未读,
2015年8月21日 18:57:202015/8/21
收件人 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

未读,
2015年8月22日 01:15:322015/8/22
收件人 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
回复全部
回复作者
转发
0 个新帖子