> For the complete documentation index, see [llms.txt](https://docs.foloosi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.foloosi.com/client-side-integrations/javascript-integration/payment-response-handling.md).

# Payment Response Handling

Let's see how to handle payment response !

Foloosi payments has two types of responses,

* *Foloosi handler* for Popup Payment method.
* *Request post object* for Hosting Payment method.

#### a. Foloosi handler

```
/* Foloosi handler for payment response handling
 * Add the below code inside the script tag to handle payment response
*/
    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);
      }
    };

```

#### b. Redirects to site\_return\_url with post data&#x20;

```
//sample post response
{
    "status": "success",
    "data": {
        "amount": 12.00,
        "currency": "AED",
        "transaction_no": "FLSXXXXXXXXXXABC",
        "optional1": "additional_field",
        "optional2": "additional_field",
        "optional3": "additional_field",
    }
}
```

### &#x20;Support

Visit <https://www.foloosi.com> for support requests or email to <tech@foloosi.com>.

## Developed by

Foloosi Technologies Pvt Ltd.

## License

Copyrights (c) 2025 Foloosi
