Open mgroger opened 7 years ago
Would love it - I'm not an Authorize.net user so would be looking for a contributor. I can provide technical guidance. All one has to do is write the glue to translate authorize.net parameters into cfpayment parameters.
@cypersonic made lot of progress related to this & some more work, Not sure, why he haven't made PR for those? https://github.com/cmd-ltd/cfpayment/commit/df9d7ad54cba431dbee92d6593683fd13d5fc38e
@cybersonic I think you were mis-tagged above?
Hi, Does this library work with Authorise.net? I mean the gatway is there but I don't see the required userid and transaction id params in the authorize.cfc file. If it could be used to charge credit card, please guide me into an example or some pointers to it.
would something like this work
// initialize gateway
cfg = { path = "gateway.authorizenet.authorizenet", **name = "xxx", transactionKey = "yyy"** };
svc = createObject("component", "cfpayment.api.core").init(cfg);
gw = svc.getGateway();
// create the account
account = svc.createCreditCard().setAccount(4242424242424242).setMonth(10).setYear(year(now())+1)
.setFirstName("John").setLastName("Doe");
// in cents = $50.00, defaults to USD but can take any ISO currency code
money = svc.createMoney(5000);
// charge the card
response = gw.purchase(money = money, account = account);
// did we succeed?
if (response.getSuccess()) {
// yay! look at response.getResult() or response.getParsedResult()
// verify response.isValidAVS() or response.isValidCVV()
} else {
// check response.getStatus(), output response.getMessage()
}
sorry if its somewhere explained, and I overlooked it. New to CF and this.
This question has been around for a while, so let me give some general advice. A more modern solution would be to find their REST endpoint and just run
Why?
@jmohler1970 Thanks for your reply. I was afraid this was gonna be the case. But your advise is great and I'll look at their site for any REST implementation. They have API endpoints that accepts JSON and XML so most probably I'll have to roll my own code. Thanks again.
I did a lot of the Auth.Net work on this a while back but have since stopped working for that client and don't have the source code.
I would really suggest using their rest end point directly. IIRC it was a real PITA otherwise. If there is a more modern approach use that.
Two quick additional words of advice.
Postman is your friend. If you can do it in Postman, you can do it in CF
CFML does not document it very much but [:]
ordered structs are good for you sanit
As are making structs via mystruct['key']
and not mystruct.key
will make things much easier.
@cybersonic You are absolutelly right about that :), looking into their site now.
@jmohler1970 I read about the structure stuff somewhere and you confirmed it for me. Awesome tips. Really grateful. And yes postman seems a sane option to start with.
I'm not good at this stuff otherwise I would say I'll try a PR. Wished I could.
I can't remember which provider it was but they wanted ordered structs in JSON and that was just mind-blowing to develop against if you didn't know!
I think I had to deal with that once.
Some company internally converted JSON input into XML. JSON is normally not position sensitive, but XML is. So you had to create a JSON with data in the right order [sic] so that internally it could create the XML.
No where was that documented.
O wow, Now I get it. such quirks are really difficult to deal with in CF world. I've been bitten by such scenarios a couple of times. One such thing is CF and lucee differences for handling JSON and form[] arrays.
@bsienn - I'd recommend still using cfpayment as your base library but echo what Mark said about integrating against the REST API directly. cfpayment still provides valuable base functionality to help abstract away gateway-specific implementations. Even if you never switch providers, some of the abstractions may be helpful in building an elegant system.
@ghidinelli HI, Thanks for your reply. I'm no where near as much skilled in libraries as the contributors of this project. But I do have plan on making payment gateways for stripe, 2checkout and paypal so that I could use them for my clients' projects.
I'm just starting my career as a freelancer and these payment gateways are essential in custom development.
I do have 4+ years of developments experience in php, vuejs and 2+ in CF. I'll try to understand how this project works and will try to complete the authorize.net gateway near future. I've not tested stripe & paypal of this library, hopefully they are compatible with current APIs of the payment processors. Hoping to be part of this project.
Any plans to add support for the new Authorize.net API?