Get started

The EpinPay API provides payment gateway to sell your products or your services via online.

To use this API, you need an API key and API Passwords. Please contact us at info@epinsultan.com to get your own API key and API passwords.

HASH Calculation

The EpinPay API using HMAC-SHA256 standard for all operation.

You need generate hmac hash required string with API key and API Passwords and convert it base64 before Post to API endpoint.

GET TOKEN


# Here is a php example
$epinpay_api_key = 'XXXXXXXXXX';//your api key on EpinPay API
$epinpay_api_password = 'XXXXXXXXXX';//your api password on EpinPay API
$epinpay_merchant_id = 135711;//your site ID on EpinPay API
$user_ip = 'XXX.XXX.XXX.XX';//user current ip
$user_mail = 'userp@mail.com';//user mail adress
$user_id = 123456;//user unique id
$user_name = 'myusername';//user name in your site

$hash = base64_encode(hash_hmac('sha256', $epinpay_merchant_id.$user_mail.$user_ip.$user_id.$user_name.$epinpay_api_key, $epinpay_api_password, true));

$post_vals = array(
  'merchant_id' => $epinpay_merchant_id,
  'apikey' => $epinpay_api_key,
  'user_ip' => $user_ip,
  'user_mail' => $user_mail,
  'user_id' => $user_id,
  'user_name' => $user_name,
  'hash' => $hash
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $epinpay_api_end_point);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1) ;
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$result = curl_exec($ch);  	
$curl_error = curl_errno($ch);
curl_close($ch);

$result = json_decode($result,1);
if($result['status'] == 'success' && $result['url']){//response success
  header("Location: ".$result['url']);
}else{
  echo 'Error!! '.$result['hata']; 
}  


#Response Success Example:
{"status":"success","url":"http:\/\/www.epinsultan.com\/epinpay\/api\/index.php?t=XXXXXXXXXXXXXXXXXXXXX"}

#Response Error Example:
{"status":"failed","hata":"Authorized IP address required"}

API Endpoint:

https://www.epinsultan.com/epinpay/api/token.php

Request Method:

POST

Response Type:

Json Array

QUERY PARAMETERS

Field Type Description Required
apikey String Your EpinPay API Key required
merchant_id Integer Your Site İd required
user_id String Unique identifier of your customer. required
user_name String Registered user name of your customer. required
user_mail String Registered mail adress of your customer. required
user_ip String Current IP Adress of your customer while start transaction. required
hash String Generated hmac hash with described string. required

1 - Calculate hash with required parameters.
2 - POST all required data to API endpoint.
3 - if response success, redirect user to url (in response json).
Check example

INSTANT PAYMENT NOTIFICATION (IPN)


# Here is a php example
# this only simple example. you must need sanitize post data and check required data before use.

$epinpay_api_key = 'XXXXXXXXXX';//your api key on EpinPay API
$epinpay_api_password = 'XXXXXXXXXX';//your api password on EpinPay API
$epinpay_merchant_id = 135711;//your site ID on EpinPay API

$order_id = $_POST['order_id'];
$merchant_id = $_POST['merchant_id'];
$user_id = $_POST['user_id'];
$user_name = $_POST['user_name'];
$user_mail = $_POST['user_mail'];
$payment_type = $_POST['payment_type'];
$amount = $_POST['amount'];
$charge_amount = $_POST['charge_amount'];
$net_amount = $_POST['net_amount'];
$status = $_POST['status'];
$hash = $_POST['hash'];

$hash_kontrol = base64_encode(hash_hmac('sha256',$merchant_id.$order_id.$user_id.$user_name.$user_mail.$payment_type.$amount.$charge_amount.$net_amount.$status.$epinpay_api_key, $epinpay_api_password, true));
if($hash != $hash_kontrol) die('Hash failure');//hash not equal
#otherwise you can finish order.

Notification Url:

Described from EpinPay Api user panel

Request Method:

POST

Response Type:

You must response only OK.

EpinPay API wait for OK. if your page don't response or response other type/text etc. it's mean not response.

After 10 failure response, API stop send request.

POST PARAMETERS

Field Type Description Required
merchant_id Integer Your Site İd required
order_id integer Transaction's Unique order id on EpinPay API required
user_id integer Sending user id data in get token step required
user_name String Sending user name data in get token step required
user_mail String Sending user mail data in get token step required
payment_type String Payment type in transaction required
amount Float Payment amount in transaction required
charge_amount Float added amount in your user account required
net_amount Float Total amount in your EpinPay account after commissions required
status String Transaction status (success|failed|pending) required
hash String Generated hmac hash with described string. required

payment_type İnformation

The payment method used for the transaction. This may change later depending on the country or merchant specifications. For example....

name Description
kk Credit Card
eft Bank Transfer / EFT
mb Mobile Payment
bit Crypto
papara Papara
stripe Stripe
tazapay Tazapay
payop Payop

1 - Check all required info from POST request.
2 - Calculate hash with required parameters.
3 - if hash validated, you can go complete order.
Check example

Errors



#Response Error Example:
{"status":"failed","hata":"Authorized IP address required"}

The EpinPay API return all errors with "hata" field in response json data:

API INFO

Version 1.0.