Introduction

This guide provides the information required to integrate with our Minitepay Services and gives a very basic example of code for doing so. It is expected that you have some experience in serverside scripting with languages such as PHP.

Every call to a Minitepay API must include an API publishable key and secret key in request header. After your Minitepay account is verified from our system admin, we generate two pairs of API keys for your Minitepay user Account—a publishable client-side key and a secret server-side key—for both test mode (sandbox) and live mode. Use the steps on this page to start sending requests in test or live mode.

Disclaimer

This guide provides the integration documentation necessary for enabling services to process requests via our Gateway. Whilst every effort has been made to ensure these guides are accurate and complete, we expect Merchants undertaking any integration to test all their technical work fully and satisfy their own standards. The authors of this guide are not responsible or liable for any Merchant or Third-Party integration.

Base API URL

https://api.minitepay.com
By default, the Minitepay API Docs demonstrate using curl to interact with the API over HTTP.

Authentication

The Minitepay API uses API keys to authenticate requests. You can view and manage your API keys in the Minitepay Dashboard.

Manage your API keys to authenticate requests with Minitepay. Minitepay authenticates your API requests using your account’s API keys. If you don’t include your key when making an API request, or use an incorrect or outdated one, Minitepay returns a 401 - Unauthorized

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

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"
)
?>

Signature

For each request made to the minitepay must contain a valid processed signature to make sure that the request is generated and coming from the valid source. To generate a successfull signature following paramters should be part of this process:

Parameters


company_name*: Company Name that was provided to minitepay while registration of an account.
company_code*: Company Code generated on account registration and sent to you via email.
other: Any specific parameters related to the api requesting that time.

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);
?>

Errors

Minitepay uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, an authentication failed, etc.). Codes in the 5xx range indicate an error with Minitepay's servers (these are rare).

Some 4xx errors that could be handled programmatically (e.g., a transaction is declined) include an error code that briefly explains the error reported.

Rates

Minitepay provides simple & easy-to-integrate API for more than 9 crypto currencies. This API has several endpoints, where each of them serves a different purpose, use case.

Parameters


api_name*: You can put any statement that you like that gives the meaning to that parameter. like 'To get rates of crypto currencies'
currency_rate*: This will be used if someone wants rates for all currencies or for specific currency. By default the value is 'all' and if some one wants for specific than the value should be from one of these [BTC, BCH, ETH, LTC, NANO, DOGE, ADA, USDT, BNB]

List

With this api request all crypto currency rates will be listed in the response.

API URL: https://api.minitepay.com/api/v1/rates/all

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

With this api request all crypto currency rates will be listed in the response.

API URL: https://api.minitepay.com/api/v1/rates/BTC

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;
?>

Payments

Payments objects represent your customer's payment instructions. You can use them to collect payments with easy to follow steps.

Pay with Minitepay

This payment method allow two easy ways to accept payments from your customers. One is to use HTML Form and second one is using PHP CURL. You can pick one of them which you like most.

Parameters


orderId*: Should be the order reference against which this checkout is processed.
secret_key_last_8_digit*: This should be the last 8 digits of your default account secret key in the environment you want to make this request.
environment*: The environment parameter defines weather the request is for live or test (sandbox) mode. This is set to 'live' By default
items*:Items parameter is combination of child attributes, which in a combine contain a single product object. This can be a single object or in case of many should be in an array format.
Showing Child Attributes:
  item_name*: Name of the item which is purchased.
  item_id*: Unique number of the item
  item_price*: Single unit price of the item
  item_quantity*: Number of quantity purchased under this item

signature*: See the signature creation process at this link
company_code*: Company Code generated on account registration and sent to you via email.
payer_name*: Name of the Payer who will be billed for the order.
payer_email*: Email of the Payer who will be billed for the order.
payer_contact_no*: Phone Number of the Payer who will be billed for the order.
request_type*: curl or form.

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));
?>