BASIC INFORMATION
This API allows you to integrate your website or mobile application with NetSoft Money. Once you have done the integration, you will be able to receive automated payments from your clients via NetSoft Money. This API has been developed while prioritizing security of transactions. All authorizations from the customer takes places on NetSoft Money system: they do not take place on merchant's web app. This unsures that customer's sensitive information is kept private and secure.
HOW NETSOFT MONEY API WORKS
SET UP YOUR ENVIRONMENT
Before you set up your environement, make sure you have created a merchant/business account on NetSoft Money. Then return here to proceed with the integration.
1.CREATE NETSOFTMONEY.PHP AND SCRIPT
Create netsoftmoney.php file that is linked to your checkout form. In the scripts section of the file, add the following link to call NetSoft API script:
<script type="text/javascript" src="https://www.netsoftmoney.com/api/api.js"></script>
2.CREATE TOKEN GENERATOR
Create a token generator in php as follows; In the scripts section of the file, add the following link to call NetSoft API script:
//generate token
$token_random = rand(1000, 10000);
$business_name = "replace with your business name no spaces";
$date = date("Y-m-d");
$token_id = $business_name.$token_random.$date;
3.CREATE A FORM CONSISTING OF YOUR CLIENT'S INFO
Create a form that will consist of your client's purchase information.
<form id="transact" method="" action="">
<input type="hidden" name="business_number" id="business_number" placeholder="" value="[Your NetSoftMoneyNumber]" required>
<input type="hidden" name="token_id" id="token_id" placeholder="" value="" required="">
<input type="hidden" name="amount" id="amount" placeholder="" value="[purchase amount]" required="">
<input type="submit" onClick="tester()" name="submit" value="submit">
</form>
4.CREATE TESTER FUNCTION IN JAVASCRIPT
<script type="text/javascript">
function tester(){
setTimeout(function(){
$("#transact").hide();
$("#complete_transaction").show();
}, 5000);
};
</script>
5.SENDING TOKEN TO CURL FUNCTION
Create a form to send your token info to CURL. Format the button on this form based on your template but ensure that it is of good size
<form id="complete_transaction" method="post" action="/integration.php" style="display:none;">
<input type="hidden" name="business_number" id="business_number" placeholder="" value="+265999592820" <equired="">
<input type="hidden" name="token" id="token" placeholder="" value="" required="">
<input class="primary" type="submit" name="submit" value="Complete Transaction">
</form>
6.ADD CURL FUNCTION TO YOUR FILE
Add the following php function to your file so that it can make transaction request to NetSoft Money once your customer confirms
if(isset($_POST["token"])){
$fields_string = "";
//set POST variables
$url = 'https://netsoftmoney.com/gateway/transactions.php';
$fields = array(
'token' => urlencode($_POST['token'])
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
echo $result;
}
THAT'S IT
Now test your API integration to make sure it is working. You can use our SANDBOX to test your intergration. For transactions that have occured succesfully, you will get 2029 notification. You can use that to confirm transactions on your database. If you are facing issues integrating your web application with NetSoft Money, please contact us so that we can help!