Parameter | Details |
---|---|
amount | Your Amount , Must be rounded at 2 precision. |
Details | Details of the Transaction. Supported Currency : CAD CNY EGP GBP INR NGN QIK RUB USD |
currency | Currency Code, Must be in Upper Case. string not more than 100 char. |
custom | Custom Code/Transaction Number for Identify at your end. string not more than 16 char. |
ipn_url | URL of your IPN Listener |
success_url | Redirect url after successful Payment |
cancel_url | Redirect url after Cancel the Payment |
public_key | Your API Public Key |
name | Name of the Client. string not more than 100 char. |
Email of the Client. string not more than 100 char. |
Example PHP Code to Request // create array With Parameters
$parameters = array(
'amount' => '10.33',
'currency' => 'USD',
'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' => 'abc@abc.com'
);
// Generate The Url (LIVE)
$endpoint = 'https://script.appdevs.net/trend-wallet/express/initiate';
$call = $endpoint . "?" . http_build_query($parameters);
// Generate The Url (TEST)
$endpoint = 'https://script.appdevs.net/trend-wallet/express/sandbox/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, $add);
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."
]
}
}
Response (Success) {
"error": "ok",
"message": "Payment Initiated. Redirect to url",
"url": "https://script.appdevs.net/trend-wallet/express/payment/UNIQUE_CODE"
}
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.
Parameter | Details |
---|---|
amount | Your Requested Amount |
currency | Currency Code, as You passed on first step. |
custom | Custom String for Identify the payment, as You passed on first step. |
trx_num | Transaction Number on our platform. |
signature | A Hash to Verify the Payment. See code on right side to get more on it. |
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. }
Discover How Specific Cryptocurrencies Work — And Get A Bit Of Each Crypto To Try Out For Yourself.
Copyright © 2022 Trend-wallet. All Rights Reserved.