FCFPay Crypto integration

This article will help you with the Crypto integration platform using CURL requests in the FCFPay platform.

$payload = [
    'domain' => 'your domain',
    'order_id' => uniqid(),
    'user_id' => uniqid(),
    'amount' => 10,
    'currency_name' => "USD",
    'order_date' => date("Y-m-d"),
    'redirect_url' => "https://yourdomain/reqirect.php" // In redirect url you can set as per your requirement

$headers = array(
    'Content-Type: application/json',
    'Authorization: Bearer Key' // In key use your key value of your account

$url = "https://merchant.fcfpay.com/api/v2/create-order";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload, JSON_UNESCAPED_SLASHES));
curl_setopt($curl, CURLOPT_TIMEOUT, 90);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$arrResponse = json_decode($response);

In the response status will be true then You should redirect your customers to that checkout URL.and you will also get the transaction id as per your structure you have to set in the database field or in session. this id will be used to get the transactions details API.


In the redirect file, you have to call check-order API to get the status API. For status API you got the transaction id in create order API so we will find the status using that order id.

The below code is for checking the order.

$headers = array(
    'Content-Type: application/json',
    'Authorization: Bearer Key' // In key use your key value of your account
$request_url = https://merchant.fcfpay.com/api/v2/check-order';
$orderid = {order_id};
$data = ["order_id" => $orderid];
$curlGet = curl_init();
curl_setopt($curlGet, CURLOPT_URL, $request_url);
curl_setopt($curlGet, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlGet, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curlGet, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curlGet, CURLOPT_POST, 1);
curl_setopt($curlGet, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($curlGet, CURLOPT_TIMEOUT, 90);
curl_setopt($curlGet, CURLOPT_RETURNTRANSFER, 1);
$responseGet = curl_exec($curlGet);
$arrResponseGet = json_decode($responseGet);

If your transaction is successful you will get the status deposited.

I hope it will help you.