Sample integrations
Sample Integrations
Popup payment method sample code
Just paste the code below inside the body tag and enter your valid data to start using Popup Payment Method
<!DOCTYPE html>
<html>
<head>
<title>Payment</title>
<meta charset="utf-8"/>
</head>
<body>
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.foloosi.com/aggregatorapi/web/initialize-setup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "transaction_amount=1¤cy=AED&customer_address=Address&customer_city=Dubai&billing_country=ARE&billing_state=Dubai&billing_postal_code=000000&customer_name=Test&customer_email=test%40email.com&customer_mobile=9876543210",
CURLOPT_HTTPHEADER => array(
'content-type: application/x-www-form-urlencoded',
'merchant_key: YOUR_MERCHANT_KEY'
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$responseData = json_decode($response,true);
$reference_token = $responseData['data']['reference_token'];
}
?>
<script type="text/javascript" src="https://www.foloosi.com/js/foloosipay.v2.js"></script>
<script type="text/javascript">
var reference_token = "<?= $reference_token; ?>";
var options = {
"reference_token" : reference_token,
"merchant_key" : "YOUR_MERCHANT_KEY"
}
var fp1 = new Foloosipay(options);
fp1.open();
foloosiHandler(response, function (e) {
if(e.data.status == 'success'){
console.log(e.data)
}
if(e.data.status == 'error'){
console.log(e.data)
}
if(e.data.status == 'closed'){
console.log(e.data)
}
});
</script>
</body>
</html>
Hosting payment method sample code
Just paste the code below inside the body tag and enter your valid data to start using Redirect Payment Method
<!DOCTYPE html>
<html>
<head>
<title>Payment</title>
<meta charset="utf-8"/>
</head>
<body>
<?php
$site_return_url = urlencode("YOUR_REDIRECTION_SITE_URL")
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.foloosi.com/aggregatorapi/web/initialize-setup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "transaction_amount=1¤cy=AED&customer_address=Address&customer_city=Dubai&billing_country=ARE&billing_state=Dubai&billing_postal_code=000000&customer_name=Test&customer_email=test%40email.com&customer_mobile=9876543210&site_return_url=".$site_return_url,
CURLOPT_HTTPHEADER => array(
'content-type: application/x-www-form-urlencoded',
'merchant_key: YOUR_MERCHANT_KEY'
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$responseData = json_decode($response,true);
$reference_token = $responseData['data']['reference_token'];
}
?>
<script type="text/javascript" src="https://www.foloosi.com/js/foloosipay.v2.js"></script>
<script type="text/javascript">
var reference_token = "<?= $reference_token; ?>";
var options = {
"reference_token" : reference_token,
"merchant_key" : "YOUR_MERCHANT_KEY",
"redirect" : true
}
var fp1 = new Foloosipay(options);
fp1.open();
</script>
</body>
</html>
Note :
Apple Pay and Samsung pay options are available only for Hosting Payment Method.
Site must be https with proper SSL certificate.
Support
Visit https://www.foloosi.com for support requests or email to [email protected].
Developed by
Foloosi Technologies Pvt Ltd.
License
Copyrights (c) 2024 Foloosi
Last updated