SmoDav/mpesa

Variable

mwendarapho opened this issue ยท 7 comments

what is some_secret_hash_key ?

I had the same query but after digging deep into various tutorials this is what I think about some_secret_hash_key. In my response I am assuming you are working with Laravel, but it should be good enough as a workaround.

It is possible to intercept communication between your app and MPesa when transacting over the internet, to avoid this you are encouraged to generate a strong hash from the Safaricom Developer Portal, then use that hash to register your Callback URLs, when MPesa sends requests to your API endpoint after a transaction you should check/validate whether the hash sent to your endpoint matches what was generated initially from the Saf's developer portal. This way you are sure your application is communicating only with MPesa and not anything in between the communication channel. Obviously this hash can be stored in the .env file for security reasons.

In my case this what I did.

I registered my callback URL in the api.php because any routes registered in that file are not CSRF protected by default, therefore any requests sent there won't be rejected without the token, however be sure to verify the token you receive. Here's a screen shot.

carbon-saf

That's my thinking open to opinions and corrections

That's correct @henimmans it's just a security token that you use to authenticate that the request is actually from Safaricom and a man in the middle.

The sandbox sometimes has issues. If the package simulation does not work, try using the developers portal simulation.

same error on simulation API
{
"requestId":"16858-6141883-1",
"errorCode":"500.003.1001",
"errorMessage":"System internal error."
}
and also developer portal simulation Api

i've been having the same error but the code used to work perfectly.
{
"requestId": "27370-15356447-1",
"errorCode": "500.003.1001",
"errorMessage": " System internal error"
}
Can anyone help please.

i've been having the same error but the code used to work perfectly.
{
"requestId": "27370-15356447-1",
"errorCode": "500.003.1001",
"errorMessage": " System internal error"
}
Can anyone help please.

Use the current ShortCode from your account.