Pesapal.com

Forum

Welcome, Guest
Username
Password:
 

Encoded comsumer key being rejected
(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
  • 2

TOPIC: Encoded comsumer key being rejected

Encoded comsumer key being rejected 10 years ago #1609

  • aksalj
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hey!

It looks like pesapal's oauth implementation is not accepting encoded special characters in the consumer key (at least for demo.pesapal.com/api/* ) as shown here:

Has anyone else come across this or is it just me doing the wrong thing?
The following user(s) said Thank You: msummer, evanomondi

Re: Encoded comsumer key being rejected 10 years ago #1611

  • msummer
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
We are seeing the same problem here.

Maybe Pesapal can shed some light on this?

Thanks!

Mark

Re: Encoded comsumer key being rejected 10 years ago #1612

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hello,

Please have a look at this thread: developer.pesapal.com/forum/2-pesapal-in...he-consumer-key#1208

You are either using incorrect keys (check that you have no spaces) or you are using keys that belong to a demo Merchant on the live API or vice versa.
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.

Re: Encoded comsumer key being rejected 10 years ago #1613

  • msummer
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
Hi Lazro,

Thanks a lot for the response. But I'm certain we are not "mixing" up the keys. I seems to be related to the oAuth encoding and specifically to special characters in the key like +-/ etc.

In order to troubleshoot the problem is it possible for you to generate a consumer key for our demo.pesapal.com account that does not contain a special character. That way we can pin point the problem and work on a solution?

Thanks,

Mark

Re: Encoded comsumer key being rejected 10 years ago #1615

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hi,

Unfortunately we cannot generate one without the special characters.

Try see if this OAuth file will sort you out. I hope my assumption that you are using Java is correct :-)



File Attachment:

File Name: oauth-1.4.jar
File Size: 138 KB
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
Last Edit: 10 years ago by lazro.
The following user(s) said Thank You: msummer

Re: Encoded comsumer key being rejected 10 years ago #1616

  • msummer
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
Hi,

Unfortunately we're not using Java - we are working with nodejs - specifically this module: github.com/aksalj/pesapaljs

The author of this module is the one that actually started the thread.

Any specific pointers for nodejs to look at?

Also it seems the jar file was not attached properly - I see a file not found error in your post.

Thanks,

Mark

Re: Encoded comsumer key being rejected 10 years ago #1617

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
We don't have the nodejs Oauth file. we'll have a look at this and share.
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
The following user(s) said Thank You: msummer

Re: Encoded comsumer key being rejected 10 years ago #1623

lazro I posted some details in the Github thread here. That API call is failing no matter if the "+" is encoded as %20 or %2B. I am 100% positive of this. And this is the only API call that fails, and all the encoding is consistent on our side using aksalj's library.

This is being tested against the PesaPal demo environment.
Last Edit: 10 years ago by clarkritchie.

Re: Encoded comsumer key being rejected 10 years ago #1627

  • msummer
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
Hi Lazro,

We have done some more testing and have traces of all the exchanges between our application and the demo Pesapal server. I hope this will help you track down the problem - either on our side or your side.

Here is a flow:

On our side we initiate a payment request:

 
 
http://demo.pesapal.com/api/postpesapaldirectorderv4?oauth_callback=http%3A%2F%2Fdummysite.se%3A8528%2Fcallback%2F&oauth_consumer_key=7LDnDfgy2K61oX1jR2ux0%2BxZNmFxNa6d&oauth_nonce=xyW54&oauth_signature=7pn%2Bz22AjgBW37xK1frfyFVAlJg%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1444643288&pesapal_request_data=%26lt%3B%3Fxml%20version%3D%26quot%3B1.0%26quot%3B%20encoding%3D%26quot%3Butf-8%26quot%3B%3F%26gt%3B%26lt%3BPesapalDirectOrderInfo%20xmlns%3Axsi%3D%26quot%3Bhttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%26quot%3B%20xmlns%3Axsd%3D%26quot%3Bhttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%26quot%3B%20Amount%3D%26quot%3B15345%26quot%3B%20Currency%3D%26quot%3BKES%26quot%3B%20Description%3D%26quot%3BMinim%20id%20anim%20ea%20sint%20cupidatat%20do%20cillum%20sit%20id.%26quot%3B%20Type%3D%26quot%3BMERCHANT%26quot%3B%20Reference%3D%26quot%3B1444643272000%26quot%3B%20FirstName%3D%26quot%3BMark%26quot%3B%20LastName%3D%26quot%3BSummer%26quot%3B%20Email%3D%26quot%3Bmark%40everylayer.com%26quot%3B%20PhoneNumber%3D%26quot%3B%26quot%3B%20xmlns%3D%26quot%3Bhttp%3A%2F%2Fwww.pesapal.com%26quot%3B%20%2F%26gt%3B
 
 


We submit payment using: demo.pesapal.com/mobilemoneytest

Then query payment details using the phone number of the customer and confirmation code from pesapal using this HTTP GET URL and headers below:

 
 
http://demo.pesapal.com/api/querypaymentdetails?pesapal_merchant_reference=1444643272000&pesapal_transaction_tracking_id=d6dc5b62-d5a1-4a03-bac6-ba677dcc47f5
 
 
headers:
{ host: 'demo.pesapal.com',
Authorization: 'OAuth oauth_consumer_key="7LDnDfgy2K61oX1jR2ux0%2BxZNmFxNa6d",oauth_nonce="f59142fa87f04926b4e9501a82a2f432",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1444643412",oauth_version="1.0",oauth_signature="M6gB5HudRZGF5wxhSwao0cY%2FT1A%3D"' }
 
 


And this is the response we get from demo.pesapal.com:

 
 
 
response:
{ headers:
{ 'cache-control': 'private',
'content-type': 'text/html; charset=utf-8',
server: 'Microsoft-IIS/8.5',
'set-cookie': [Object],
'x-aspnetmvc-version': '5.0',
'www-authenticate': 'OAuth realm="", oauth_problem="consumer_key_unknown"',
'x-aspnet-version': '4.0.30319',
'x-powered-by': 'ASP.NET',
date: 'Mon, 12 Oct 2015 09:50:13 GMT',
connection: 'close',
'content-length': '45' },
statusCode: 200,
body: 'Problem: consumer_key_unknown | Advice: > | ' }
 
 


As you can see the consumer key is encoded in both HTTP GET transactions the same way:

 
1st time:
7LDnDfgy2K61oX1jR2ux0%2BxZNmFxNa6d
 
2nd time:
"7LDnDfgy2K61oX1jR2ux0%2BxZNmFxNa6d"
 


I hope this will help you tack down the problem. Thanks!

Mark
The following user(s) said Thank You: aksalj

Re: Encoded comsumer key being rejected 10 years ago #1628

@lazro Any update on this? PesaPal simply does not work, and we cannot proceed. We will have to go direct against the MPesa API if we can't get this sorted out in the next few days. Thanks for your help!

Re: Encoded comsumer key being rejected 10 years ago #1629

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hello Clarkritchie,

We currently do not have the node.js Oauth file. We'll share the same as soon as we have a working version.

Apologies for the inconvenience.
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.

Re: Encoded comsumer key being rejected 10 years ago #1630

What does that even mean, "the node.js Oauth file"? The issue as we've described here is that keys with a "+" character in it fail on one (and only one) of your API end points. That should be really easy to replicate on your end, it really has nothing to do with NodeJS.

Re: Encoded comsumer key being rejected 10 years ago #1631

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hello clarkritchie,

NodeJs's OAuth files encodes the keys differently hence what PesaPal get's is not correct. We'll work on the OAuth that encodes the expected value.

Please note that we cannot remove the "+" on the system.
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.

Re: Encoded comsumer key being rejected 10 years ago #1632

  • aksalj
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hey Lazro!

Like @clarkritchie says, it appears your implementation of OAuth 1.0 is not consistent with the standard; It has nothing to do with nodejs or whatever you call "node.js OAuth files". Besides, why are you generating keys with special characters if your API won't accept them?

Maybe if you could let a member of your dev team know about this issue, we would understand each other better.

Re: Encoded comsumer key being rejected 10 years ago #1633

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hello aksalj,

The issue has already been forwarded, as soon as we have a working nodejs version the same will be shared. Our dev email is This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
  • Page:
  • 1
  • 2