Comment on page
Sample integrations
Just paste the code below inside the body tag and enter your valid data to start using Popup Payment Method
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>Payment</title>
5
<meta charset="utf-8"/>
6
</head>
7
<body>
8
<?php
9
$curl = curl_init();
10
curl_setopt_array($curl, array(
11
CURLOPT_URL => "https://api.foloosi.com/aggregatorapi/web/initialize-setup",
12
CURLOPT_RETURNTRANSFER => true,
13
CURLOPT_ENCODING => "",
14
CURLOPT_MAXREDIRS => 10,
15
CURLOPT_TIMEOUT => 30,
16
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
17
CURLOPT_CUSTOMREQUEST => "POST",
18
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",
19
CURLOPT_HTTPHEADER => array(
20
'content-type: application/x-www-form-urlencoded',
21
'merchant_key: YOUR_MERCHANT_KEY'
22
),
23
));
24
$response = curl_exec($curl);
25
$err = curl_error($curl);
26
curl_close($curl);
27
if ($err) {
28
echo "cURL Error #:" . $err;
29
} else {
30
$responseData = json_decode($response,true);
31
$reference_token = $responseData['data']['reference_token'];
32
}
33
?>
34
<script type="text/javascript" src="https://www.foloosi.com/js/foloosipay.v2.js"></script>
35
<script type="text/javascript">
36
var reference_token = "<?= $reference_token; ?>";
37
var options = {
38
"reference_token" : reference_token,
39
"merchant_key" : "YOUR_MERCHANT_KEY"
40
}
41
var fp1 = new Foloosipay(options);
42
fp1.open();
43
foloosiHandler(response, function (e) {
44
if(e.data.status == 'success'){
45
console.log(e.data)
46
}
47
if(e.data.status == 'error'){
48
console.log(e.data)
49
}
50
if(e.data.status == 'closed'){
51
console.log(e.data)
52
}
53
});
54
</script>
55
</body>
56
</html>
Just paste the code below inside the body tag and enter your valid data to start using Redirect Payment Method
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>Payment</title>
5
<meta charset="utf-8"/>
6
</head>
7
<body>
8
<?php
9
$site_return_url = urlencode("YOUR_REDIRECTION_SITE_URL")
10
$curl = curl_init();
11
curl_setopt_array($curl, array(
12
CURLOPT_URL => "https://api.foloosi.com/aggregatorapi/web/initialize-setup",
13
CURLOPT_RETURNTRANSFER => true,
14
CURLOPT_ENCODING => "",
15
CURLOPT_MAXREDIRS => 10,
16
CURLOPT_TIMEOUT => 30,
17
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
18
CURLOPT_CUSTOMREQUEST => "POST",
19
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,
20
CURLOPT_HTTPHEADER => array(
21
'content-type: application/x-www-form-urlencoded',
22
'merchant_key: YOUR_MERCHANT_KEY'
23
),
24
));
25
$response = curl_exec($curl);
26
$err = curl_error($curl);
27
curl_close($curl);
28
if ($err) {
29
echo "cURL Error #:" . $err;
30
} else {
31
$responseData = json_decode($response,true);
32
$reference_token = $responseData['data']['reference_token'];
33
}
34
?>
35
<script type="text/javascript" src="https://www.foloosi.com/js/foloosipay.v2.js"></script>
36
<script type="text/javascript">
37
var reference_token = "<?= $reference_token; ?>";
38
var options = {
39
"reference_token" : reference_token,
40
"merchant_key" : "YOUR_MERCHANT_KEY",
41
"redirect" : true
42
}
43
var fp1 = new Foloosipay(options);
44
fp1.open();
45
46
</script>
47
</body>
48
</html>
Note :
Apple Pay and Samsung pay options are available only for Hosting Payment Method.
Site must be https with proper SSL certificate.
Foloosi Technologies Pvt Ltd.
Copyrights (c) 2022 Foloosi
Last modified 1yr ago