December 26, 2009 at 6:14 pm (CMS, FOSS, Web)
I wanted to integrate Paypal payment facility to an osCommerce web solution. Although the default osCommerce solution is geared with a paypal module but it had limited functionality. But I had to provide the Paypal IPN validation for each successful transaction.
With little bit of searching I found that osCommerce has a massive collection of freely downloadable addons to leverage its functionality. In there I found an addon that fits my exact requirements: Paypal IPN.
The Paypal site provides a clear and comprehensive knowledge base on how to integrate Paypal payment scheme(s) to our existing web solution in an easy to understand manner. It also maintains a comprehensive documentation, SDKs, an API reference, etc.. to guide both developers and normal users to fulfill their requirements with minimum effort.
As a developer once you have successfully set up the Paypal payment scheme in the site use Paypal Sandbox test environment to test the functionality before releasing it for live operations. First create a Paypal Sandbox account. Next create a merchant(seller) account and some customer(buyer) accounts using Test Account tab. Each account is entitled to a bank account, credit card, some cash. Now test the payment process using this test environment.
Inside Test Account tab in the Paypal Sandbox it lists all the available accounts(merchant or seller and customers or buyers) and below that is a button called Enter Sandbox Test Site, that opens the test environment. Based on the account type can set and alter the parameters to meet the requirements.
eg: To provide the return url of the merchant’s shop for both default Paypal addon and Paypal IPN addon: My account » Profile » Website Payment Preferences
eg: To send the IPN to the merchant’s shop: My account » Profile » Instant Payment Notification Preferences
Let me give you a quick introduction on what this “Sahana XForm” is all about and what is trying to achieve through this. The main idea behind this effort is to come up with a working prototype to transform the forms on Web-based applications in to a print friendly form that heavily involves data capturing. Sahana is one such application that heavily involves in such activities and it’s main targeted for the overall management of diverse activities in a post disaster situation.
A disaster means it involves recording and dissemination of information among various parties for the immediate fulfillment of victims requirements. Although there are very sophisticated methods and equipments in most cases still the preferred and the used method is the use of paper based forms. In here I should especially mentioned about Chamindra because it was he who came up with this idea and encouraged me on this.
In this approach it provides a way to extracts the XHTML from elements in an active Web form and transform them to a print friendly format (printed and to be used as off-line paper forms) leaving behind the images and unwanted elements on the page. In order for the functionality to work the XHTML mark for the form should be organized in the following manner.
<form name="form" >
<fieldset><legend> Identity </legend>
<label for="nic"> Identity Card Number </label>
<input type="text" name="nic" id="nic"/>
<label for="passport"> Passport Number </label>
<input type="text" name="passport" id="passport"/>
<fieldset><legend> Basic Details </legend>
<label for="family_name"> Family Name </label>
<input type="text" name="family_name" id="family_name" value=""/>
<label for="local_name"> Local Name </label>
<input type="text" name="local_name" id="local_name" value=""/>
<label for="dob"> Date of Birth </label>
<input type="text" name="dob" value="" id="dob"/>
<label for="opt_gender"> Gender </label>
<option value="male"> Male </option>
<option value="female"> Female </option>
<fieldset><legend> Contact Information </legend>
<label for="address"> Address </label>
<textarea name="address" id="address"></textarea>
<label for="zip"> Postal Code </label>
<input type="text" name="zip" id="zip"/>
<label for="home_phone"> Home Phone </label>
<input type="text" name="home_phone" id="home_phone"/>
<label for="mobile_phone"> Mobile Phone </label>
<input type="text" name="mobile_phone" id="mobile_phone"/>
- First identify Web forms from rest of the page(s) (It is very important that you enclose all form related elements inside a XHTML div element having a class attribute which holds a name. eg: <div class=”xform-container” > rest comes here… </div> ).
- On success extract the XHTML form elements.
- Then regenerate the XHTML markup on the same page. This should maintain the correct sequence of the original form(Label name and its corresponding input ).
- Use the CSS to maintain the layouts and dimensions to match the layout for each section, which was there on the original form (Label name and the place to fill the data)
- Next since we need to print this generated from to a paper we should arrange the components to fit into the page size(A4, Letter. Legal, etc…).
Figure 1: Disaster Victim Registry - Web from
Figure2: Disaster Victim Registry - XForm
Your comments and suggestions are highly appreciated in developing this into a readily usable library for any web application.