Mpesa C2B Paybill -Validation and Confirmation Integration

3,459 views
Skip to first unread message

John

unread,
Aug 8, 2016, 6:07:03 AM8/8/16
to PesaPi
My colleague and i just finished to successfully implement the mpesa buy goods validation and confirmation.Its been a process but now we have managed to integrate it sure.

In case of assistance i will stick around.


Aleky Wabz

unread,
Aug 9, 2016, 12:55:23 PM8/9/16
to PesaPi
Can you please guide me on how to integrate it to pay for tickets on my on project am working due on Friday. Your help and advice is highly welcomed and appreciated.

John

unread,
Aug 9, 2016, 3:12:43 PM8/9/16
to PesaPi

Hello Aleky,

Whats your development platform?php or what?The solution i have done is in .net.

However,note that its not possible to accomplish that by friday from your live paybill.Their are steps involved in testing it with safaricom guys.What i can promise is that it can take utmost 2 Weeks to have it running asap.Not coding part,but setup with safaricom which entails certificates installation,IP whitelisting in their platform. and few requirements from them.At the end however its  worth it

Let me know your development platform

Alex Wokabi

unread,
Aug 9, 2016, 5:04:43 PM8/9/16
to PesaPi
Am on PHP. Actually i have been able to set up the pesapi my big problem is that am getting 25 records of a single transaction. what's could be the possible problem? Help and advice highly welcomed 

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to a topic in the Google Groups "PesaPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pesapi/4MzfQvm9_78/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pesapi+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John

unread,
Aug 10, 2016, 1:16:07 AM8/10/16
to PesaPi
I think we are on different page.The API am talking about is the latest released mpesa G2 which does not involve pesapi.I thought that's what you were asking initially.Now that you have talked about pesapi,i advise you check on pesapi documentation .I think it has some good documentation.

ELIJAH MWANGI

unread,
Aug 10, 2016, 3:24:04 AM8/10/16
to pes...@googlegroups.com
@Aleky

If you have the Paybill number already registered i can assist you to automate yout business by COB today

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to the Google Groups "PesaPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pesapi+unsubscribe@googlegroups.com.

Platinum

unread,
Aug 14, 2016, 7:29:57 AM8/14/16
to PesaPi


On Monday, August 8, 2016 at 1:07:03 PM UTC+3, John wrote:
My colleague and i just finished to successfully implement the mpesa buy goods validation and confirmation.Its been a process but now we have managed to integrate it sure.

In case of assistance i will stick around.


Hi?
Which language in .net (c# or vb) and what are the steps to fully set Mpesa capability on my system,
am a developer specializing in android and desktop application.

Thank You.

Platinum

unread,
Aug 14, 2016, 7:36:41 AM8/14/16
to PesaPi


On Monday, August 8, 2016 at 1:07:03 PM UTC+3, John wrote:
My colleague and i just finished to successfully implement the mpesa buy goods validation and confirmation.Its been a process but now we have managed to integrate it sure.

In case of assistance i will stick around.


Bogonko Shadrack

unread,
Aug 14, 2016, 9:01:25 AM8/14/16
to PesaPi
Hallo John,

Am working on a project that involves M-Pesa API and am stuck, kindly assist. Am using C# for development.

John

unread,
Aug 15, 2016, 1:54:01 AM8/15/16
to PesaPi
Hello,i have used C#.

Steps:

1)Reach out mpesa development team-
2)Have them register your Endpoints for both http and https
3)Code in your specific language to extract the posted Parameters in your endpoint
3)Provision them with your IP addresses both http and https.
4)Go live

John

unread,
Aug 15, 2016, 1:55:24 AM8/15/16
to PesaPi
Hello,

Which API are you  trying to implement and where are you stuck?Tx

Ugabay Store

unread,
Sep 2, 2016, 1:47:41 PM9/2/16
to PesaPi
Hello John, can you integrate for me (ofcourse at a cost) in my crowdfunding website?

John

unread,
Sep 3, 2016, 4:19:10 AM9/3/16
to PesaPi

@Ugabay store thats possible.You can reach me in my mail and we can see the way forward sure

jesse kariuki

unread,
Sep 29, 2016, 2:08:30 AM9/29/16
to PesaPi
Hi Boss Can You assist me i also need to Integrate this API.

On Monday, August 8, 2016 at 1:07:03 PM UTC+3, John wrote:

David Mudilo

unread,
Oct 18, 2016, 11:18:53 PM10/18/16
to PesaPi
Hey John, I'm David I just post a new challenge please have a look and let me know

Pius Nganga

unread,
Dec 13, 2016, 5:12:11 AM12/13/16
to PesaPi


On Monday, August 8, 2016 at 1:07:03 PM UTC+3, John wrote:
My colleague and i just finished to successfully implement the mpesa buy goods validation and confirmation.Its been a process but now we have managed to integrate it sure.

In case of assistance i will stick around.

Hi John, My app is using Nodejs and I have already reached out to safaricom developers, I need your advice on how to test on local host.Also on extracting on my endpoint

James

unread,
Jan 10, 2017, 1:11:47 AM1/10/17
to PesaPi
Hi Everyone, Has anyone done C2B Validation and Confirmation. I am using PHP and I am stuck at creating a web service.

John

unread,
Jan 12, 2017, 3:00:07 AM1/12/17
to PesaPi

Hello.Yes i did it successfully.

James Kamau

unread,
Feb 15, 2017, 3:29:05 AM2/15/17
to PesaPi
@John Kindly assist me in having my web service work. It keeps throwing errors when the MPESA developers do mock transaction.

ra...@statecorps.ae

unread,
Feb 16, 2017, 1:05:20 AM2/16/17
to PesaPi
Dear John,

I am  dotnet Developer and trying to start with M-Pesa integration. On other hand , I have already follow up some research but I did not get sufficient inforation from them.As I read your message and found that you did it,Successfully.Will you please send me some links or any material that will Help me ......


Thanks In Advance 

Pius Nganga

unread,
Feb 16, 2017, 6:57:46 AM2/16/17
to pes...@googlegroups.com
Hi guys,

Since this is a challenge we are all facing
,could we meet with John and discuss?

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to a topic in the Google Groups "PesaPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pesapi/4MzfQvm9_78/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pesapi+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Hi,





Regards,
Pnganga
Message has been deleted

John

unread,
Feb 16, 2017, 8:51:13 AM2/16/17
to PesaPi
Hello James,

What kind of mpesa service are you working on? C2B ,B2C,B2B?

John

unread,
Feb 16, 2017, 8:54:11 AM2/16/17
to PesaPi
Hello,

Thanks for your message.Unfortunately their is no materials for this.Mpesa api has no tutorials the moment.What i can offer is guidance.

John

unread,
Feb 16, 2017, 8:55:34 AM2/16/17
to PesaPi

Pius,

How far have you reached? The last time you suggested working on it.

On Thursday, February 16, 2017 at 2:57:46 PM UTC+3, Pius Nganga wrote:
Hi guys,

Since this is a challenge we are all facing
,could we meet with John and discuss?
On Thu, Feb 16, 2017 at 9:05 AM, <ra...@statecorps.ae> wrote:
Dear John,

I am  dotnet Developer and trying to start with M-Pesa integration. On other hand , I have already follow up some research but I did not get sufficient inforation from them.As I read your message and found that you did it,Successfully.Will you please send me some links or any material that will Help me ......


Thanks In Advance 

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to a topic in the Google Groups "PesaPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pesapi/4MzfQvm9_78/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pesapi+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Hi,





Regards,
Pnganga
Message has been deleted

John

unread,
Feb 16, 2017, 8:56:56 AM2/16/17
to PesaPi
@Christine nice idea

On Thursday, February 16, 2017 at 4:39:43 PM UTC+3, Christian Mwanza wrote:
I can provide a venue...office right next to a pub in case things get frustrating :)


On Thursday, 16 February 2017 14:57:46 UTC+3, Pius Nganga wrote:
Hi guys,

Since this is a challenge we are all facing
,could we meet with John and discuss?
On Thu, Feb 16, 2017 at 9:05 AM, <ra...@statecorps.ae> wrote:
Dear John,

I am  dotnet Developer and trying to start with M-Pesa integration. On other hand , I have already follow up some research but I did not get sufficient inforation from them.As I read your message and found that you did it,Successfully.Will you please send me some links or any material that will Help me ......


Thanks In Advance 

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to a topic in the Google Groups "PesaPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pesapi/4MzfQvm9_78/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pesapi+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Hi,





Regards,
Pnganga

John

unread,
Feb 16, 2017, 9:11:05 AM2/16/17
to PesaPi
Hi Christian,

Thanks for your message.My contact based at Kenya will call you.

On Thursday, February 16, 2017 at 4:56:25 PM UTC+3, Christian Mwanza wrote:
John... give me a call please on 0724589457 

You received this message because you are subscribed to the Google Groups "PesaPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pesapi+un...@googlegroups.com.

James Kamau

unread,
Feb 17, 2017, 1:35:53 AM2/17/17
to PesaPi
Hello John,
I am working on a C2B service.

When we run a test with the safaricom developer, it keeps failing. Below is my validation code, kindly have a look a let me know what I am doing wrong. I would really appreciate.
<?php
if (!$request=file_get_contents('php://input'))

{

echo "Invalid input";

exit();

}
//clean the soap input received from Mpesa so that you can parse it as raw XML

$clean_xml = str_ireplace(['soapenv:', 'soap:', 'c2b:', 'ns1:' ], $request);
$xml = simplexml_load_string($clean_xml);
//you can extract any payment details using the below code

foreach ($xml->xpath('//C2BPaymentValidationRequest') as $item)

{

$AccountNo=trim($item->BillRefNumber);
                                                                                                //VALUES
                                                                                              
                                                                                                $AccountNo = $cur->BillRefNumber;
                                                                                                                                                                                      
                                                                                                                                                                                              
                                                                                                //SAVE TO DATABASE
                                                                                               $connect = mysql_connect($server,$user,$pass) or die (mysql_error());
                                                                                               $select = mysql_select_db($db) or die (mysql_error());                                                                                               
                                                                                                $query = "SELECT * FROM `USERS` WHERE `name`='".mysql_real_escape_string(trim($AccountNo))."'";
                                                                                                               
                                                                                                   $result = mysqli_query($connect,$select,$query);
                                                                                                        if (mysqli_num_rows($result) == 1)
                                                                                                        {

                                                                                                        echo '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:c2b="http://cps.huawei.com/cpsinterface/c2bpayment">
   <soapenv:Header/>
   <soapenv:Body>
      <c2b:C2BPaymentValidationResult>
        <ResultCode>0</ResultCode>
       <ResultDesc>Service processing successful</ResultDesc>
       <ThirdPartyTransID></ThirdPartyTransID>
      </c2b:C2BPaymentValidationResult>
   </soapenv:Body>
</soapenv:Envelope>
'; //Pass, do something
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                    echo  '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:c2b="http://cps.huawei.com/cpsinterface/c2bpayment">
   <soapenv:Header/>
   <soapenv:Body>
      <c2b:C2BPaymentValidationResult>
        <ResultCode>C2B00012</ResultCode>
       <ResultDesc>Invalid Account number</ResultDesc>
       <ThirdPartyTransID></ThirdPartyTransID>
      </c2b:C2BPaymentValidationResult>
   </soapenv:Body>
</soapenv:Envelope>
'; //Fail
                                                                                                }
                                                                                                        } 
?>

James

unread,
Feb 21, 2017, 8:47:33 AM2/21/17
to PesaPi
I have posted my issue on stackoverflow, if you can help come up with a solution I would really appreciate. Below is the link:
http://stackoverflow.com/questions/42369020/cleaning-xml-data-using-str-ireplace-function

Jayst

unread,
Mar 1, 2017, 12:38:30 AM3/1/17
to PesaPi
Hey John,
Kindly inbox me at jwks...@gmaill.com we talk on how you can help me cleanup my scripts for web service.

Tru Lance247

unread,
Mar 15, 2017, 3:53:05 AM3/15/17
to PesaPi
Hi, I am working on a C2B PHP integration. John can you please assist me with this?

mwangi

unread,
Mar 15, 2017, 7:00:42 AM3/15/17
to PesaPi
let me know if you get stuck. I can help

Stephen Oduor

unread,
Aug 23, 2017, 3:07:22 AM8/23/17
to PesaPi
Hi, could you help me am doing am integrating paybill with the new mpesa REST API but Validation and confirmation(endpoints) does not work, the rest are ok ie in the sandbox
My whatsapp is +254710401008  my email: stephe...@gmail.com, I will appreciate
Message has been deleted

Ram

unread,
Sep 20, 2017, 3:49:01 AM9/20/17
to PesaPi
Hi John,

I am Ram, ASP.NET Developer and trying to integrate M-Pesa with my project but finding difficulty in startup as i am new to this payment integration, i gone through the forum and found that you have already did it successfully. Will you please assist me how to integrate this or send me some sample codes on implementing using C#.

Thanks in advance

John

unread,
Sep 20, 2017, 4:03:07 AM9/20/17
to PesaPi
Hey,

Are you doing B2C ,C2B or B2B?

Ram

unread,
Sep 20, 2017, 4:38:45 AM9/20/17
to PesaPi
Hi John,

I am doing B2C and C2B

Thanks in advance

John

unread,
Sep 20, 2017, 5:35:56 AM9/20/17
to PesaPi
Hi,

Their are two ways:-

One is i provide you with B2C and C2B which is chargeable:

B2C is 10 bob per transaction and C2B is only 1 KES to receive IPN and we only charge the company.

The other mode is one off fee which is agreed on  the project.

All this take just few minutes to set up.

Kind Regards,
John

kamau ngugi

unread,
Sep 25, 2017, 10:32:48 AM9/25/17
to PesaPi
Hello john,am trying to integrate mpesa paybill with my project, would you please help, how can I contact you

John

unread,
Sep 26, 2017, 8:16:38 AM9/26/17
to PesaPi
Hi,
Where are you stuck ?.Also,which platform are you integrating with?

Stephen Oduor

unread,
Oct 4, 2017, 10:40:04 PM10/4/17
to PesaPi
Hi, did you get a solution, I have successfully integrated Mpesa C2B .... its one time payment you dont have to be charged per transaction which is very expensive.

 if you need help contact me on whatsapp +254710401008 

Stephen Oduor

unread,
Oct 4, 2017, 10:40:35 PM10/4/17
to PesaPi
Hi, did you get a solution, I have successfully integrated Mpesa C2B .... its one time payment you dont have to be charged per transaction which is very expensive.

 if you need help contact me on whatsapp +254710401008 

On Monday, September 25, 2017 at 5:32:48 PM UTC+3, kamau ngugi wrote:

Sidney Muga

unread,
Oct 7, 2017, 4:14:29 AM10/7/17
to PesaPi

Sidney Muga

unread,
Oct 7, 2017, 4:15:15 AM10/7/17
to PesaPi
hi team. need help intergrating c2b to my system.

Dennis Munene

unread,
Oct 7, 2017, 11:26:20 AM10/7/17
to PesaPi
I would like help on implementation.

John

unread,
Oct 10, 2017, 5:48:44 AM10/10/17
to PesaPi
Hi,

Where are you stuck?

John

unread,
Oct 10, 2017, 6:47:14 AM10/10/17
to PesaPi
Hi Dennis,

Where are

Sidney Muga

unread,
Oct 11, 2017, 3:31:08 PM10/11/17
to PesaPi
Hi john id also like help integrating mpesa api. cant get their public key encrypted.

Sidney Muga

unread,
Oct 11, 2017, 3:31:34 PM10/11/17
to PesaPi
btw i using php

Edward Ndukui

unread,
Oct 28, 2017, 9:27:35 PM10/28/17
to PesaPi
Hi John,

I've read through this entire thread.

I'm facing a huge challenge setting up MPesa (C2B) Lipa na Mpesa API.
I'm developing in native Android (Java) and don't even know where to start with this API, simply because I haven't done more than basic of PHP before, and I don't have much experience with hosting PHP projects.

Any advice is highly appreciated.

Thanks.


On Monday, August 8, 2016 at 1:07:03 PM UTC+3, John wrote:

Tru Lance247

unread,
Nov 2, 2017, 8:04:07 AM11/2/17
to pes...@googlegroups.com
After a long wait, safaricom has finally unleashed the long awaited sandbox. Check it out guys: https://developer.safaricom.co.ke

________________________________________________


CHARLES EVANS OGEGO OTIENO
Universitas Lodziensis - Veritas et libertas


--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to a topic in the Google Groups "PesaPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pesapi/4MzfQvm9_78/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pesapi+unsubscribe@googlegroups.com.

peter gitonga

unread,
Nov 2, 2017, 9:21:52 AM11/2/17
to PesaPi
kindly assist me

jeffzod

unread,
Nov 17, 2017, 6:30:56 AM11/17/17
to PesaPi
Hi,
I am a developer currently working on a project that requires Mpesa payment during checkout. I have implemented other payment systems like Paypal successfully but Mpesa is presenting a challenge.I have tried using Pesapi but the Pesapi folder I downloaded from github does not have a database and mpesa_private. I followed the Youtube tuts and they do not have adequate information on the Mpesa payment implementation.Kindly help me out.

Tru Lance247

unread,
Nov 17, 2017, 6:42:50 AM11/17/17
to pes...@googlegroups.com
If you have ever integerated the Paypal API, then check out thie new safaricom developer portal: http://developer.safaricom.co.ke/

________________________________________________


CHARLES EVANS OGEGO OTIENO
Universitas Lodziensis - Veritas et libertas


Aleki sebastian

unread,
Jan 11, 2018, 3:54:38 AM1/11/18
to PesaPi
Hallo John! I am Sebastian. I have integrated m-pesa api with my laravel project but i m stack at confirmation and validation url. I m new to this staff. Kindly your help will be highly appreciate so much

John

unread,
Jan 12, 2018, 5:50:54 AM1/12/18
to PesaPi
Hi,

Where are you stuck?

wesh wesh

unread,
Jan 12, 2018, 6:06:42 AM1/12/18
to PesaPi


Hi John i would like your assistance i have a lipa na mpesa want to integrate with php ,is it possible.
Thanks.

John

unread,
Jan 12, 2018, 6:14:08 AM1/12/18
to PesaPi
yes its possible .Disclaimer (Chargeable)

wesh wesh

unread,
Jan 12, 2018, 6:26:23 AM1/12/18
to PesaPi

 Ok John please send me your rate  to my email trac...@gmail.com

copenju cope

unread,
Mar 13, 2018, 3:54:26 AM3/13/18
to PesaPi
hi wesh wesh did you manage to intergrate mpesa c2b

copenju cope

unread,
Mar 13, 2018, 3:55:44 AM3/13/18
to PesaPi
hi jeff didi you manage to implement mpesa c2b api

copenju cope

unread,
Mar 13, 2018, 3:57:44 AM3/13/18
to PesaPi
hi Edward did you manage integrate mpesa c2b api

php2 Vrinsoft

unread,
Oct 19, 2018, 7:58:25 AM10/19/18
to PesaPi
hey John, how can I see the dummy payment done using test credentials in mpesa.. I am integrating using PHP like you did, Got the success message but need to see how and where the payment is shown.

Need Quick Response

ItsAbiud

unread,
Oct 19, 2018, 9:50:27 AM10/19/18
to pes...@googlegroups.com
you can use paytal.co.ke , get API credentials from developer.paytalk.co.ke 

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to the Google Groups "PesaPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pesapi+un...@googlegroups.com.

Boniface Sambai

unread,
Feb 16, 2019, 12:45:38 PM2/16/19
to PesaPi
Hello john i need help +254799838399

ItsAbiud

unread,
Feb 16, 2019, 12:55:33 PM2/16/19
to pes...@googlegroups.com
Hello John, how are you? How can I help you?

--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to the Google Groups "PesaPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pesapi+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Abiud Ekidon Omonya,
Web Developer | Software Developer | Ethical Hacker | Blogger
Phone: 0795106506
Whatsapp: 0726013232

ItsAbiud

unread,
Feb 16, 2019, 12:57:50 PM2/16/19
to pes...@googlegroups.com
Hello Boniface, how can I help you?

On Sat, 16 Feb 2019 at 20:45, Boniface Sambai <sambaib...@gmail.com> wrote:
--
PesaPi official website http://www.pesapi.com
---
You received this message because you are subscribed to the Google Groups "PesaPi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pesapi+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages