Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daraja Sandbox Certificate is different and doesn't work #17

Open
alexanderwanyoike opened this issue May 23, 2019 · 6 comments
Open

Daraja Sandbox Certificate is different and doesn't work #17

alexanderwanyoike opened this issue May 23, 2019 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@alexanderwanyoike
Copy link

alexanderwanyoike commented May 23, 2019

Description

Not really a bug actually the sandbox certificate specified in this repo is correct and I managed to get successful transactions using this key. This is not the case for https://developer.safaricom.co.ke/sites/default/files/cert/cert_sandbox/cert.cer that is different from the certificate that the library uses. The certificate posted on the docs didn't work

Reproduction

Steps to reproduce the behaviour:

  1. Using the mpesa-node-library send a b2c request with using the certificate in daraja to encrypt your Security Credential

Expectation

A successful transaction

Actual

Transaction with the error Initiator Information is invalid

Specification

  • OS: Windows 10
  • Node Version: 10.15.1
@ghost
Copy link

ghost commented Jun 26, 2019

You saved the day! Thank you so much @alexanderwanyoike

@geofmureithi-zz
Copy link
Contributor

@alexanderwanyoike Noted. This will be changed to a post install, hence always get the latest after an install.
in the mean while, you can always load your own cert during instantiation.

{ 
    consumerSecret: '<your consumer secret>',
    environment: 'sandbox',
    shortCode: '600111',
    initiatorName: 'Test Initiator',
    lipaNaMpesaShortCode: 123456,
    lipaNaMpesaShortPass: '<some key here>',
    securityCredential: '<credential here>',
    certPath: path.resolve('keys/myKey.cert') //<------------------------- here
}

@geofmureithi-zz geofmureithi-zz self-assigned this Jul 5, 2019
@geofmureithi-zz geofmureithi-zz added the enhancement New feature or request label Jul 5, 2019
@geofmureithi-zz geofmureithi-zz added this to the 0.2.0 milestone Jul 5, 2019
@ghost
Copy link

ghost commented Sep 27, 2019

Hi @geofmureithi any idea if the production has the same mismatch cert issues?

I am trying production cert and it has the same initiator issue as sandbox.

I am communicating with Api feedback team but day of launch has come and they didn't replied back yet

@mulama77
Copy link

Hi @alexanderwanyoike

i have tried both certificates in

https://github.com/safaricom/mpesa-node-library/blob/master/keys/sandbox-cert.cer

and

https://developer.safaricom.co.ke/sites/default/files/cert/cert_sandbox/cert.cer

but am still getting the below callback error in B2C API

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

@geofmureithi-zz
Copy link
Contributor

@alexanderwanyoike You may need to look into Daraja itself.
Several things might be happening.

  1. Daraja API has changed. I am no longer the maintainer of this lib, so hopefully someone takes it up. A PR would also be recommended.
  2. You are using the right cert but in the wrong environment.
  3. If 1 is not the issue, then this is not a library issue but a Daraja issue.
    Remember: certPath: path.resolve('keys/myKey.cert') //<------------------------- here

@geofmureithi-zz geofmureithi-zz removed their assignment Mar 31, 2020
@e-kibet
Copy link

e-kibet commented Sep 25, 2021

Can we add the certificate in vault for ease of management? And have something like docker on top of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants