Open ghost opened 4 years ago
<?php $url = 'https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest';
$curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json','Authorization:Bearer 2VVjLDZcjslC51DaPAobH5srYYpb')); //setting custom header
$MERCHANT_ID = "174379"; $passkey = "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919"; $TIMESTAMP = date('YmdHis'); $PASSWORD = base64_encode( $MERCHANT_ID . $passkey . $TIMESTAMP );
$curl_post_data = array( //Fill in the request parameters with valid values 'BusinessShortCode' => '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; ?>
Originally posted by @Nellyazx in https://github.com/safaricom/LNMOnlineAndroidSample/issues/8#issuecomment-412769766
<?php $url = 'https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest';
$curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json','Authorization:Bearer 2VVjLDZcjslC51DaPAobH5srYYpb')); //setting custom header
$curl_post_data = array( //Fill in the request parameters with valid values 'BusinessShortCode' => '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; ?>
Originally posted by @Nellyazx in https://github.com/safaricom/LNMOnlineAndroidSample/issues/8#issuecomment-412769766