Initiate API Payment
Live Endpoint: https://strowallet.com/express/initiate
Method: GET
Just request to that endpoint with all parameter listed below:
All Parameters are required!
Example PHP Code to Request
// create array With Parameters
$parameters = array(
'amount' => '100',
'currency' => 'NGN',
'details' => 'Purchase Software',
'custom' => 'ABCD1234',
'ipn_url' => 'http://www.abc.com/ipn.php',
'success_url' => 'http://www.abc.com/success.php',
'cancel_url' => 'http://www.abc.com/cancelled.php',
'public_key' => 'ABCDEFGH123456789',
'name' => 'Mr. ABC XYZ',
'email' => '[email protected] );
// Generate The Url (LIVE)
$endpoint = 'https://strowallet.com/express/initiate';
$call = $endpoint . "?" . http_build_query($parameters);
// Send Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $call);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$response = curl_exec($ch);
curl_close($ch);
// $response contain the response from server
Response (Error)
{
"error": "error",
"message": {
"amount": [
"The amount format is invalid."
],
"details": [
"The details field is required."
]
}
{
"error": "ok",
"message": "Payment Initiated. Redirect to url",
"url": "https://strowallet.com/express/payment/UNIQUE_CODE"
}
Get Payment
After Successful response from last step, Redirect the User to
the URL you get as response. User can transact over our system
and we will notify on your IPN after Successful payment.
Remember, we send response to IPN only once per successful Transaction
IPN and Validate The Payment
Endpoint: Your IPN URL
Method: POST
You will get below parameter on your IPN:
Example PHP Code to validate The Payment
$amount = $_POST['amount'];
$currency = $_POST['currency'];
$custom = $_POST['custom'];
$trx_num = $_POST['trx_num'];
$sentSign = $_POST['signature'];
// with the 'custom' you can find your original amount and currency.
just cross check yourself. if that check is pass, proceed to next step.
// Generate your signature
$string = $amount.$currency.$custom.$trx_num;
$secret = 'YOUR_SECRET_KEY';
$mySign = strtoupper(hash_hmac('sha256', $string , $secret));
if($sentSign == $mySign)
{ // if sentSign and your generated signature match, The Payment
is verified. Never Share 'SECRET KEY' with anyone else. }