Jump to content

Guidelines to writing a new gateway module?


Guest vostok4

Recommended Posts

Guest vostok4

I am going to write a gateway module for my merchant (Moneris) but I was wondering if there was sort of a guildline for developers who would wish to write a new module?

Moneris provides an API that is extremely simple to use (setup an array with the purchase info like CC#, amount, etc, then just send it off and get the result using their API), so possibly there is a gateway module like this that I can use in Cubecart?

Thanks!

Link to comment
Share on other sites

Hi Vostok4,

Am about to do the same myself and had assumed that basing on an existing module was the way to go too.

Will be starting this next week for a uk gateway. Will let you know how it goes, but any tips you can offer, if you attempt it, would be gratefully recieved.

Paul

Link to comment
Share on other sites

Guest vostok4

Hey Paul, I'll definitely let you know.

Right now most modules seem to use https + POST to send transaction info, but I'm still not seeing certain things like where the data is actually sent, and if there is a way to code the logic customly...

I'll look at some more tomorrow, hopefully we can crack this nut.

Link to comment
Share on other sites

  • 3 weeks later...

Here is how it works with secure trading.

transfer.inc.php sends the information as hidden variables through to the banks secure server. They process the information and collect credit card details, then take payment, then they give me a callback url, to which I can send any of the variables used so far and the 'payment taken' codes (or payment not taken etc.)

Where do I return to?

I return to (i think) a return.php file, which runs a function called success. If successful it calls the file 'confirmed.php' which I presume tells cc that payment has been taken and updates the database (although I can't see where it does that exactly.)

The 'success' function is also a bit of a mystery to me. I never intended to do this type of php coding but what can you do?

I am currently stuck getting the return function to operate. At the moment the call back url is not linking and I remain on the banks server with a default success or failiure page. This is probably because the page returns an error 404 if not called properly, and I am probably doing something wrong.

How is your payment module going?

Paul.

PS I think that if you call confirmed.php?f=1 that means a succesful payment. Just calling confirmed.php registers a non complete payment. I think. I can't find any documentation on this at all. Might submit a formal support request.

Link to comment
Share on other sites

Guest EverythingWeb

The success() function is called from the transfer.inc.php file in modules/gateway/<GATEWAY>/transfer.inc.php and will differ for each gateway.

The success routines are called in orderSuccess.inc.php

Different gateways use different routes of achieving the same goals.

We've written a few non-standard gateways using callBack pages etc and each one has been different. Barclays ePDQ works very similar to how yours sounds like it needs to work.

Barclays server required a server-authenticated page to contact to.

Feel free to PM me for a chat. :D

Link to comment
Share on other sites

Guest vostok4

Hey guys, great info.

I actually realized why none of the gateway payment modules will exactly work for my situation! It turns out that Moneris doesn't have a data collection page, its API actually expects the CC# and all the info required to complete a purchase, then it will just respond if the payment went through or not.

Since CubeCart doesn't actually handle this, I'm writing an external 'module' that will have the same look and feel as my store, but will not actually run as part of the store, which will then collect the information, pass it to Moneris' API and return information to Cubecart.

I need to do it this way because it is hell for me to upgrade store versions with custom modifications already written, and incorporating CC handling INTO CubeCart would make upgrading a further nightmare :D

Thanks for the information though, it is a huge help!

Link to comment
Share on other sites

Guest EverythingWeb

Let me just tell you that CubeCart can and will handle exactly what you want it to do, built into the 'main' CubeCart templating system and it WILL work as required... believe me, I've written a couple which do that. :D

Also, you can just build it as another gateway module folder which you can copy into the modules/gateway/ and admin/ folders and as if by magic it's installed in the store.

You will want to fully explore the possibilites of CubeCart, as I can assure you (with a number of stores of clients' running similar) it is much, much easier to have it all integrated. :D

Link to comment
Share on other sites

Guest vostok4

Where I am lost on how to do it as Cubecart will want to handle it is how to handle intermediate steps with accepting the CC# in the Cubecart system... Preferrably I'd like to store the CC#'s in a database so that customers do not have to input their info all over again for repeat purchases. That would require modifying the Cubecart database structure, or introducing another table just to store CC info (linked by userid to the usertable)...

Link to comment
Share on other sites

Guest EverythingWeb

You can use the $transfer = "manual" which will allow a form to come up, with a form.inc.php required in the gateway module folder (in very short - it is obviously a lot more work than this).

You are on *very* risky ground storing credit card details on a (shared?) server - so I'm not going to get on my SoapBox about that one - but I'm sure you can appreciate the potential security risks :D

Link to comment
Share on other sites

Guest vostok4

Hm, do you have documentation for this somewhere, or is it be reverse engineering code you've found this out?

Store + database are on a physical dedicated server :D

Link to comment
Share on other sites

  • 1 month later...
Guest johngood

Hello,

I would love to be awared of any piece of information you could have found.

I need tu build a gateway for a french API ()Mercanet-Atos) and I 'm completely lost.

cheers.

Link to comment
Share on other sites

Guest vostok4

Hey, I figured out how to do this very very easily by using another module that comes in the store:

Look at the Authorize_AIM gateway module, it has all you need to know on how to setup payments seamlessly on the CubeCart site. I modified that one for my needs and it worked just fine.

Link to comment
Share on other sites

Guest johngood

thanks for that, it will be helpfull.

much thanks for helping, I was about to die on my keyboard.

I'll try this tomorrow morning, it's 10.30 PM here, and my eyes are bleeding.

I'm sure tommorrow is the day I beat this code !

Link to comment
Share on other sites

Guest johngood

ok thanks to all those who helped,

I am now able to send the payment to the bank, and that works well.

I think I'm reaching the end.

One probleme remains.

When the payment is complete, the API call it's response.php.

this file is basically like following

if($error){

fwrite($error)

}else{

//transaction OK

fwrite( $fp, "merchant_id : $merchant_id\n");

fwrite( $fp, "merchant_country : $merchant_country\n");

fwrite( $fp, "amount : $amount\n");

fwrite( $fp, "transaction_id : $transaction_id\n");

fwrite( $fp, "transmission_date: $transmission_date\n");

...

}

I don't know how I can redirect the customer to the cubecart website with the info that everything is ok.

can someone help again ?

Link to comment
Share on other sites

Guest vostok4

Take a look in the transfer.inc.php file, for Authorize_AIM you can see this:

function success(){

global $basket;

if($_GET['f']==1) {

return FALSE;

} else {

return TRUE;

}

}

So, when your gateway has a success, you can redirect to the confirmed.php?f=1 for success or else for failure... see what it does?

Link to comment
Share on other sites

Guest johngood

that's ok. thanks.

One last problem remains :

after a sucessfull buy on the bank API, if the user doesn't hit the "back to the website" button, and closes the browser window, cubecart isn't informed of what occured at the bank.

Next time the user visits the website, his basket is still full. That's a problem.

Fortunately, the bank API provides a auto_response system to fix that problem.

In this php file, I can send mails and perform any action in the database.

How can I tell cubecart the operation is complete ?

Link to comment
Share on other sites

Hi all,

I'm reading with interest your replies to writing a payment gateway. I need someone in the know to help me make a new payment module so I can use a mobile billing system called mobillcash.com with cubecart

I've spoken to the technical guys at mobill and they assure me someone who knows php well could put a module together quite easily. I also had correspondence from the MD at Cubecart who reckoned it was fairly easy (take a copy of an existing module and make some tweeks).

Mobill's system basically calls up their server and presents a value of transaction, currency, order info and merchant account number. Obviosuly not for free, but anyone fancy tackling this gateway script for me?

Here's the mobillcash user manual: https://www.mobillcash.com/helios/documenta...ication-1.4.pdf

and the http payment interface spec:

https://www.mobillcash.com/helios/documenta...ng_spec-1.6.txt

A basic call to their payment system looks something like:

https://www.mobillcash.com/pay/form.pl?curr...0details%20here

Piece of cake for you guys :-)

Hope someone can help for a fair donation by paypal.

Link to comment
Share on other sites

  • 4 months later...
Guest miss ali

Hi vostok4,

If its not a problem would you post the code that you have for your new gateway. I would like to see how the Authorize_AIM one should look with your own settings.

Many thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...