dkiptugen / mpesa-php-full-integration

This is an integration to the mpesa daraja API using codeigniter.
MIT License
10 stars 9 forks source link

Transaction Query Status Error #1

Closed kwoshvick closed 6 years ago

kwoshvick commented 6 years ago

This is the resultant json that has the error "The initiator information is invalid";

{
    "Result": {
        "ResultType": 0,
        "ResultCode": 2001,
        "ResultDesc": "The initiator information is invalid.",
        "OriginatorConversationID": "6618-1387084-1",
        "ConversationID": "AG_20180128_0000650adeb6d1e32571",
        "TransactionID": "MAS0000000",
        "ReferenceData": {
            "ReferenceItem": {
                "Key": "Occasion",
                "Value": "xf"
            }
        }
    }
}

Does the query transaction status work on your end?

dkiptugen commented 6 years ago

I am getting server internal error. I have contacted safaricom guys who told me that they are working on it

dkiptugen commented 6 years ago

Are you using the right credentials? Initiator and SecurityCredential

kwoshvick commented 6 years ago

Yes am using the correct credentials both for the initiator and Security Credential. At least am getting the response but with the error. Are you getting a response?

dkiptugen commented 6 years ago

I am getting the same error {"resultCode":2001,"resultDesc":"The initiator information is invalid.","originatorConversationID":"6616-1458095-1","conversationID":"AG_20180129_000066640d277b9e519e","transactionID":"MAT0000000","initiatorAccountCurrentBalance":null,"debitAccountCurrentBalance":null,"amount":null,"debitPartyAffectedAccountBalance":null,"transCompletedTime":null,"debitPartyCharges":null,"receiverPartyPublicName":null,"currency":null}

dkiptugen commented 6 years ago

I have just found out that we using msisdn instead of partyA shortcode

dkiptugen commented 6 years ago

This is the error I was getting {"resultCode":17,"resultDesc":"System internal error.","originatorConversationID":"9094-3885-1","conversationID":"AG_20180129_00006546fb649dc92d7b","transactionID":"MAT31H414V","initiatorAccountCurrentBalance":null,"debitAccountCurrentBalance":null,"amount":null,"debitPartyAffectedAccountBalance":null,"transCompletedTime":null,"debitPartyCharges":null,"receiverPartyPublicName":null,"currency":null}

kwoshvick commented 6 years ago

Am a bit confused , which API is that , I though it was the Transaction Status because your response json completely different . Have you using the partyA in place of msisdn ?

dkiptugen commented 6 years ago

use the certificate in daraja portal

onyashed commented 6 years ago

When using the 601322 party A for B2C transactions and credentials for apitest322, just generate security credentials using 322reset as password on the daraja api. Use these details on post man and your sample online sandbox app tests. /////////////output//////////////////// {"Result":{"ResultType":0,"ResultCode":0,"ResultDesc":"The service request is processed successfully.","OriginatorConversationID":"15896-1712263-1","ConversationID":"AG_20180915_00006cb4e489d2dd572d","TransactionID":"MIF71H6P0X","ResultParameters":{"ResultParameter":[{"Key":"TransactionAmount","Value":120},{"Key":"TransactionReceipt","Value":"MIF71H6P0X"},{"Key":"B2CRecipientIsRegisteredCustomer","Value":"Y"},{"Key":"B2CChargesPaidAccountAvailableFunds","Value":-440.00},{"Key":"ReceiverPartyPublicName","Value":"254708374149 - John Doe"},{"Key":"TransactionCompletedDateTime","Value":"15.09.2018 16:50:05"},{"Key":"B2CUtilityAccountAvailableFunds","Value":68242.00},{"Key":"B2CWorkingAccountAvailableFunds","Value":600000.00}]},"ReferenceData":{"ReferenceItem":{"Key":"QueueTimeoutURL","Value":"https:\/\/internalsandbox.safaricom.co.ke\/mpesa\/b2cresults\/v1\/submit"}}}}

onyashed commented 6 years ago

Who has the best formula of extracting this 3d array for a mysql db...

MartinMbae commented 5 years ago

Use these

$PartyA = '600183' Initiator Security Password to generate security credentials: = Safaricom183! $InitiatorName = 'testapi';

xaviRodri commented 5 years ago

Here getting also the "The initiator information is invalid" error. Using POSTMAN and the following request: URL: https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest body: { "InitiatorName": "testapi", "SecurityCredential": Generated in the test credentials page, "CommandID": "SalaryPayment", "Amount": "2500", "PartyA": My shortcode 1, "PartyB": "254708374149", "Remarks": "Salary", "QueueTimeOutURL": "http://mypage:myport/callback", "ResultURL": "http://mypage:myport/callback", "Occasion": "JULY 2019" }

I receive this: { "Result" => %{ "ConversationID" => "AG_20190703_00006062da42eb758f15", "OriginatorConversationID" => "10297-3902282-1", "ReferenceData" => %{ "ReferenceItem" => %{ "Key" => "QueueTimeoutURL", "Value" => "https://internalsandbox.safaricom.co.ke/mpesa/b2cresults/v1/submit" } }, "ResultCode" => 2001, "ResultDesc" => "The initiator information is invalid.", "ResultType" => 0, "TransactionID" => "NG361H9J32" } }

I'm following this guy's tutorial (https://www.youtube.com/watch?v=uWh_5-l8IVQ&list=PLcKuwRUZRXZL36Lb3e5eryz8K4mmrqgqs&index=15) but maybe something has changed... Some idea??

Sigilai5 commented 5 years ago

Hey @xaviRodri,I happened to have used the same tutorial about 6 weeks ago and the B2C transaction was working .But this week I tried it again and its not working(Am getting the same error as you).So, yes maybe something has changed.But let me know if you figure it out.

xaviRodri commented 5 years ago

Good news @Sigilai5 ! I sent an email to the API technical support (apifeedback@safaricom.co.ke) and they have given me new working credentials. Maybe the credentials in our profile don't work anymore for B2C requests...

So the best solution is to contact them and request new test credentials. 👍

Sigilai5 commented 5 years ago

Thanks! Regards, Brian Sigilai Full Stack Developer

+254 792 071 275

On Thu, Jul 4, 2019 at 12:40 PM xaviRodri notifications@github.com wrote:

Good news @Sigilai5 https://github.com/Sigilai5 ! I sent an email to the API technical support (apifeedback@safaricom.co.ke) and they have given me new working credentials. Maybe the credentials in our profile don't work anymore for B2C requests...

So the best solution is to contact them and request new test credentials. 👍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/caydee/Mpesa/issues/1?email_source=notifications&email_token=AHDVNQDU3UQBBRNKNV3244TP5XAQTA5CNFSM4EN6YMK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZG5DJI#issuecomment-508416421, or mute the thread https://github.com/notifications/unsubscribe-auth/AHDVNQDEUVA7J6RFHMKDZ73P5XAQTANCNFSM4EN6YMKQ .

kimathie commented 4 years ago

Hi guys I have been really frustrated using this daraja API. I keep getting the error 'The initiator information is invalid.' for a simple account balance. It's been a whole month and the API feedback team has gotten nowhere. I am not able to move . Can someone share their test credentials that they used so that I can use them in my service, I am really pressed for time. Hopefully the credentials are still valid.

kimathie commented 4 years ago

Incase you are going to ask what the Request structure looks like,here it is.

{ "Initiator": "apitest425", "SecurityCredential": "b0xW7O8neEp88Q7XTFHqmBo4BmPII9O2Es0KZYyfRh72CdmyR4jf+gULUjaijKckVZalj/mwC4ZLyFXO6FBmu7YZVQXSSqKpEO+SKj6YaGIKVJP1LrUDIZLA0EkPdssfGNPNPDSFhTfK7uCe5wkSqc8LIDhfbFWl/BBGkfI8JTJ7Ubybo7taBkDgvyh4o8KThAZptr9GrXhXOzU4k8oROaSzhg3A3hCgxHgISsi3VlnHxOBt6Bum6NrT2xlZ4PsbvQuK9oVxjeNGvXW6QXeowaux4YydqtZZqbiQuunPjaaRPoKS6I3jD4/elm+QsVJWKM76TcR13tOMqyjOoLHFTw==", "CommandID": "AccountBalance", "PartyA": "601425", "IdentifierType": "4", "ResultURL": "http://167.99.18.235:7000/{organization_name}/mpesa/result", "QueueTimeOutURL": "http://167.99.18.235:7000/{organization_name}/mpesa/timeout", "Remarks": "A0A013SSH" }

Sigilai5 commented 4 years ago

I think you should not use the name 'mpesa' in your urls

On Wed, Dec 4, 2019, 1:03 PM kimathie notifications@github.com wrote:

Incase you are going to ask what the Request structure looks like,here it is.

{ "Initiator": "apitest425", "SecurityCredential": "b0xW7O8neEp88Q7XTFHqmBo4BmPII9O2Es0KZYyfRh72CdmyR4jf+gULUjaijKckVZalj/mwC4ZLyFXO6FBmu7YZVQXSSqKpEO+SKj6YaGIKVJP1LrUDIZLA0EkPdssfGNPNPDSFhTfK7uCe5wkSqc8LIDhfbFWl/BBGkfI8JTJ7Ubybo7taBkDgvyh4o8KThAZptr9GrXhXOzU4k8oROaSzhg3A3hCgxHgISsi3VlnHxOBt6Bum6NrT2xlZ4PsbvQuK9oVxjeNGvXW6QXeowaux4YydqtZZqbiQuunPjaaRPoKS6I3jD4/elm+QsVJWKM76TcR13tOMqyjOoLHFTw==", "CommandID": "AccountBalance", "PartyA": "601425", "IdentifierType": "4", "ResultURL": "http://167.99.18.235:7000/centonomy/mpesa/result", "QueueTimeOutURL": "http://167.99.18.235:7000/centonomy/mpesa/timeout", "Remarks": "A0A013SSH" }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/caydee/mpesa-php-full-integration/issues/1?email_source=notifications&email_token=AHDVNQD7GGWFCEVPGQJC43TQW56AHA5CNFSM4EN6YMK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF4NKCQ#issuecomment-561566986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDVNQALDOKMJS5ZYCVZX3LQW56AHANCNFSM4EN6YMKQ .

kimathie commented 4 years ago

I don't think that is the solution. Paths have no net effect on the overall response.

kimathie commented 4 years ago

Same we error { "Initiator": "Safaricomapi", "SecurityCredential": "D+ZN870ktdDB88h+zBUIrm+cHdWZ3PrykZq+Nk3vFxo1OQ3Me7IRs0tUUOsqqlzDDXBTvMBdWV/1KNwTlDrIFA4peju91GFbJaNRQRzlyLjfWrQQ/nu3WpPHBF6hgZp0+q9v6yptzWXoU0mCSqu1WHev4W14MuW+gW9QBhwPRu8EtJzxduNdnDoI/v8kAf2lMM3PRZqMCY953eSbbpF15YT6D3eWnAixsKit1eZjqFxY/oFzYf2/NVbkidXKaSvfQ24pIb1T4G1sFCRLFpDQqSPWNSHljiZDYXnSefqPFs+VPX3GNYwnvhqy0BDNfJhaqrgUECBSekNPv3hhYSSwBg==", "CommandID": "AccountBalance", "PartyA": "600732", "IdentifierType": "4", "ResultURL": "http://167.99.18.235:7000/{org-name}/callback/result", "QueueTimeOutURL": "http://167.99.18.235:7000/{org-name}/callback/timeout", "Remarks": "A0A013SSP" }

Sigilai5 commented 4 years ago

Just try, it's better than not trying

On Wed, Dec 4, 2019, 11:10 PM kimathie notifications@github.com wrote:

I don't think that is the solution. Paths have no net effect on the overall response.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/caydee/mpesa-php-full-integration/issues/1?email_source=notifications&email_token=AHDVNQARF25JTPLU63RLUUDQXAFEXA5CNFSM4EN6YMK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF6KZJQ#issuecomment-561818790, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDVNQDOSDBCFVU5M7QS5ALQXAFEXANCNFSM4EN6YMKQ .

kimathie commented 4 years ago

When you get time test these credentials with your script, tell me if you get a response.

Shortcode 1 : 601425 Initiator Name (Shortcode 1) : apitest425 Security Credential (Shortcode 1) : Safaricom111! Shortcode 2 : 600000 Test MSISDN : 254708374149 ExpiryDate : 2019-12-07T12:28:14+03:00 Lipa Na Mpesa Online Shortcode : 174379 Lipa Na Mpesa Online PassKey : bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919

clintonngotta commented 4 years ago

I have just found out that we using msisdn instead of partyA shortcode

in the docs for daraja api there is option to use msisdn. i want to use this instead of shortcode. am getting same error The "initiator information is invalid" anyone who got work aound on this?

clintonngotta commented 4 years ago

Who has the best formula of extracting this 3d array for a mysql db...

which language? i have done it in php7 just $json = json_decode($response, true) then access the values as array like $json['TransactionType'];

Whizboy-Arnold commented 3 years ago

For Christs sake who closes these issues and yet there is absolutely no threads solution to this in the threads

Whizboy-Arnold commented 3 years ago

For Christs sake who closes these issues and yet there is absolutely no threads solution to this in the threads

The thing is not even working from the simulator right on the site. Still returns

{ "Result": { "ResultType": 0, "ResultCode": 2001, "ResultDesc": "The initiator information is invalid.", "OriginatorConversationID": "6503-58155145-1", "ConversationID": "AG_20211009_0000454f9a59628901ef", "TransactionID": "PJ921HK9UA", "ReferenceData": { "ReferenceItem": { "Key": "QueueTimeoutURL", "Value": "https://internalsandbox.safaricom.co.ke/mpesa/b2cresults/v1/submit" } } } }

on the callback url. Has the person closing this issue found a solution yet???

onyashed commented 3 years ago

The day we shall have threads with code samples it will be easy to solve members issues. This tool exists on daraja but we dont get redirectef to it. Common errors section will enable users search and solve the problems they face. Succesess. See you all on daraja blog.

On Sat, 9 Oct 2021, 04:07 Whizboy-Arnold, @.***> wrote:

For Christs sake who closes these issues and yet there is absolutely no threads solution to this in the threads

The thing is not even working from the simulator right on the site. Still returns

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/caydee/mpesa-php-full-integration/issues/1#issuecomment-939196813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKIEMFLWZZORETOOAQ6WCLDUF6IUFANCNFSM4EN6YMKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ivansmeli commented 3 years ago

If your API password and username are correct and still raises the above issue of "The initiator information is invalid", check your encryption method/algorithm: Sample encryption algorithm :https://github.com/peternjeru/mpesa-encryption-encoding-java For certificates, download from the below links: For production: https://developer.safaricom.co.ke/api/v1/GenerateSecurityCredential/ProductionCertificate.cer For Sandbox: https://developer.safaricom.co.ke/api/v1/GenerateSecurityCredential/SandboxCertificate.cer

All the best!

cotewa commented 2 years ago

For anyone still looking for a simple PHP script for generating the encrypted passoword using the key file on m-pesa portal.

$password = "Safaricom999!*!"; //initiator plain password $cert = file_get_contents("path-to-certificate-file.cer"); openssl_public_encrypt($password, $crypted, $cert, OPENSSL_PKCS1_PADDING);

$EncryptedSecurityCredential = base64_encode($crypted);

TheZoraiz commented 2 years ago

The issue still persists... Neither the actual initiator credentials created on the mpesa portal or the test credentials provided on safaricom website work. Even their own API simulator fails with the same error when I provide my app's callback urls.

lawrencemauku commented 1 year ago

have you enabled your app's mpesa express on daraja?

ericmuigai commented 1 year ago

I'm curious if any one has found a solution to this.

kwoshvick commented 1 year ago

@ericmuigai it was a credential issue. I created another app and worked.

ericmuigai commented 1 year ago

Hi @kwoshvick I have created another app still getting the same error. Have you tested it of late?

kwoshvick commented 1 year ago

@ericmuigai no I have not.

ericmuigai commented 1 year ago

@kwoshvick when is the last time you used it? Trying to see if it's something updated.

kwoshvick commented 1 year ago

@ericmuigai last year.

TheZoraiz commented 1 year ago

@ericmuigai If it's any help, I solved this by directly contacting mpesa api support through email and they provided me with the correct test credentials for sandbox (initiator username, initiator password and shortcode). Apparently the test credentials in their documentation were invalid or perhaps outdated.

ericmuigai commented 1 year ago

@TheZoraiz thanks for the heads up. I'll contact them. Have you worked with it lately?Wait, the credentials for the apps don't work?

TheZoraiz commented 1 year ago

@ericmuigai Only the test credentials for the sandbox environment in their documentation. I'm not sure if they've updated it since the last time I checked. You can contact safaricom support at apisupport@safaricom.co.ke and they'll guide you