bdhobare / mpesa-android-sdk Goto Github PK
View Code? Open in Web Editor NEWAn android SDK for MPESA.
An android SDK for MPESA.
Hello,
When trying to pay up, this Token error always pops up. I have registered the app with Safaricom Developer's portal and it is approved. What could be the problem?
Thanks.
Please let me know if this code still works, looks like something I missed or i need to edit the credential for mpesa or sandbox?
When i click pay i get Invalid Access Token.
My Access token in Daraja Dashboard is active and have not yet expired.
I am using the test details from the dashboard as below
public static final String BUSINESS_SHORT_CODE = "174379"; public static final String PASSKEY = "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919";
`private void pay(String phone, int amount){
dialog.show();
STKPush.Builder builder = new STKPush.Builder(BUSINESS_SHORT_CODE, PASSKEY, amount,BUSINESS_SHORT_CODE, phone);
// SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
// String token = sharedPreferences.getString("InstanceID", "");
builder.setFirebaseRegID(FIREBASE_KEY);
builder.setCallBackURL(CALLBACK_URL);
STKPush push = builder.build();
Mpesa.getInstance().pay(this, push);
}`
the OnError method is the one that returns that message.
@Override public void onMpesaError(Pair<Integer, String> result) { Toast.makeText(context,"Auth error: "+result.message,Toast.LENGTH_LONG).show(); dialog.dismiss(); }
What would be causing this Since i am on the sandbox.
And in the code there is no option of inputting the access key generated from daraja dashboard
{ "access_token": "", "expires_in": "3599" }
400 Bad Request - Invalid BusinessShortCode
Hi,
What i'm i doing wrong? I keep on getting the below error when trying to process payment using the below samples.
//passkey, bsnCode2, bsnCode and testNumber sourced from developer.safaricom.co.ke
passKey = "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919";
bsnCode2 = "600147";
bsnCode = "174379";
testNumber = "254708374149";
// STKPush.Builder builderPay = new STKPush.Builder(bsnCode2, passKey, amount, bsnCode,testNumber);
//STKPush.Builder builderPay = new STKPush.Builder(bsnCode, passKey, amount, bsnCode, testNumber);
//repeated both steps with personal number instead of testNumber still got the same error
E/mpesaFailed: Invalid Access Token result Code :404
Where are the material dialog files at?
I recently found issues with API its giving me a warning that API would be outdated soon
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.