Closed qlint closed 4 years ago
Why does Safaricom ignore all these issues, very sad? I am facing the same problem too but no help.
I am stuck too. For two weeks. Safaricom's monopoly is hurting the market.
Hi All, There exists an issue in the documentation and I intend to make a fix to it.
To clarify, the check account balance method takes these parameters: $CommandID, $Initiator, $SecurityCredential, $PartyA, $IdentifierType, $Remarks, $QueueTimeOutURL, $ResultURL
The issue of initiator information is invalid is caused by you using a wrong combination of $Initiator
and $SecurityCredential
.
Looking at my test credentials below,
Looking at the test credentials shared above, the $Initiator
field should be populated by the value of Initiator Name (Shortcode 1)
which in this case is Safaricomapi
. In production, It is the name of the API initiator that you create on the org portal.
The $SecurityCredential
field is populated by encrypting the value of Security Credential (Shortcode 1)
using the production certificate when in production or sandbox certificate when in sandbox. The security credential value does not change unless you change the initiator password in the org portal in prod. You may generate the security credential by doing an encryption of its value below the credentials as shown on the screenshot below.
Hi All, There exists an issue in the documentation and I intend to make a fix to it.
To clarify, the check account balance method takes these parameters:
$CommandID, $Initiator, $SecurityCredential, $PartyA, $IdentifierType, $Remarks, $QueueTimeOutURL, $ResultURL
The issue of initiator information is invalid is caused by you using a wrong combination of
$Initiator
and$SecurityCredential
. Looking at my test credentials below,Looking at the test credentials shared above, the
$Initiator
field should be populated by the value ofInitiator Name (Shortcode 1)
which in this case isSafaricomapi
. In production, It is the name of the API initiator that you create on the org portal.The
$SecurityCredential
field is populated by encrypting the value ofSecurity Credential (Shortcode 1)
using the production certificate when in production or sandbox certificate when in sandbox. The security credential value does not change unless you change the initiator password in the org portal in prod. You may generate the security credential by doing an encryption of its value below the credentials as shown on the screenshot below.
where do i get these test credentials in the new api. there is no such a page and the ones on the simulator don;t seem towork
where do i get these test credentials in the new api. there is no such a page and the ones on the simulator don;t seem towork
While trying to b2c, I'm getting this error, The initiator's information is invalid, I can't find any solution to this problem.
Has anyone succeeded in this securityCredential thing, i have tried using certificate and openssl but still getting the error. Safaricom daraja has no clear formats of generating securityCredential.
Has anyone succeeded in this securityCredential thing, i have tried using certificate and openssl but still getting the error. Safaricom daraja has no clear formats of generating securityCredential.
Try this:
$pass = "YOUR-PASSWORD-IN-https://org.ke.m-pesa.com";
$publicKey = file_get_contents('./your-path-to/ProductionCertificate.cer');
openssl_public_encrypt($pass, $encrypted, $publicKey, OPENSSL_PKCS1_PADDING);
$securityCredentials = base64_encode($encrypted);
For those like me who are here looking for Test credentials for Daraja API V2 Sandbox, you can send an email to APIfeedback@safaricom.co.ke or APIsupport@safaricom.co.ke and they will send you updated credentials. I realised they get updated after a while.
I've followed the documentation for the
AccountBalance
but keep ending up with the same message, that the Initiator information is invalid. I'm assuming this could be one of two possibilites, either the$Initiator
value is wrong or the$SecurityCredential
.This is how I'm computing the $securityCredential
Which gives me a
$securityCredential
which is 344 characters long.As for the $Initiator This is what the documentation says at https://developer.safaricom.co.ke/account-balance/apis/post/query
My confusion is - what is credential/username given that there is an initiator username and there is an initiator credential (assuming credential means password)?
I've tried using either but still get the same message though - "Initiator information is invalid.". What could be happening?