Base API URL
https://api.minitepay.com
Authenticate Request CURL Parameters
<?php
CURLOPT_HTTPHEADER => array(
// As per the request environment use the relevant keys both for live and test (sandbox)
"x-public-key: eLAOanEqHa66V4J9wJnJtGt.........1uTrmyFcLYO6JGVyhwEE6ukIZ9J",
"x-secret-key: 00003CtaDpImep6U4Q4zs8L.........Bf9Pq5F3pPlb92IRRpQ9SL9S3yg"
)
?>
Generating Signature
<?php
$parameters = array(
"company_name" => "XYZ",
"company_code" => "xYz",
["other" => relevant value]
);
// Sort by field name
ksort($parameters);
// Create the URL encoded signature string
$buildQuery = http_build_query($parameters, "", "&");
// Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A)
$buildQuery = str_replace(array("%0D%0A", "%0A%0D", "%0D"), "%0A", $buildQuery);
// Hash the signature string and the key together
hash("SHA512", $buildQuery);
?>
All Rates Listing
<?php
$parameters = array(
"company_name" => "XYZ",
"company_code" => "xYz",
"company_website" => "https://www.xyz.com",
"transaction_code" => uniqid(),
"environment" => "live", // For test (sandbox) we need to set this to 'sandbox'
"api_name" => "To get rates of all crypto currencies",
"currency_rate" => "all"
);
// Sort by field name
ksort($parameters);
// Create the URL encoded signature string
$buildQuery = http_build_query($parameters, "", "&");
// Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A)
$buildQuery = str_replace(array("%0D%0A", "%0A%0D", "%0D"), "%0A", $buildQuery);
// Hash the signature string and the key together
$parameters["signature"] = hash("SHA512", $buildQuery);
$url = "https://api.minitepay.com/api/v1/rates/all";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($parameters),
CURLOPT_HTTPHEADER => array(
// As per the request environment use the relevant keys both for live and test (sandbox)
"x-public-key: eLAOanEqHa66V4J9wJnJtGt.........1uTrmyFcLYO6JGVyhwEE6ukIZ9J",
"x-secret-key: 00003CtaDpImep6U4Q4zs8L.........Bf9Pq5F3pPlb92IRRpQ9SL9S3yg"
)
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
return $response;
?>
Single Crypto Currency Rate
<?php
$parameters = array(
"company_name" => "XYZ",
"company_code" => "xYz",
"company_website" => "https://www.xyz.com",
"transaction_code" => uniqid(),
"environment" => "live", // For test (sandbox) we need to set this to 'sandbox'
"api_name" => "To get rate of single crypto currency",
"currency_rate" => "BTC"
);
// Sort by field name
ksort($parameters);
// Create the URL encoded signature string
$buildQuery = http_build_query($parameters, "", "&");
// Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A)
$buildQuery = str_replace(array("%0D%0A", "%0A%0D", "%0D"), "%0A", $buildQuery);
// Hash the signature string and the key together
$parameters["signature"] = hash("SHA512", $buildQuery);
$url = "https://api.minitepay.com/api/v1/rates/BTC";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($parameters),
CURLOPT_HTTPHEADER => array(
// As per the request environment use the relevant keys both for live and test (sandbox)
"x-public-key: eLAOanEqHa66V4J9wJnJtGt.........1uTrmyFcLYO6JGVyhwEE6ukIZ9J",
"x-secret-key: 00003CtaDpImep6U4Q4zs8L.........Bf9Pq5F3pPlb92IRRpQ9SL9S3yg"
)
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
return $response;
?>
Pay with Minitepay (HTML FORM)
<?php
$company_code = "xYz";
$request_type = "form";
$parameters = array(
"company_name" => "XYZ",
"company_code" => $company_code,
"secret_key_last_8_digit" => "xxxxxxxx"
);
// Sort by field name
ksort($parameters);
// Create the URL encoded signature string
$buildQuery = http_build_query($parameters, "", "&");
// Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A)
$buildQuery = str_replace(array("%0D%0A", "%0A%0D", "%0D"), "%0A", $buildQuery);
// Hash the signature string and the key together
$signature = hash("SHA512", $buildQuery);
?>
// HTML form starts here
<form action="https://api.minitepay.com/processCheckout" method="post">
<input type="hidden" name="items[0][item_name]" value="[Item Name 1]" />
<input type="hidden" name="items[0][item_id]" value="[14]" />
<input type="hidden" name="items[0][item_price]" value="[255]" />
<input type="hidden" name="items[0][item_quantity]" value="[3]" />
// If you want to handle more than one item in an order
<input type="hidden" name="items[1][item_name]" value="[Item Name 2]" />
<input type="hidden" name="items[1][item_id]" value="[15]" />
<input type="hidden" name="items[1][item_price]" value="[499]" />
<input type="hidden" name="items[1][item_quantity]" value="[1]" />
<input type="hidden" name="signature" value="<?php echo $signature; ?>" />
<input type="hidden" name="company_code" value="<?php echo $company_code; ?>" />
<input type="hidden" name="payer_name" value="Customer's First Name" />
<input type="hidden" name="payer_email" value="[email protected]" />
<input type="hidden" name="payer_contact_no" value="+9234589498" />
<input type="hidden" name="environment" value="<?php echo $environment; ?>" />
<input type="hidden" name="request_type" value="<?php echo $request_type; ?>" />
<input type="hidden" name="orderId" value="49251" />
<input type="submit" name="submit" value="Pay With Minitepay" />
</form>
Pay with Minitepay (CURL)
<?php
$company_code = "xYz";
$environment = "live"; // For test (sandbox) we need to set this to 'sandbox'
$request_type = "curl";
$parameters = array(
"company_name" => "XYZ",
"company_code" => $company_code,
"secret_key_last_8_digit" => "xxxxxxxx" // As per the request environment use the relevant secret key last 8 digit both for live and test (sandbox)
);
// Sort by field name
ksort($parameters);
// Create the URL encoded signature string
$buildQuery = http_build_query($parameters, "", "&");
// Normalise all line endings (CRNL|NLCR|NL|CR) to just NL (%0A)
$buildQuery = str_replace(array("%0D%0A", "%0A%0D", "%0D"), "%0A", $buildQuery);
// Hash the signature string and the key together
$signature = hash("SHA512", $buildQuery);
// set post fields
$post = [
"items" => array(
array(
"item_name" => "Item Name 1",
"item_id" => 1484394227,
"item_price" => 255,
"item_quantity" => 3,
),
array(
"item_name" => "Item Name 2",
"item_id" => 1201163743,
"item_price" => 499,
"item_quantity" => 1,
)
),
"environment" => $environment,
"request_type" => $request_type,
"orderId" => "49251",
"signature" => $signature,
"company_code" => $company_code,
"payer_name" => "Customer's First Name",
"payer_email" => "[email protected]",
"payer_contact_no" => "+9234589498",
];
$url = "https://api.minitepay.com/processCheckout";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($post)
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close ($curl);
exit(header("location:" . $response));
?>