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. Javascript Integration

Sample Integrations

PreviousAdditional SetupNextPHP 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

<script type="text/javascript" src="https://www.foloosi.com/js/foloosipay.v2.js"></script>
<script>
        // post data for create order id
        data = {
          transaction_amount : YOUR_TRANSACTION_AMOUNT,
          currency : YOUR_CURRENCY_CODE,
          customer_name : OPTIONAL ,/*note : auto render in payment popup*/
          customer_email : OPTIONAL, /*note : auto render in payment popup*/
          customer_mobile : OPTIONAL ,/*note : auto render in payment popup*/
          customer_address : OPTIONAL ,/*note : minimize form fields in card detail page*/
          customer_city : OPTIONAL /*note : minimize form fields in card detail page*/
        }
	let fetchRes = fetch(
            "https://api.foloosi.com/aggregatorapi/web/initialize-setup",{
            method: 'POST',
            headers: {
              'Content-Type': 'application/json',
              'merchant_key': 'YOUR_MERCHANT_KEY' /** get the merchant key from foloosi panel*/
            },
            body: JSON.stringify(data)
         });

	fetchRes.then(res =>
	  res.json()).then(d => {
  	    console.log(d.data);
            var options = {
                "reference_token" : d.data.reference_token, //which is get from step2
                "merchant_key" : "YOUR_MERCHANT_KEY",/** get the merchant key from foloosi panel*/
            }
            var fp1 = new Foloosipay(options);
            fp1.open();
        })
        foloosiHandler(response, function (e) {
          if(e.data.status == 'success'){
            //responde success code
            //console.log(e.data.status);
            //console.log(e.data.data.transaction_no);
          }
          if(e.data.status == 'error'){
            //responde success code
            //console.log(e.data.status);
            //console.log(e.data.data.payment_status);
          }
          if(e.data.status == 'closed'){
            //Payment Popup Closed
            //console.log(e.data);
          }
        });
</script>

Just paste the code below inside the body tag and enter your valid data to start using Redirect Payment Method

<script type="text/javascript" src="https://www.foloosi.com/js/foloosipay.v2.js"></script>
<script>
    //post data for create order id
    data = {
      transaction_amount : YOUR_TRANSACTION_AMOUNT,
      currency : YOUR_CURRENCY_CODE,
      customer_name : OPTIONAL ,/*note : auto render in payment popup*/
      customer_email : OPTIONAL ,/*note : auto render in payment popup*/
      customer_mobile : OPTIONAL ,/*note : auto render in payment popup*/
      customer_address : OPTIONAL ,/*note : minimize form fields in card detail page*/
      customer_city : OPTIONAL ,/*note : minimize form fields in card detail page*/
      site_return_url: YOUR_REDIRECTION_URL /*note : you need to pass your redirect url */
      optional1: ADDITIONAL FIELD/*note : you can pass additional fields in it.*/
      optional2: ADDITIONAL FIELD/*note : you can pass additional fields in it.*/
    }
    let fetchRes = fetch(
        "https://api.foloosi.com/aggregatorapi/web/initialize-setup",{
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'merchant_key': 'YOUR_MERCHANT_KEY' /** get the merchant key from foloosi panel*/
        },
        body: JSON.stringify(data)
      });
		
      fetchRes.then(res =>
            res.json()).then(d => {
		console.log(d.data);
                  var options = {
                      "reference_token" : d.data.reference_token, //which is get from step2
                      "merchant_key" : "YOUR_MERCHANT_KEY",/** get the merchant key from foloosi panel*/
                      "redirect" : true
                  }
          var fp1 = new Foloosipay(options);
          fp1.open();
        })
</script>

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