Web Payment Collections - Standard Integration
This method involves creating a unique link that directs customers to the checkout page for completing their payments.
How to integrate
This integration can be completed in 3 easy steps:
1. Collect required data from user
2. Post required data to the endpoint
3. Display the URL in the server response as as link for the user to click or redirect the user to that URL
Usage
API Endpoint - https://checkout.marasoftpay.live/initiate_transaction
Method - POST
Data Type - JSON
Limit - No Limit
Required Parameters
Parameter | Required? | Description |
---|---|---|
public_key | Yes | Your public key from MarasoftPay. Use test key for test mode and live key for live mode |
request_type | Yes | Your public key type from MarasoftPay. Use test for test mode and live for live mode |
merchant_ref | Yes | The Merchant Transaction Reference is a unique reference generated by the merchant that enables them identify & track transactions internally. |
redirect_url | Yes | Setting it in the code allows you to be flexible with the redirect URL if you need to, this is where the customer is redirected to after trasaction. |
name | No | Customer name |
email_address | Yes | Email address of customer |
phone_number | Yes | Phone number of customer |
amount | Yes | Amount (in the lowest currency value - kobo, pesewas or cent) you are debiting customer. Do not pass this when creating subscriptions. |
currency | Yes | Currency charge should be performed in. Allowed values are: NGN and USD It defaults to NGN. |
user_bear_charge | No | "yes" if you want the userto pay the charges or "no" if you want the charges to be deducted from the amount paid |
description | No | Field containing the description you want recorded with the transaction. |
webhook_url | No | Field containing the custom webhook url to send notification for this transaction to. |
preferred_payment_option | No | Field containing the default payment option to be offered to your users. |
Payload Structure
{
"data" : {
'public_key': 'MSFT_LIVE_R60L360KPGB0R0HR7OBYGQR0OBVDWGE16763417',
'request_type': 'live',
'merchant_tx_ref': 'ref_12345678',
'redirect_url': 'https://google.com',
'name': 'ambrose',
'email_address': 'ambydavid@gmail.com\n',
'phone_number': '09057333812',
'amount': '10000',
'currency': 'NGN',
'user_bear_charge': 'no',
'preferred_payment_option': 'ussd',
'description': 'testing testing'
}
}
Request Sample
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://checkout.marasoftpay.live/initiate_transaction',
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 => array(
'public_key' => 'MSFT_Live_R60L360KPGB0R0HR7OBYGQR0OVDWGE1677663417',
'request_type' => 'live',
'merchant_tx_ref' => 'ref_12345678','
redirect_url' => 'https://google.com',
'name' => 'ambrose',
'email_address' => 'ambydavid@gmail.com',
'phone_number' => '09057333812',
'amount' => '10000',
'currency' => 'NGN',
'user_bear_charge' => 'no',
'preferred_payment_option' => 'ussd',
'description' => 'testing testing'
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://checkout.marasoftpay.live/initiate_transaction',
'headers': {
},
payload: {
data : {
'enc_key': 'MSFT_Enc_R60L360KPGB0R0HR7OBYGQR0OBVDWGE1677663417',
'request_type': 'live',
'merchant_tx_ref': 'ref_12345678',
'redirect_url': 'https://google.com',
'name': 'ambrose',
'email_address': 'ambydavid@gmail.com\n',
'phone_number': '09057333812',
'amount': '10000',
'currency': 'NGN',
'user_bear_charge': 'no',
'preferred_payment_option': 'ussd',
'description': 'testing testing'
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Response Sample
{
"status": "success",
"url": "https://checkout.marasoftpay.com/pay?id=1781490230SIYSGCSOTWONMNAOWbFWNBFMLV1658771158"
}
Handling Webhooks
After a payment has been successfully processed, Marasoft Pay will send a webhook notification to the URL that you specify. For more information on how to utilize webhooks, please refer Webhooks section of this documentation