<form action="payment" method="POST">
<input type="hidden" name="merchant_account" value="merchant@xyz.com">
<input type="hidden" name="item_number" value="2">
<input type="hidden" name="item_name" value="Chocolates">
<input type="hidden" name="item_price" value="15">
<input type="hidden" name="item_currency" value="USD">
<input type="hidden" name="return_success" value="http://domain.com/success.php">
<input type="hidden" name="return_fail" value="http://domain.com/fail.php">
<input type="hidden" name="return_cancel" value="http://domain.com/cancel.php">
<button type="submit">Pay via </button>
</form>
Config form to get paid from your donaters.
<form action="payment" method="POST">
<input type="hidden" name="merchant_account" value="merchant@xyz.com">
<input type="hidden" name="item_number" value="2">
<input type="hidden" name="item_name" value="Donation For Children">
<input type="hidden" name="item_price" value="15">
<input type="hidden" name="item_currency" value="USD">
<input type="hidden" name="return_success" value="http://domain.com/success.php">
<input type="hidden" name="return_fail" value="http://domain.com/fail.php">
<input type="hidden" name="return_cancel" value="http://domain.com/cancel.php">
<button type="submit">Donate via </button>
</form>
merchant_account | : merchant@xyz.com | |
item_number | : 2 | |
item_name | : Chocolates | |
item_price | : 15 | |
item_currency | : USD/EUR/RUB | |
return_success | : http://domain.com/success.php | |
return_fail | : http://domain.com/fail.php | |
return_cancel | : http://domain.com/cancel.php |
<?php
$merchant_key = '...'; // Enter here your merchant API Key
$merchant_account = $_POST['merchant_account'];
$item_number = $_POST['item_number'];
$item_name = $_POST['item_name'];
$item_price = $_POST['item_price'];
$item_currency = $_POST['item_currency'];
$txid = $_POST['txid']; // Transaction ID
$payment_time = $_POST['payment_time']; // Current time of payment
$payee_account = $_POST['payee_account']; // The account of payee
$verification_link = "payment_status.php?merchant_key=$merchant_key&merchant_account=$merchant_account&txid=$txid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$verification_link);
$results=curl_exec($ch);
curl_close($ch);
$results = json_decode($results);
if($results->status == "success") {
//Payment is successful
//Run your php code here
echo 'Payment is successful.';
} else {
echo 'Payment was failed.';
}
?>
Run this codes to get wallet balances via API.
<?php
$merchant_key = '...'; // Enter here your merchant API Key
$merchant_account = "..."; // Enter Account Email address
$verification_link = "requests/GetWalletCurrency.php?merchant_key=$merchant_key&merchant_account=$merchant_account";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$verification_link);
$results=curl_exec($ch);
curl_close($ch);
$results = json_decode($results);
if($results->status == "success") {
//Fetching is successful
//Run your php code here
//Given Below code showing all currencies balance
foreach ($results as $item) {
echo "$item <br/>";
}
//Given Below code showing one currency balance
echo $results->USD; //Write currency code to see specific currency balance
} else {
echo $results->status;
}
?>
Run this codes to get current currency rates via API.
<?php
$from_currency = '...'; // Enter here From Currency Ex: USD
$to_currency = "..."; // Enter here To Currency Ex: EUR
$verification_link = "requests/Convert.php?amount=1&from=$from_currency&to=$to_currency";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$verification_link);
$results=curl_exec($ch);
curl_close($ch);
$results = json_decode($results);
if($results->status == "success") {
//Fetching is successful
//Run your php code here
//Given Below code showing a currency rates
echo "Status : $results->status <br>";
echo "Rate From : $results->rate_from <br>";
echo "Rate To : $results->rate_to <br>";
echo "Currency From : $results->currency_from <br>";
echo "Currency To : $results->currency_to <br>";
} else {
echo $results->status;
}
?>
Convert Currency with our rates.
<?php
$amount = '...'; // Enter Amount here Ex: 100
$from_currency = '...'; // Enter here From Currency Ex: USD
$to_currency = "..."; // Enter here To Currency Ex: EUR
$prefix = $from_currency.'_'.$to_currency;
$verification_link = "requests/CurrencyConverter.php?amount=$amount&from=$from_currency&to=$to_currency";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$verification_link);
$results=curl_exec($ch);
curl_close($ch);
$results = json_decode($results);
if($results->status == "success") {
//Fetching is successful
//Run your php code here
echo "$prefix : $results->convert <br>";
} else {
echo $results->status;
}
?>