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

Lipa na mpesa using STK Error #8

Open
weddingjuma opened this issue Oct 21, 2017 · 176 comments
Open

Lipa na mpesa using STK Error #8

weddingjuma opened this issue Oct 21, 2017 · 176 comments

Comments

@weddingjuma
Copy link

why do I get this error, Am testing because I want to move into production
{
"requestId": "1494-250373-3",
"errorCode": "500.001.1001",
"errorMessage": "[MerchantValidate] - Wrong credentials"
}

same a s this https://developer.safaricom.co.ke/content/merchantvalidate-wrong-credentials-stkpush-simulation

@bdhobare
Copy link
Contributor

You need to provide more details ,like what you have tried first

@kisese
Copy link
Contributor

kisese commented Dec 3, 2017

Hi @weddingjuma basically the shortcode you are using in your request body is not allowed to perform STK push request, there is a test shortcode on the dev portal, however for production you will have to apply for an LNMOnline shortcode

@weddingjuma
Copy link
Author

Thanks @kisese for your reply, for the test credentials are you referring to Shortcode 1, shortcode 2 or the Lipa Na Mpesa Online Shortcode am reffering to test credentilas on the developers portal

@kisese
Copy link
Contributor

kisese commented Dec 19, 2017

@weddingjuma use the Lipa Na Mpesa Online Shortcode and the Lipa Na MPESA Online passkey

@weddingjuma
Copy link
Author

Thanks @kisese, i will try it out

@weddingjuma
Copy link
Author

In step 2 using the screen shot (https://github.com/safaricom/LNMOnlineAndroidSample) ie (Add a customers phone number:) is it the Marchant or the Customer who gets this on their phone

@dennisoft
Copy link

@weddingjuma Its the merchant who gets this i.e the merchant enters the customers phone number on the app so that the customer gets the STKPush and proceeds to pay.
Did you solve the Merchant Validation issue?

@weddingjuma
Copy link
Author

@dennisoft Which marchant validation issue? Are you referring to the issue of invalid token? if so I realized some times the safaricom test Short code does not work, so me i normally test in in the night, and most of the time it work

@kennbuluma
Copy link

@weddingjuma how did you get yours sorted? I still can't get past that error.

@CossyCossy
Copy link

@weddingjuma how did you manage to go about solving this
{
"requestId": "1494-250373-3",
"errorCode": "500.001.1001",
"errorMessage": "[MerchantValidate] - Wrong credentials"
}

@philodoer
Copy link

philodoer commented May 2, 2018

Hello guys. Am using test details. My project does not show on successful payment dialog. What could be the problem.

@philodoer
Copy link

I want my customer to be awarded points on every success payment but don't know how to trigger this action. Where exactly should I put this code.

@philodoer
Copy link

philodoer commented Aug 5, 2018 via email

@philodoer
Copy link

philodoer commented Aug 6, 2018 via email

@weddingjuma
Copy link
Author

make sure you are using ssl, the url has to be on ssl otherwise you will always get errors

@ruddy12
Copy link

ruddy12 commented Aug 14, 2018

@weddingjuma Did you manage to sort your error? Also getting the same on Daraja 👍 {
"requestId": "11274-4828039-1",
"errorCode": "500.001.1001",
"errorMessage": "[MerchantValidate] - Wrong credentials"
}
but on web passing the same data I a different error Note ,amount passed is 100:

{ "requestId":"18519-4869397-1", "errorCode": "400.002.02", "errorMessage": "Bad Request - Invalid Amount" } { "requestId":"18519-4869397-1", "errorCode": "400.002.02", "errorMessage": "Bad Request - Invalid Amount" }

@Nellyazx
Copy link

Nellyazx commented Aug 14, 2018

I used to get te same Errors, replace your whole code with what safaricom has given on the developers portal, then use the test credentials

@ruddy12
Copy link

ruddy12 commented Aug 14, 2018

Hi @Nellyazx

I took the curl they have provided and passed the test credentials they have, also encodedbase64.encode(Shortcode+Passkey+Timestamp) but getting the same issue.

Also Daraja is geving a different error from web though I pass the test credentials with the same token

@ruddy12
Copy link

ruddy12 commented Aug 14, 2018

@Nellyazx Kindly share(if ur willing) a sample of your working stk_push_request

@Nellyazx
Copy link

'174379', 'Password' => 'MTc0Mzc5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMTgwODE0MDg1NjIw', 'Timestamp' => '20180814085620', 'TransactionType' => 'CustomerPayBillOnline', 'Amount' => '10', 'PartyA' => '254701121217', 'PartyB' => '174379', 'PhoneNumber' => '254701121217', 'CallBackURL' => 'https://agizapap.com/rideNeibaResponse', 'AccountReference' => 'Debt', 'TransactionDesc' => 'Pay Now' ); $data_string = json_encode($curl_post_data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string); $curl_response = curl_exec($curl); //print_r($curl_response); echo $curl_response; ?>

@Nellyazx
Copy link

Remember to change your Bearer Access Token

@ruddy12
Copy link

ruddy12 commented Aug 14, 2018

Thanks @Nellyazx it worked,really appreciate.....b blessed

@Nellyazx
Copy link

Welcome...I had the same problem too...Took me two weeks..

@ruddy12
Copy link

ruddy12 commented Aug 14, 2018

weh! been scratching ma head for dayz... was aging fast
funny-aging-saying

@Nellyazx
Copy link

Shared Knowledge is better than Hoarded information

@weddingjuma
Copy link
Author

HI, am planning to do a proper video of this https://www.youtube.com/watch?v=_04nuPavXUU&list=UUV4FsD2gBl4m9D0l-lF9o6Q&index=4

@onyashed
Copy link

@philodoer I see, would love to see what the team says. and also if they accept contributions.

I think giving discounts is better to points.

@onyashed
Copy link

@philodoer the reason I am suggesting this. is from the bitcoin story. On 22 May 2010, Laszlo Hanyecz made the first real-world transaction by buying two pizzas in Jacksonville, Florida for 10,000Bit Coins approx $30. Today that is worth 100million USD. Let us pull guys to online transactions because hakuna kanjo hapa.

@onyashed
Copy link

Im trying a B2B online transaction with this body segment:
'CommandID' => 'BusinessTransferFromMMFToUtility',
'SenderIdentifierType' => '4',
'RecieverIdentifierType' => '4',
'Amount' => '2319101',
'PartyA' => '601322',
'PartyB' => '601322',
'AccountReference' => 'b201',
The error result is shown below. The reverse works. From utility to MMF. What is this rule they are talking about..."Limit rule"
{"Result":{"ResultType":0,"ResultCode":2,"ResultDesc":"Declined due to limit rule: less than the minimum transaction amount.","OriginatorConversationID":"25162-171379-1","ConversationID":"AG_20180921_000065cf2b24777821af","TransactionID":"MIL31H6SD3","ResultParameters":{"ResultParameter":{"Key":"DebitAccountCurrentBalance","Value":"{Amount={CurrencyCode=KES, MinimumAmount=2319100, BasicAmount=23191.00}}"}},"ReferenceData":{"ReferenceItem":[{"Key":"QueueTimeoutURL","Value":"https://internalsandbox.safaricom.co.ke/mpesa/b2bresults/v1/submit"},{"Key":"Occassion"}]}}}

@toxicking-techguru
Copy link

toxicking-techguru commented Sep 8, 2023 via email

@jdtheefirst
Copy link

How did you about it, I am still getting the same error here;{ "BusinessShortCode": "8799520", "Password": "ODc5OTUyMGJmYjI3OWY5YWE5YmRiY2YxNThlOTdkZDcxYTQ2N2NkMmUwYzg5MzA1OWIxMGY3OGU2YjcyYWRhMWVkMmM5MTkyMDIzMDkwODEyMTM0NQ", "Timestamp": "20230908130630", "TransactionType": "CustomerBuyGoodsOnline", "Amount": "1", "PartyA": "254113062599", "PartyB": "8799520", "PhoneNumber": "254113062599", "CallBackURL": "https://f912-154-78-131-69.ngrok-free.app/Gold/callback", "AccountReference": "Admin", "TransactionDesc": "Test" } to this; { "requestId": "92639-49298957-1", "errorCode": "500.001.1001", "errorMessage": "Merchant does not exist" }

@toxicking-techguru
Copy link

toxicking-techguru commented Sep 8, 2023 via email

@jdtheefirst
Copy link

No localhost apparently, but first I was cheking this withh POSTMAN

@toxicking-techguru
Copy link

toxicking-techguru commented Sep 8, 2023 via email

@toxicking-techguru
Copy link

toxicking-techguru commented Sep 8, 2023 via email

@toxicking-techguru
Copy link

In the code you provided, you are setting ReceiverIdentifierType to "11". However, the ReceiverIdentifierType should be set based on the type of identifier you are using for the receiver. The value "11" corresponds to a Till Number, and this may not be appropriate for your specific use case, i see re on production take note of store number and the till number .

@chrisgathuthi
Copy link

I am getting the following error in production {'requestId': '7618-220862227-1', 'errorCode': '500.001.1001', 'errorMessage': 'Merchant does not exist'}. Who knows how to go about this error?

@coolsam726
Copy link

coolsam726 commented Oct 14, 2023

I am getting the following error in production {'requestId': '7618-220862227-1', 'errorCode': '500.001.1001', 'errorMessage': 'Merchant does not exist'}. Who knows how to go about this error?

Probably you are using the wrong BusinessShortCode or Party B. For Till Numbers, the BusinessShortCode is the H.O Number. and PartyB is the actual Till Number.

@KINYENJE
Copy link

KINYENJE commented Jan 6, 2024

hey guys is anyone facing an error message when simulating a transaction in the daraja portal simulator?

@ngangavic
Copy link

hey guys is anyone facing an error message when simulating a transaction in the daraja portal simulator?

Daraja portal simulator is not reliable

@EliusCaleb
Copy link

def generate_access_token_request
@url = "https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials"
@consumer_key = ENV['MPESA_CONSUMER_KEY']
@consumer_secret = ENV['MPESA_CONSUMER_SECRET']
@userpass = Base64::strict_encode64("#{@consumer_key}:#{@consumer_secret}")
headers = {
Authorization: "Bearer #{@userpass}"
}
res = RestClient::Request.execute( url: @url, method: :get, headers: {
Authorization: "Basic #{@userpass}"
})
res
puts "Access Token: #{res}"

end
  not generating token for stkpush

@EliusCaleb
Copy link

Am getting this
Completed 500 Internal Server Error in 1619ms (ActiveRecord: 0.0ms | Allocations: 995)
RestClient::BadRequest (400 Bad Request)

@EliusCaleb
Copy link

Am getting this
Completed 500 Internal Server Error in 1619ms (ActiveRecord: 0.0ms | Allocations: 995)
RestClient::BadRequest (400 Bad Request)

any help here

@C-o-m-o-n
Copy link

I am getting the following error in production {'requestId': '7618-220862227-1', 'errorCode': '500.001.1001', 'errorMessage': 'Merchant does not exist'}. Who knows how to go about this error?

Probably you are using the wrong BusinessShortCode or Party B. For Till Numbers, the BusinessShortCode is the H.O Number. and PartyB is the actual Till Number.

Hello, I'm getting the same error

How do I get the H.O Number?, I only have the Store Number and Till Number.

@ngangavic
Copy link

I am getting the following error in production {'requestId': '7618-220862227-1', 'errorCode': '500.001.1001', 'errorMessage': 'Merchant does not exist'}. Who knows how to go about this error?

Probably you are using the wrong BusinessShortCode or Party B. For Till Numbers, the BusinessShortCode is the H.O Number. and PartyB is the actual Till Number.

Hello, I'm getting the same error

How do I get the H.O Number?, I only have the Store Number and Till Number.

You can use Store number as the H.O number

@C-o-m-o-n
Copy link

I am getting the following error in production {'requestId': '7618-220862227-1', 'errorCode': '500.001.1001', 'errorMessage': 'Merchant does not exist'}. Who knows how to go about this error?

Probably you are using the wrong BusinessShortCode or Party B. For Till Numbers, the BusinessShortCode is the H.O Number. and PartyB is the actual Till Number.

Hello, I'm getting the same error
How do I get the H.O Number?, I only have the Store Number and Till Number.

You can use Store number as the H.O number

This is the payment data that is supposed to be sent, according to the docs.

{
    "BusinessShortCode": 174379,
    "Password": "MTc0Mzc5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMjQwNDI2MTgzNjAw",
    "Timestamp": "20240426183600",
    "TransactionType": "CustomerPayBillOnline",
    "Amount": 1,
    "PartyA": 254708374149,
    "PartyB": 174379,
    "PhoneNumber": 254703991583,
    "CallBackURL": "https://mydomain.com/path",
    "AccountReference": "CompanyXLTD",
    "TransactionDesc": "Payment of X" 
}```

but when I replace the 
```"BusinessShortCode": 174379,```
 with my till number or even the store enumber, I still get the same
 ```...'Merchant does not exist'``` error. 

@ngangavic
Copy link

@C-o-m-o-n use TransactionType: CustomerBuyGoodsOnline for till number and CustomerPayBillOnline for paybill

@C-o-m-o-n
Copy link

@C-o-m-o-n use TransactionType: CustomerBuyGoodsOnline for till number and CustomerPayBillOnline for paybill

Look at the request I,m sending:

image

@ngangavic
Copy link

@C-o-m-o-n use TransactionType: CustomerBuyGoodsOnline for till number and CustomerPayBillOnline for paybill

Look at the request I,m sending:

image

Is 4336458 the till number or store number?

@C-o-m-o-n
Copy link

@C-o-m-o-n use TransactionType: CustomerBuyGoodsOnline for till number and CustomerPayBillOnline for paybill

Look at the request I,m sending:

image

Is 4336458 the till number or store number?

That's the till number. But I get the same error when I use the store number

@ngangavic
Copy link

@C-o-m-o-n you should use the store number not till number

@C-o-m-o-n
Copy link

@C-o-m-o-n you should use the store number not till number

Okay I'll try and let you know if it works

@James-Kamau3
Copy link

@C-o-m-o-n use TransactionType: CustomerBuyGoodsOnline for till number and CustomerPayBillOnline for paybill

Not working

@James-Kamau3
Copy link

James-Kamau3 commented May 21, 2024

@C-o-m-o-n you should use the store number not till number

Okay I'll try and let you know if it works

did you manage to make it work?

@MyronSCave
Copy link

You need to go live on daraja API website first, "Merchant does no exit" response comes up if your till is not upgraded to handle live payments. You need to talk to [email protected] for that. At the end you'll be sent an organization passkey with a live app on daraja API under Apps

@C-o-m-o-n
Copy link

@C-o-m-o-n you should use the store number not till number

Okay I'll try and let you know if it works

did you manage to make it work?

It worked with the test data . I still haven't been able to make it work with my till

@C-o-m-o-n
Copy link

You need to go live on daraja API website first, "Merchant does no exit" response comes up if your till is not upgraded to handle live payments. You need to talk to [email protected] for that. At the end you'll be sent an organization passkey with a live app on daraja API under Apps

Thanks a lot let me try that

@C-o-m-o-n
Copy link

You need to go live on daraja API website first, "Merchant does no exit" response comes up if your till is not upgraded to handle live payments. You need to talk to [email protected] for that. At the end you'll be sent an organization passkey with a live app on daraja API under Apps

Thanks a lot let me try that

Thanks a lot @MyronSCave . I talked to the Safaricom tean through the email you provided and got helped.

@paullaster
Copy link

Anybody who still encouter this error when on sandbox, i.e using dev test credential should note that; on sandbox, your TransactionType should always read CustomerPayBillOnline. My thinking is CustomerBuyGoodsOnline is not supported on sandbox but on live: maybe your test payload could have shape not far from this;

{
    "phoneNumber": "+25470****8", //masked for demo. You should have a real phone number
    "TransactionType":"CustomerPayBillOnline",
    "TransactionDesc": "Test fish payment",
    "amount": 500,
    "checkoutId": "CART3GVMZ",
   ...
}

You can also note that when using the daraja portal similator, you're not able to switch Transaction Type from CustomerPayBillOnline. I hope some body find this useful.

Mpesa team should confirm if this is the case.

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

No branches or pull requests