Mobile-money

/payouts/mobile-money

Paying out mobile-money is no rocket science, here is how to it, Chief 😉

POST https://live.chimoney.io/api/v0.1/payouts/mobile-money

Payout mobile-money

Headers

NameTypeDescription

X-API-Key*

API_KEY_FROM_DEV_PORTAL

Request Body

NameTypeDescription

countryToSend*

Kenya

phoneNumber*

+255700000000

valueInUSD*

1

reference*

String

momoCode*

MPS

{
    // transaction detail
}

#Javascript FETCH

var myHeaders = new Headers();
myHeaders.append("X-API-KEY", "API_KEY_FROM_DEV_PORTAL");

var raw = "{\n    \"momos\": [\n        {\n            \"countryToSend\": \"Kenya\",\n            \"phoneNumber\": \"+254710102720\",\n            \"valueInUSD\": 1,\n            \"reference\": \"\",\n            \"momoCode\": \"MPS\"\n        }\n    ]\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://live.chimoney.io/api/v0.1/payouts/mobile-money", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

#Python REQUESTS

import requests

url = "https://live.chimoney.io/api/v0.1/payouts/mobile-money"

payload = "{\n    \"momos\": [\n        {\n            \"countryToSend\": \"Kenya\",\n            \"phoneNumber\": \"+254710102720\",\n            \"valueInUSD\": 1,\n            \"reference\": \"\",\n            \"momoCode\": \"MPS\"\n        }\n    ]\n}"
headers = {
  'X-API-KEY': 'API_KEY_FROM_DEV_PORTAL'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

#PHP cURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://live.chimoney.io/api/v0.1/payouts/mobile-money',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "momos": [
        {
            "countryToSend": "Kenya",
            "phoneNumber": "+254710102720",
            "valueInUSD": 1,
            "reference": "",
            "momoCode": "MPS"
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'X-API-KEY: API_KEY_FROM_DEV_PORTAL'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Yay! It's done.

Last updated