curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.foloosi.com/aggregatorapi/web/initialize-setup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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",
CURLOPT_HTTPHEADER => array(
'content-type: application/x-www-form-urlencoded',
'merchant_key: YOUR_MERCHANT_KEY'
$response = curl_exec($curl);
$err = curl_error($curl);
echo "cURL Error #:" . $err;
$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; ?>";
"reference_token" : reference_token,
"merchant_key" : "YOUR_MERCHANT_KEY",
var fp1 = new Foloosipay(options);
foloosiHandler(response, function (e) {
if(e.data.status == 'success'){
if(e.data.status == 'error'){
if(e.data.status == 'closed'){