safaricom / LNMOnlineAndroidSample

Lipa Na MPESA Online (STK Push) Android Sample Application. This app demonstrates an e-commerce purchase and checkout process via Mpesa and Daraja :smile:
https://developer.safaricom.co.ke/
Apache License 2.0
127 stars 129 forks source link

FAILED STK-PUSH: ACCOUNTREFERENCE #45

Open AustinOyugi opened 2 years ago

AustinOyugi commented 2 years ago

{"status":"error","message":"The element AccountReference is invalid.","data":"20"}; Status code: 400 [] {"uid":"021d69b"}

Can't find a clear cause of the error

kisese commented 2 years ago

Hi @AustinOyugi , I believe the AccountReference parameter on the request body should be of type string and have a Maximum of 12 characters. Maybe check that

AustinOyugi commented 2 years ago

{ "BusinessShortCode": "1850908", "Password": "", "Timestamp": "20220615022333", "TransactionType": "CustomerBuyGoodsOnline", "Amount": "20", "PartyA": "254721373685", "PartyB": "1850908", "PhoneNumber": "254721373685", "CallBackURL": "https://7cb2-196-108-161-29.ngrok.io/v1/payment/mpesa/stkpush/callback", "AccountReference": "5BPW2EMS67XE", "TransactionDesc": "CustomerBuyGoodsOnline", "Remark": "CustomerBuyGoodsOnline" }

AustinOyugi commented 2 years ago

@kisese The payload I'm sending

AustinOyugi commented 2 years ago

@kisese any updates?