FREE PesaPal Payment Module for Virtuemart 1.1.9 (J1.5)

PesaPal offers a wonderful payment gateway for developers to integrate with mobile payment solutions available in Kenya, namely M-Pesa and Airtel Money (at least as of the composition of this) and also with VISA! Now, unfortunately, they only offer basic integration instructions and no specific modules for major platforms like Joomla. I have therefore taken the liberty to develop a module for virtuemart that I hope you will find helpful. I have submitted it to the JED and I hope they will approve it. The Joomlasphere mentions many issues with approval of free VirtueMart extensions but I hope for the best.

Tested On:
- Virtuemart v1.1.9
- Joomla v1.5.26
- PHP v5.3.10 & MySQL v5.5.20

DOWNLOAD VERSION 1.2

LICENSE:

These scripts are offered freely and in good faith. Please do not pass this off as your own work or try to sell it without due credit. Check back with us at ajagwe.com for updates/fixes. If you want more support/work done to it, you could consider a donation šŸ™‚

IMPORTANT NOTE:

If you have any other PesaPal payment module(s) already installed on your Virtuemart setup, then make a copy, as a backup, of the following files (if they exist in your system):

/administrator
   /components
      /com_virtuemart
         /classes
            /payment
		/OAuth.php
		/ps_pesapal.php
		/ps_pesapal.cfg.php
         /html
	   /checkout.pesapal.php
INSTALLATION:
  1. Download the pesapal_payment_module_v1.2.zip from here.
  2. Unzip the filesĀ  to a temporary drive on your local computer
  3. Check that you don’t already have someone else’s pesapal payment module by looking in the folder as per my “Important Note” section above.
  4. Upload the OAuth.php, xmlhttprequest.php, ps_pesapal.php and ps_pesapal.cfg.php files to the directory (/administrator/components/com_virtuemart/classes/payment)
  5. Upload checkout.pesapal.php to the directory (/administrator/components/com_virtuemart/html)
  6. Login to your administration panel (back-end)
  7. Go to Components > Virtuemart > Store > List Payment Methods > New
  8. Ensure the “Active” checkbox is enabled (ticked)
  9. “Payment Method Name” should be PesaPal (doesn’t have to be but it’s easier to remember)
  10. “Code” is PESAPAL (again just easier to remember)
  11. Next to “Payment class name”, select ps_pesapal from the drop-down.
  12. For “Payment method type”, put a dot next to the HTML-form based (e.g. Paypal) option.
  13. Click on the “SAVE” icon (top-right).
  14. You should be returned to the “Payment Method List” page, click on the PesaPal entry you just made.
  15. Click on the Configuration tab (next to Payment Method Form tab)
  16. There should be a message saying that ps_pesapal.cfg.php is Writeable. If it isn’t then check the permissions on the file using your FTP client.
  17. Complete the fields just under this message as appropriate.
    • Merchant key should be the merchant key provided to you by pesapal. The module defaults to a test merchant key from the pesapal website
    • Secret key should be the secret key provided to you by pesapal. The module defaults to a test secret key from the pesapal website
    • Return URL should be the root of your website as the module and pesapal will add several parameters to it for checkout confirmation. This is editable to any other URL that you may desire to handle responses from pesapal
    • Cancel URL this can be left blank of the same as return URL. Functionality put in place for the day that pesapal adds a cancel link or button in their system
    • Order Statuses should be the statuses that Orders change to depending on repsonse from pesapal. Please note that these are editable from Virtumart Orders Menu
    • Confirmation Message is the message a user will get upon successful confirmation of a transaction from pesapal
    • Error Message is the message a user will get upon reportĀ  of an error in theĀ  transaction from pesapal
  18. Open the file payment_extra_info.txt (from the temporary folder where you extracted the modules files) and copy its content into the Payment Extra Info field of the form.
  19. Click on the “SAVE” icon again (top-right).
  20. Test as appropriate
ADDITIONAL:

Now that I’ve learnt to write Virtuemart Payment Modules, if there’s an e-merchant system that you would like to use that no one else has, I’ll be happy to look at a solution. Contact me or Leave a comment below. Also if you have any questions about this payment module, again do not hesitate to contact me.

SCREENSHOTS:

pesapal1

pesapal2

pesapal3

Share

36 comments

  1. Well I finally got open cart + pesapal up and running. However I find the guys very unresponsive specifically to email queries. So I also did a separate direct pay mpesa module for open cart… If you know someone over there just give them a heads up….

  2. @Allan Jagwe
    if u can then jst plz pass me the intergration method with magento 1.5… My job depends on it.. its the first task given to me by my company.. if i fail i’ll b gone.. so plz help me..

  3. Hi,

    Can you develop custom payment api for pesapal? If you have time, i will give you further details. I’m willing to pay for it. Thanks.

  4. @Jack – I am working on a plugin for this and i hope to have at least a beta ready by the end of the month. In the mean time, I suggest you move up to Joomla 2.5 since I am building and testing on that platform and Joomla.org no longer supports 1.7 any more.

  5. Hey Allan Gatheru here!!! thats a nice module for virtuemart…. checked your site for Vafara and the shopping cart is under maintenance… you are upgrading ama, and this is good work you are doing.. keep me on the loop once you crack the plugin… at info@techwebreality.com

  6. HI, I setup as per your instruction but when checking out a product I got a message “Problem: parameter_absent | Advice: > oauth_parameters_absent | PhoneNumber&Email”, it did not make the phone number mandatory, but I was also thinking the phone number is only mandatory during payment?

  7. Allan,

    Big up for what you are doing. Just want to let you know that a lot of folks out there are waiting for the release of the final revised plugin. You will be rewarded in kind.

    Cheers

Leave a Reply