Sample Integration

Sample integration using javascript

Copy paste the code below in your webpage

<script type="text/javascript" src=""></script>
        // post data for create order id
        data = {
            transaction_amount : "YOUR INITIAL SUBSCRIPTION AMOUNT",
            currency : "YOUR CURRENCY",
            customer_name : "YOUR CUSTOMER NAME",
            customer_email : "YOUR CUSTOMER EMAIL",
            customer_mobile : "YOUR CUSTOMER MOBILE NO",
            customer_address: "YOUR CUSTOMER ADDRESS",
            customer_city: "YOUR CUSTOMER CITY",
            billing_country: "YOUR CUSTOMER COUNTRY",
            billing_state: "YOUR CUSTOMER STATE",
            billing_postal_code: "YOUR CUSTOMER POSTAL CODE",
            source: "api subscription",
            api_subscription :  "Yes", /**NOTE- THIS FIELD MUST BE IN YES */
            recurring_data : {
                plan : {
                    name : "Api new plan", /** YOUR PLAN NAME*/
                    billing_type : "day", /** value must be day/week/month/year */
                    billing_cycle : 1, /** it only applicable for week and month billing type.ex Every 1 weeks */
                    billing_currency : "AED", //it should be 3 digit code and other than AED you should enabled multi currency option from Foloosi
                    billing_amount : "SUBSCRIPTION AMOUNT",
                    setup_fee : "SETUP FEE", //which is subscription setup one time fee
                    total_count : 10, //number of deductions
                    description : "daily demo plan",
                    start_date : "dd-mm-yyyy" //which is optional param.if you given value should be in the format
                                              //Note : if you given date means .at the time of payment will be charged by transaction
                                              //amount as you given .subscription recurring will start on the given date and given billing amount
                customer : {
                    name : "CUSTOMER NAME",
                    email : "CUSTOMER EMAIL ID"',
                    mobile : "CUSTOMER MOBILE NO",
	let fetchRes = fetch(
            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 => {
            var options = {
                "reference_token" :, //which is get from step2
                "merchant_key" : "YOUR_MERCHANT_KEY",/** get the merchant key from foloosi panel*/
            var fp1 = new Foloosipay(options);
        foloosiHandler(response, function (e) {
          if( == 'success'){
            //responde success code
          if( == 'error'){
            //responde success code
          if( == 'closed'){
            //Payment Popup Closed

Last updated