Payment redirect and return method

Posts: 8
Joined: 05/06/2008

Ive been hunting around and I cannot find a module that simply allows me to specify an OK url and KO url (or specifies for me). Does anything simple exist? Can we not make something so generic that it could work for every bank?

I am quite limited out here (Spain) as to how I can work, our clients want to use their own banks, and the banks are keen to do online payment but need to some easy way to integrate. The way they like to do it here is OK and KO urls which is simply...

user clicks button to pay for product
user taken to bank website
user enters details
user returned to our site to one of two pages... success or fail

All I really need is the ability to have 2 URLS for those two pages which either way collects the information and updates the drupal order.

Does anyone know how to do this or can provide steps to doing it? I am a basic developer to drupal.

Thanks
Will Eaton

Posts: 3744
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Will, these sorts of things can be done quite simply in a custom Drupal module, but there isn't really a good way to make this into a generic module. There may be some more things we can do in the Ubercart API to facilitate some common functions, but for now you can reference the existing payment modules and the uc_cart_complete_sale() function.

Posts: 8
Joined: 05/06/2008

Hey Ryan, thanks for your really quick response, I had actually come across that page but was hoping that there might have been some module made where I put in a URL for the bank and create some expected variables to send and receive.

How would you suggest going about using those functions? I envisage creating a module which is invoked when going to a specific URL but haven't mastered this yet. Can a module specify its URL? Can it somehow tell drupal to call itself on a specific URL?

I intend to release this if I do create a module and love the work and support you guys provide, we are seriously looking into donating on a per website basis so thanks for everything so far!

Posts: 3744
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Yep, you can use hook_menu() to define pages in Drupal that call certain functions when those URLs are loaded. For example, check out the function uc_cart_menu() in uc_cart.module to see how I'm defining static pages for the cart module (anything in the $may_cache) block.

Posts: 8
Joined: 05/06/2008

Ryan, you are a superstar, I got that working fine. May I be cheeky and ask for more help?

I am using the "test_gateway" module as a base to create my module, what I need is... on submit of "uc_cart_checkout_review_form" it instead sends the variables (plus new ones for the bank) to the bank URL instead of to itself for processing. The variables all need to be sent via POST and I need to add to the form, as well as modify the order ID variable name.

Where are the functions that create and process that form? I cant find it anywhere Sticking out tongue.

Thanks
Will

Posts: 8
Joined: 05/06/2008

Ryan, scratch that, I have managed to do it by modifying the la caixa contributed module. I was already familiar with that bank system so was able to easily adapt it to my needs. I shall be contributing my first module for drupal ever shortly!