Jump to content
Sign in to follow this  
jdw814

Writing a new Payment Module

Recommended Posts

Hi,

 

I am hoping that someone has some experience here -- and is willing to share it...

 

I need to write a Payment Module -- or at least some Mods -- to make osCommerce work with an unsupported payment provider. (GoldKeySecureTransactions)

 

Their interface is fairly simple (and I've coded it in HTML/CGI previously) but I am not as familiar with PHP -- and have no idea where I have to "hook in" to the osC code that is already in place.

 

Does anyone have some general Payment Module development guidelines? (Like an API?) Or know where I might be able to find the information I need to get started?

 

Thank you!

Julie

Share this post


Link to post
Share on other sites

I generally start with an existing module for a processor that works the same way as your new processor does. There are examples with the osCommerce distribution. Then I look at what needs to be different and modify it. In general, you need to implement process_button.php if you are POSTing to an external processor and they will redirect back to osCommerce after processing. If you are calling the processor via curl or other backend interface, you do this in the before_process function. The selection function is where you add any form inputs that you need the user to enter. The install function is where you run the initial configuration SQL, and you read the configuration in the constructor.

 

You can get a minimalist example by looking at the COD module. Since it collects no information and does no processing, it implements as little of the API as is possible. However, it still must define all the needed functions. Since it doesn't do anything, it doesn't define any helper functions that are not required.


Always back up before making changes.

Share this post


Link to post
Share on other sites

This is very helpful -- and the comment below raises another question...

 

I generally start with an existing module for a processor that works the same way as your new processor does.

 

Being new to osCommerce -- and having used only a handful of Payment Modules (PayPal Standard, Authorize.net, and COD) -- I'm not sure what would be a good module to start from as an example. The processor I'm trying to write the interface for works much like PayPal, when PayPal is in the mode where the customer is taken to the PayPal site and has to login to complete payment, then is sent back to the original vendor's site when payment is complete.

 

Do you have any suggestions on a good payment module to use as a starting example in this particular case? (I'm going to go peruse the osCommerce distribution, just in case I can figure this out on my own... :) )

 

Thank you for your help!

Julie

Share this post


Link to post
Share on other sites

There are three basic patterns:

 

1. The store collects the credit card info and sends it to the processor. An example is Authorize.net AIM.

 

2. The store redirects to the payment processor (passing the customer and order information in the data built in the process_button function), who collects the information and posts back. The payment modules' before_process function then evaluates the processors response and takes an appropriate action (e.g. redirect to checkout_payment if the card is declined). An example is Authorize.net SIM.

 

3. The store redirects to the payment processor, who collects the information and posts back. The payment processor also sends a payment notification message separately, which the store processes and uses to update the order status. An example is PayPal Standard in RC2a (the older one in MS2 worked like Authorize.net SIM).

 

It sounds like you have #2, but you could have #3. You'd have to check the processor's developer documentation to be sure.


Always back up before making changes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×