Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Writing a new Payment Module


jdw814

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

Link to comment
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.

Link to comment
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

Link to comment
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.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...