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

Aug 13

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.8
- Joomla v1.5.23
- PHP v5.3.4 & MySQL v5.1.53

DOWNLOAD VERSION 1.0

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.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, 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

24 comments

  1. anychance you have the integration for opencart 1.5 worked out too? probably save me a few hours…

  2. I will advise once I get round to it. Working on xcart and some other commercial proprietary e-commerce systems.

  3. 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….

  4. abhishek kumar /

    @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..

  5. My guy…currently busy on other projects so…sorry. might get round to doing that some day but definitely not a priority right now. Sorry.

  6. @magento guy – http://www.magentocommerce.com/wiki/5_-_modules_and_development/payment/create-payment-method-module

    well use the above….remember its your task:-) to do your integration not Allan’s I imagine

  7. simply me /

    Help help.. PesaPal + magento.. not happeningg..

  8. Thomas G. /

    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.

  9. Hi,

    Thanks for the wonderful tutorial. Is there a version for joomla 1.7? I needed to integrate it on Joomla 1.7 running virtuemart 2.0

  10. @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.

  11. Jack Otieno /

    Thanx Allan

  12. collins chandi /

    has anyone been able to integrate to open cart

  13. collins chandi /

    has anyone been able to integrate to open cart
    @gitau help!!

  14. Richard Ruoro /

    Hi, have you been able to get a plugin working for joomla 2.5 and virtuemart 2x

  15. 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

  16. kelvin /

    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?

  17. Hi Kelvin
    Pesapal has upgraded! And I am yet to get back and fix my code seeing as it is now broken. Click here for details on changes being made

  18. Hi Paul…
    I am upgrading, and as I was upgrading, so was pesapal and that is one of the issues causing delays. Click here to check out progress…

  19. Hi Richard
    Getting to it. Please be just a bit patient. I will announce to all once its done. Click here for details

  20. Hi,

    I am testing the module in a joomla site.http://174.120.97.60/~farmdi I have followed all the instructions and added the merchant id and secret key but it doesnt seem to work. What could i be doing wrong?

  21. 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

  22. Its coming….very soon. I am like 75% done b4 testing so just hang in there

  23. Please confirm your keys. You can do so from http://www.pesapal.com

  24. hi everyone,

    anyone who knows to integrate pesapal to oscommerce.Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>