Update to Free PesaPal Payment Module for Virtuemart 1.1.9 and (J1.5)

Since my last release of a PesaPal module for public consumption, PesaPal has changed a few thing, which I believe I have mentioned from time to time on this forum. They are working on improving their system, and in as much as they are not where I would like them to be, at least they are more secure for sure.

The downside of these improvements to PesaPal is that my old plugin was broken and I have now just updated it. Please find below details on how to install the PesaPal payment module for Virturmart 1.1.9.

Please note that this is a major update and the old code will not work. And due to that, I am simply going to change all download links to the newer improved version of this code.

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

12 comments

  1. thank you for the plugin….i have put everything in place but when i confirm order it does take me to paypal.what can be the problem?

  2. am getting the following error after confirm order.Problem: timestamp_refused | Advice: > oauth_acceptable_timestamps | 1337768125-1337768605

  3. @peter You would get this error if you have not selected “PesaPal” as your payment gateway of choice. Before confirming the order, select the “PesaPal” radio in the payment gateway to use. You can disable other gateways that you do not want appearing when checking out from the administration end of Virtuemart.

  4. @peter – The timestamps error occurs when you keep trying to retry the same PesaPal iframe page (the page that shows PesaPal payment options) without passing new parameters to it. PesaPal restricts the amount time you have before completing a payment and that is why once cannot keep refreshing the PesaPal iframe page. To show the page again, esp in the case of Virtuemart, you would have to go back, add an item(s) to your cart, select shipping, and checkout again.

    This error can also be caused if your computer or server has an incorrect date and time. The plugin uses the time of the web machine it is running on (whether local server or server in the cloud) when sumitting parameters to PesaPal and the service will not accept timestamps that are too far in the furture, or too far in the past. To be precise, the time on your server at time of submission of parameters to PesaPal should be within 480sec (8min) of the the time on the PesaPal server. I assume that is set to be around +/- 4 min of the time on the PesaPal server, which I believe keeps its time in line using NTP servers.

    So apart from the refreshing mistake, which I know is common, please also check the time on your server, preferably keeping it in line with NTP servers.

  5. Thanks for the nice tutorial. I got lost on step six..please can you explain more? am test this module on php5/mysql. If possible give a step by step tut.

  6. Step six simply refers to you logging into the administration back end for joomla which is normally http:///administrator/
    Please note that the prerequisites for the plugin are Joomla 1.5 with Virtuemart 1.1.9 installed.

  7. Hi Allan,
    Many thanks for the plugin. I’m trying it on virtuemart 2.0.6 but the folder structure is different. The directories /class/payment do not exist. Should i create them or do you have a work around for this?

  8. Virtuemart 2.0.6 is a whole other cup of tea and the curren plugin will not work at all with it. I am working on a version for it so please just hang on as I will have it availabe soon.

Leave a Reply