mpesa | M-Pesa API Package for PHP | REST library
kandi X-RAY | mpesa Summary
kandi X-RAY | mpesa Summary
M-Pesa API Package for PHP
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Push a push to the Push
- Validate a number .
- Submit the registration .
- Authenticates an access token .
- Cleans the cache .
- Get a configuration value .
- Register facades .
- Get the configuration directory .
- Send HTTP request .
- Sets a reference .
mpesa Key Features
mpesa Examples and Code Snippets
Community Discussions
Trending Discussions on mpesa
QUESTION
I have a firebase post function that I am trying to send some data to but the problem I am having is that I the body comes empty. I am using express for the function.
...ANSWER
Answered 2021-Oct-23 at 15:47You seem to be sending the data correctly but are incorrectly using JSON.stringify()
. The object is the first argument, not the second. Make it JSON.stringify(req.body)
- that should work.
You can read up more about the function over at MDN docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
QUESTION
I am trying to check for selection in form, if selected option is cash, it submits else it calls an API and onse success response is returned the form should go ahead and submit
My Javascipt
...ANSWER
Answered 2021-Oct-23 at 09:23You can try using a global variable to store if AJAX call is successfull
QUESTION
I am new in Twilio and trying to develop an IVR that at some point runs a function (Run Fuuntion Widget). The function should send http request including the user phone number to a service provider to make payment for a product selected by the user.
I tryed the code bellow but the variable is not getting the user phone number.
...ANSWER
Answered 2021-Sep-17 at 01:24Twilio developer evangelist here.
You will need to pass the phone number into the Function via the Run Function widget.
You need to add a Function Parameter, for example From
, and then the data you want to pass, which for the incoming phone number is {{contact.channel.address}}
. Like so:
Then you can use event.From
in your Function code.
QUESTION
I would like to update the first item in the database each time a user clicks on a button but I keep getting the error every time, any assistance would be appreciated, below is the snippet.
...ANSWER
Answered 2021-Jun-02 at 12:09you get first instance from filter result so model instances does not have update method. if you always have first object then instead of doing that, try to use instance save
method;
QUESTION
I am working with Safaricom Mpesa Daraja Api using the test credentials. Everything was working okay but suddennly I start getting the error.
...ANSWER
Answered 2021-Apr-30 at 13:22Turns out the only way to solve this is to contact Safaricom Api Support team and ask them to rectify the issue.
QUESTION
I am trying to work on a Django app and I would like to check if the boolean object in the database is False and save it as True, but every time I get the error above, I would appreciate any assistance or insight on what I'm doing wrong.
views.py
...ANSWER
Answered 2021-Apr-26 at 22:15In your views.py you set status = data.Completed
which creates a variable called status with the boolean value that data.Completed
holds. So that means that the status variable doesn't have the attribute save.
We need to set the completed
field to True
then save the data object.
Try this:
QUESTION
I'm trying to make an app that can send payments to PayBill numbers with Safaricom's "Lipa Na M-Pesa" (a Kenyan thing). The call is a POST
request to URL:
ANSWER
Answered 2020-Dec-14 at 10:59Is there any way I can create a callback URL with them that will receive their callback as a document in a Firestore collection?...
The most common way to do that in the Firebase ecosystem is to write an HTTPS Cloud Function that will be called by the Safaricom service.
Within the Cloud Function you will be able to update the Firestore document, based on the content of the POST request.
Something like:
QUESTION
Seems rather like an unwanted requirement for a piece of code but in my case this is exactly what I need. I have an api (API-1) that interacts with a third party service. This third party service instead of directly giving me a response that I can forward back to frontend is giving me response on API-2 (With a webhook listener endpoint). I'm saving this API-2 response that I get by listening to the webhook in my database. Now I somehow need this response which is now sitting idol in my database in my API-1 so that I can forward it back to the frontend. If I query the database right away during the flow of the API-1 (Just after consume the third party service API), I'll get null as API-2 is getting the response asynchronously with a webhook (Mostly a gap of 1-2 seconds). So I somehow need to figure out an easy way to await/hold the API-1 flow till the database does not return null/returns back the response I saved from API-2 in the database. I'm not sure if the gap will always be 1-2 seconds hence I can't be using setTimeout for this.
...ANSWER
Answered 2020-Oct-28 at 14:29async function getNotNullResponse({conversationId}){
const webhookResponse = await MpesaModel.findOne({conversationId});
return webhookResponse || getNotNullResponse({conversationId});
}
//API-1
const sendPaymentRequest = async (req, res) => {
try {
const payment_reponse = await axios.post(url, body, config);
const { data } = payment_reponse;
console.log("Payment request => ", data);
//Check result i.e response from http listener
const webhookResponse = await getNotNullResponse({
conversationId: data.ConversationID
});
console.log('Webhook response => ', webhookResponse); //This is not null
res.status(200).json({ message: "Send money request", data });
} catch (error) {
console.log("Error while making a payment request", error);
res
.status(400)
.json({ message: "Error while send payment request", error: error.data });
}
};
//API-2 - This is the webhook which receives the response
const saveWebhookB2C = async (req, res) => {
const { Result } = req.body;
//console.log('Mpesa webhook data received => ', Result);
let saveResponse = new MpesaModel({
...Result,
});
const result = await saveResponse.save();
console.log('B2c mpesa to kenya saved in db => ', result);
res.status(200).send();
};
QUESTION
I echoed this and fetched in ajax .
...ANSWER
Answered 2020-Aug-18 at 13:10Using isset
will accomplish your goal:
QUESTION
In my react app, I have a select drop-down input. However, whenever i want to maintain the 1st occurrence in my case Mpesa
(maintaining as it is by not even clicking the field) of my select option during form filling after making form submission, I get an error
mode(pin):['"" is not a valid choice.']
The onChange
is not picking that 1st occurrence unless i click another option then re-select that 1st option.
Form component
...ANSWER
Answered 2020-Aug-07 at 15:44In class use componentDidMount for setting initail value in state
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mpesa
Run composer require smodav/mpesa to get the latest stable version of the package.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page