Skip to content

Instantly share code, notes, and snippets.

@worla
Last active April 13, 2017 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save worla/f82898ef7930c2dcaaf9f998a72f58b6 to your computer and use it in GitHub Desktop.
Save worla/f82898ef7930c2dcaaf9f998a72f58b6 to your computer and use it in GitHub Desktop.
Mobile Money Payment Without cURL
<?php
$data = array (
"customer_name" => "worla",
"customer_phone" => "0546652999",
"customer_email" => "creatoshub@gmail.com",
"wallet_provider" => "MTN",
"merchant_name" => "Creators Hub",
"amount" => "1",
);
$url = "https://app.mpowerpayments.com/api/v1/direct-mobile/charge";
$opts = array('http' =>
array(
'method' => 'POST',
'header' => "Content-Type: application/json\r\n" . "MP-Master-Key: arj67js7-g45n-1o1k-099t-5s7d8g8g0a73nx\r\n" . "MP-Private-Key: live_private_Hri2vBoqen5alM9c_4IvbbBqweersdFGH\r\n" . "MP-Token: 123asdt4ki85g12m9084r\r\n",
'content' => json_encode($data)
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
var_dump($result);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment