Get Started
Invoice
Invoice Flow
Balance
Rate
Exchange
Transfer

Getting Started

First, you will need an api_key and secret_key. These API keys are located in your account. You require it when you want to use the API key to interact with the service.
Also, you'll need it to restrict the API access to your secure IP addresses. If you do not know your server's IP address, you can run this command on your server.

curl 'https://api.zipay.io/api/'


API Key Setup

First, get an API key and secret key from the panel and choose the method's that you need.
Never share your API key/secret key with ANYONE.
API key and secret key will be something like this:

API Key: 4f3c12fa0a1d1ac8b026298b980f16b2
SECRET KEY: f7d36fd7f60ab0bac12051e0c3240508585dba741e126669bfbc06e002b9df6ac4e457b6
For each request you must send two params in header, one of this is api_key and another is api_sign you must create api_sign by hmac_hash sha256 on params that you will be sent!
for example: you want to send par1=value1 and par2=value2 to API
at the first you must create api_sign string by secret_key .

PHP:

$post_encode = http_build_query([
             'par1'=>'value1',
             'par2'=>'value2'
        ]);
$s = hash_hmac('sha256', $post_encode, 'f7d36fd7f60ab0bac12051e0c3240508585dba741e126669bfbc06e002b9df6ac4e457b6', true);
echo base64_encode($s); //g1seBV5gkv7n4EjIdzMjl+ntJ256kvIe2kulu2SfTPk=
    


Node.js:
var crypto = require('crypto');
var hash = crypto.createHmac('SHA256', "f7d36fd7f60ab0bac12051e0c3240508585dba741e126669bfbc06e002b9df6ac4e457b6").update("par1=value1&par2=value2").digest('base64');
    



Python:
import hashlib
import hmac
import base64

dataToBeSigned= bytes("par1=value1&par2=value2").encode('utf-8')
portalKey = bytes("f7d36fd7f60ab0bac12051e0c3240508585dba741e126669bfbc06e002b9df6ac4e457b6").encode('utf-8')

signature = base64.b64encode(hmac.new(portalKey, dataToBeSigned, digestmod=hashlib.sha256).digest())
    


Ruby:
require 'openssl'
require "base64"

hash  = OpenSSL::HMAC.digest('sha256', "f7d36fd7f60ab0bac12051e0c3240508585dba741e126669bfbc06e002b9df6ac4e457b6", "par1=value1&par2=value2")
token = Base64.encode64(hash)
token.delete("\n")
    


Java:
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;

public class ApiSecurityExample {
  public static void main(String[] args) {
    String portalKey = "f7d36fd7f60ab0bac12051e0c3240508585dba741e126669bfbc06e002b9df6ac4e457b6";
    String dataToBeSigned= "par1=value1&par2=value2";

    Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
    SecretKeySpec secret_key = new SecretKeySpec(portalKey.getBytes(), "HmacSHA256");
    sha256_HMAC.init(secret_key);

    String hash = Base64.encodeBase64String(sha256_HMAC.doFinal(dataToBeSigned.getBytes()));
  }
}
    


Send request

At this level, you must have the api_key and api_sign that you want to send par1=value1&par2=value2.
Send params via post method to the API and set api_key and api_sign in the header .

CURL

curl -H "api_key:4f3c12fa0a1d1ac8b026298b980f16b2" -H "api_sign:g1seBV5gkv7n4EjIdzMjl+ntJ256kvIe2kulu2SfTPk=" --data "par1=value1&par2=value2" https://api.zipay.io/api/example

PHP
$_headers = [
	'api_key:4f3c12fa0a1d1ac8b026298b980f16b2',
	'api_sign:g1seBV5gkv7n4EjIdzMjl+ntJ256kvIe2kulu2SfTPk=',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers);
curl_setopt($ch, CURLOPT_URL, 'https://api.zipay.io/api/example');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'par1=value1&par2=value2');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
        


Response

All responses are in JSON format.

Success Sample:

{
	...
	"success": true,
	"status": 200
}
    
The "success" will be true if everything is fine and the "status" is the same as the HTTP status code.

Failed Sample:
{
	"errors": {
		"auth": "INVALID_API_SIGN"
	},
	"success": false,
	"status": 403
}
    


Random

POST https://api.zipay.io/api/random

Name Type Mandatory Description
min integer yes set min of range
max integer yes set max of range


Response:
{
	"trackid": "08B171-F259CB-3E300C-9ABE83",
	"result": 15,
	"success": true,
	"status": 200
}