Foloosi
  • INTRODUCTION
  • FEATURES
  • Get Started
    • Create Api Credentials
    • Checkout Page Customization
  • Payment Methods
    • Popup Payment Method
    • Hosting Payment Method
    • Saved Card Payment Method
  • CLIENT SIDE INTEGRATIONS
    • Javascript Integration
      • Create Payment Token
      • Payment Widget Initialization
      • Payment Response Handling
      • Additional Setup
      • Sample Integrations
    • PHP Integration
      • Create Payment Token
      • Payment Widget Initialization
      • Payment Response Handling
      • Additional Setup
      • Sample integrations
    • React JS Integration
      • Create payment Token
      • Payment Widget Initialization
      • Payment Response Handling
      • Additional Setup
    • Angular JS Integration
      • Create payment Token
      • Payment Widget Initialization
      • Payment Response Handling
      • Additional Setup
  • ECOMMERCE INTEGRATIONS
    • WooCommerce
    • CS Cart
    • Ecwid
    • Opencart
    • Magento
    • Prestashop
  • MOBILE SDK INTEGRATIONS
    • Android SDK
      • Initiate Payment
      • Payment Response Handling
    • iOS SDK
      • Initiate Payment
      • Payment Response Handling
    • React Native SDK
      • Make Payment
    • Flutter SDK
      • Installation
      • Make Payment
      • Sample Dart Program
  • SUBSCRIPTIONS
    • Foloosi Subscription for WooCommerce
    • Api Subscription
      • Sample Integration
    • Subscription
  • WEBHOOKS
  • PARTNER PAYOUT
  • CARD DETAILS
    • Test Cards
Powered by GitBook
On this page
  • Sample Integrations
  • Popup payment method sample code
  • Hosting payment method sample code
  • Support
  • Developed by
  • License

Was this helpful?

  1. CLIENT SIDE INTEGRATIONS
  2. PHP Integration

Sample integrations

PreviousAdditional SetupNextReact JS Integration

Last updated 1 month ago

Was this helpful?

Sample Integrations

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&currency=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>

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&currency=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

Developed by

Foloosi Technologies Pvt Ltd.

License

Copyrights (c) 2025 Foloosi

method sample code

Visit for support requests or email to [email protected].

Popup payment
Hosting payment
https://www.foloosi.com