Collections

Mobile Money collections

This section demostrates how you can use our API to collect funds in different currencies to different wallets from your clients.

Request Type

POST

General Payload


  // Sample PHP pay Load
  $data_req = [
    "req"=>"mobile_money",
    "currency"=>"XXXXXX",
    "phone"=>"MSISDN",
    "encryption_key"=>"XXXXXX",
    "amount"=>"XXXX",
    "emailAddress"=>"test@gmail.com",
    'call_back'=>"your-call-back-url",
    "txRef"=> "XXXXXX"
];
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://silicon-pay.com/process_payments',
  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 =>json_encode($data_req),
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;  

UGX Collection

For UGX collections, Pass currency as UGX


  "currency"=>"UGX"

TZS Collection

For TZS collections, Pass currency as TZS


  "currency"=>"TZS"

KES Collection

For KES collections, Pass currency as KES


  "currency"=>"KES"

ZMW Collection

For ZMW collections, Pass currency as ZMW


  "currency"=>"ZMW"

RWF Collection

For RWF collections, Pass currency as RWF


  "currency"=>"RWF"

NGN Collection

For NGNcollections, Pass currency as NGN


  "currency"=>"NGN"

XOF Collection

For XOF collections, Pass currency as XOF


  "currency"=>"XOF"

XAF Collection

For XAF collections, Pass currency as XAF


  "currency"=>"XAF"

Parameter Description

# Parameter Description
1 encryption_key Your-Account-Encryption-key". Found on top of your dashboard
2 Amount Amount you are charging the user
3 emailAddress Email Address of the person paying
4 phone MSISDN Phone number of the paying customer.
5 txRef Unique Transaction Reference
6 call_back Call Back url where we shall push a success notification
7 currency This is the currency in which you are charging the customer

Response

When all the payload parameters are correct, We shall a push notification to the MSIDN number provided. Below is the sample response code


{
  "status":"Successful",
  "message":"A push Notification has been sent to the Customer",
  "txRef":1234589
}

Success Call Back Notification.

Sample response that shall be triggered and sent to the call back url when the trasanction is successful



{
  "status":"successful",
  "amount":"xxxxx"
  "txRef":"XXXX",
  "nework_ref":"XXXXX",
  "msisdn":"XXXXX",
  "secure_hash":"XXXXX"
}

Recieve IPN/Call Back

A secure hash is sent with the call back data. This is to help you confirm that the call back came from us.


// Recieve IPN. 

$body = file_get_contents("php://input");
$dataObject = json_decode($body);

$reference = $dataObject->txRef;
$secure_hash = $dataObject->secure_hash;
$secrete_key ="Enter your account Secrete key"

// Generate a secure hash on your end.
  $cipher = 'aes-256-ecb';
	$generated_hash = openssl_encrypt($reference, $cipher, $secrete_key);
  
  if($generated_hash == $secure_hash){
    // The call back came from us. 
    // Give value to your customers.
  }

Check Transaction Status.

It is good practice to check the transaction status on our end before giving value to your cuatomers.

We do not send callback notifications for failed or pending transactions, Therefore in case you need to know the status of the transaction always querry the transaction status endpoint.


// Sample Pay Load
$payload = ["encryption_key"=>"XXXXX"];

//parameters
$transaction_reference =  "XXXXX";


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://silicon-pay.com/transaction_status/'.$transaction_reference,
  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 =>json_encode($payload),
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Sample Check Transaction status Response

Sample response for a successful check transaction status



{"code":200,"status":"SUCCESSFUL","amount":"5000","currency":"UGX"}

Plugins and SDK

Wordpress Plugin