Pesapal.com

Forum

Welcome, Guest
Username
Password:
 

Unofficial Pesapal Integration Reference
(1 viewing) (1) Guest
Welcome to the Pesapal integration forum!

This forum discusses everything about Pesapal integration on your web site. Having any problems? This is the right place to post a question and we are sure you will get an answer
  • Page:
  • 1

TOPIC: Unofficial Pesapal Integration Reference

Unofficial Pesapal Integration Reference 12 years, 9 months ago #455

  • jobkingori
Find it here; https://github.com/itsmrwave/pesapal-php

I encountered a couple of issues integrating Pesapal, I'll list them below;

Issue #1

This;

include_once('oauth.php');


Should be (because of case sensitivity);

include_once('OAuth.php');


Issue #2

This;

$pesapalNotification=$_GET['pesapal_notification_type'];
$pesapalTrackingId==$_GET['pesapal_transaction_tracking_id'];
$pesapal_merchant_reference==$_GET['pesapal_merchant_reference'];


Should be this instead since we are assigning not comparing;

$pesapalNotification  = $_GET['pesapal_notification_type'];
$pesapalTrackingId = $_GET['pesapal_transaction_tracking_id'];
$pesapal_merchant_reference = $_GET['pesapal_merchant_reference'];


Issue #3

Demo endpoint in the IPN listener should not be HTTPS.

Issue #4

On the demo code, you have this when getting the transaction status;

$request_status->sign_request($this->signature_method, $consumer, $token);


This results in an error .. for example, $this in code was my class which had no signature_method. Checking the iframe code there was this;

$iframe_src -> sign_request($signature_method, $consumer, $token);


where $signature_method had been defined as;

$signature_method = new OAuthSignatureMethod_HMAC_SHA1();


The line above is missing in the IPN listener code so the signature method is undefined.

Issue #5

While the code was a very good guide in making the API requests for the IPN listener it isn't clear on what to do after getting the $status.

In fact … I had to echo $status to finally piece together that it was the response. Seems obvious but extra commentary would go a long way which I've included.

The code for this part is too big to include in this email so have a look at this link for the IPN listener code from Line 62 there;

https://github.com/itsmrwave/pesapal-php/blob/master/pesapal-ipn-listener.php#L62

It describes to a bit more details what response to expect from pesapal and what to do. IE … from what I gathered;

  1. COMPLETED - update DB that the payment was confirmed then send Pesapal the data back to confirm success so that they don't keep pinging the IPN
  2. FAILED - update the DB that payment failed and then send Pesapal the data back to confirm that you acknowledge this so that they don' t keep pinging the IPN
  3. PENDING - do nothing … don't send pesapal anything so that they keep trying to ping the IPN till there's a change in status to COMPLETE or FAILED


Issue #6

Not really an issue but I just improved readability a bit … breaking long statements to a new lines … formatting …. indentation … enation of strings etc.

Re: Unofficial Pesapal Integration Reference 12 years, 8 months ago #478

  • joneswiz
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
I like the way you have documented yours.
The following user(s) said Thank You: kaiguara

Re: Unofficial Pesapal Integration Reference 12 years, 7 months ago #501

  • jobkingori
Please see fix for a bug that makes amounts higher than 999 not reflect the figure that should be input by the user.

For example ... 1000 becomes KES 1.0 in the form ... this is because the number_format introduces a comma which Pesapal interprets as a '.'

See here ... github.com/itsmrwave/pesapal-php/commit/...09f05392083487734bf7
Last Edit: 12 years, 7 months ago by . Reason: update
  • Page:
  • 1