Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new payment module


Guest

Recommended Posts

Hello all.

 

I need to write a customized payment module, but I can't figure out how to do it.

I have used SecPay module as an example, and have made my version of it that sends my order to my payment gateway, but I have no idea how to do the next part - how to show the transaction info that my payment gateway returns to me.

 

To explain:

when I create an order and click Confirm Order, I get redirected to a web page of my payment gateway, where I have to enter my credit card number and other info.

When I pay there, that site sends back to me some info about the transaction using post method, and I don't know where and how to handle that.

 

So, please please please, can somebody tell me what files and functions are used in handling returned information from payment gateway, and how to customize them?

Or, if somebody knows some module that is already written with same methods, send me a link.

 

Thanks.

Link to comment
Share on other sites

When your gateway POSTs back a successful transaction, it should go to checkout_process.php, which calls includes/classes/payment.php which calls your payment module.

 

Sorry, I don't know of an example module off hand. Although you might want to check out the PayPal module (part of the core distribution), it does send to an external site and get sent back.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

OK then, next question: where am I supposed to handle return codes from payment gateway?

In checkout_process.php or in my payment module?

And in what function exactly?

 

In other payment modules, I see two functions, before_process and after_process that seem like a place to use for checking the returned data (like transaction return code, say 0 means transaction went OK, not 0 transaction failed) and I have seen in some modules that before_process is used for some sort of returned data handling, but after_process always returns false?

 

 

When do these functions get called, anybody knows?

 

Thanks.

Link to comment
Share on other sites

before_process gets called before the order is added to the database. after_process gets called after. Thus, you would check return values in before_process. after_process is like application_bottom.php, you use it to undo things you did earlier in the payment module (unregister session variables, etc.).

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...