Z-Pay Public API

Successful response

{ //HTTP Status code: 200
    data: {
        operationId: "067a5856-94e9-47d3-b869-5c422ff921ce"
    },
    message: "ok" // optional
}

Unsuccessful response

{ // HTTP Status code: 500
    error: "InvalidCheque",
    message: "Invalid cheque number" // optional
}

Unsuccessful request could be checked by either HTTP status code 500 or presence of the field "error" in response

Endpoints

All responses listed below are inside {data: {}}

i.e if response specified below as {balance: 0.24124} the actual response will be {data: {balance: 0.24124}}

POST /api/v2/cheque/New
{ // Response
    cheque: {
        public: "859136692306",
        private: "31700800622349660236713",
        balance: 0.0421,
        currency: "btc",
        expires: "2019-01-01T12:00:00.000Z",
    },
    session: "tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4="
}
// Possible Errors  
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Auth
{ // Request
    public: "859136692306",
    private: "31700800622349660236713",
    password: "aJJFUljT8cfI" // Optional
}
{ // Response
    cheque: {
        public: "859136692306",
        private: "31700800622349660236713",
        balance: 0.0421,
        currency: "btc",
        expires: "2019-01-01T12:00:00.000Z",
    },
    session: "tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4="
}
// Possible Errors
{ error: "InvalidPassword" }
{ error: "InvalidCheque" }
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Logout
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{} // Request 
{} // Response
POST /api/v2/cheque/Reissue

This request will invalidate all sessions except the one from which this endpoint was called.

// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Response
    cheque: {
        public: "859136692306",
        private: "31700800622349660236713",
        balance: 0.0421,
        currency: "btc",
        expires: "2019-01-01T12:00:00.000Z"
    }
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Protect
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    password: "e51c5cc49178d8dc51867671b829ab9d4cf2238c841443831acd4c3a0872c069" // SHA256( plaintextPassword )
}
{} // Response
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Unprotect
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{} // Request
{} // Response
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Withdraw
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    currency: "btc",
    amount: 0.00124,
    model: "Address",
    data: {
        address: "2g9Wm1FJNdiNtkB15ocBsAt6XFP8uxo"
    }
}
{ // Response
    operationId: "067a5856-94e9-47d3-b869-5c422ff921ce"
}
// Possible Errors
{ error: "InvalidAmount" }
{ error: "InvalidAddress" }  
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Topup
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    currency: "btc",
    model: "Address",
    data: {}
}
{ // Response
    address: "2aEGopqS3edMUgh69wqeNX2Hmqmn1"
}
// Possible Errors
{ error: "InvalidAmount" }
{ error: "InvalidAddress" }  
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Convert
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    currency: "btc"
}
{ // Response
    cheque: {
        public: "504346729990",
        private: "38571881447527184025658",
        balance: 5.012521,
        currency: "btc",
        expires: "2019-01-01T12:00:00.000Z"
    }
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Split
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    splits: {
        "213418373393": { // Public cheque number
            amount: 0.0125,
            currency: "btc"
        },
        "376475262102": {
            amount: 2.2512,
            currency: "eth"
        },
        "new": [
            {
                amount: 0.2152,
                currency: "btc"
            },
            {
                amount: 129.12,
                currency: "usd"
            }
        ]
    }
   
}
{ // Response
    splits: {
        "213418373393": {},
        "376475262102": {},
        "007701498408": { // New cheque
            session: "b58U9m8G3hI5R1crHk2nb7JyCPwolS7K7R2iHbHLTyY="
        },
        "946944015027": {
            session: "AVL21k3uycfyVC5ZwMiR4t0lmpbMK7jJ1wQoMoalEKU="
        }
    }
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Merge
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    sessions: [
        "+OR6BjaCw7Fu6+F9UZRsdmmaVuX2e0OUEw/Sq1tYVQ4=",
        "gCojawU2siC6OHMyaMU5ou37J/uKVgQZB9zaoPvORAU=",
        "rUkx0UTzxmnWw1Pelnf2ZLs/b5SDXt9hJ+moGDKLnZc="
    ]
}
{ // Response
    cheque: {
        public: "859136692306",
        private: "31700800622349660236713",
        balance: 0.0421,
        currency: "btc",
        expires: "2019-01-01T12:00:00.000Z",
    },
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Status
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Response
    cheque: {
        public: "859136692306",
        private: "31700800622349660236713",
        balance: 0.0421,
        currency: "btc",
        expires: "2019-01-01T12:00:00.000Z",
    },
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/History
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
// Request:
{
    offset: 0, // Optional
    count: 10, // Optional
}
{ // Response
    history: [
        {
            type: "transaction",
            status: "complete",
            amount: 0,
            currency: "usd",
            origin: "ChequeNew",
            updated: "2019-01-01T10:00:00.000Z",
            created: "2019-01-01T10:00:00.000Z"
        },
        {
            type: "Exchange",
            currency: "eth",
            origin: "ChequeConvert",
            updated: "2019-01-01T12:00:00.000Z",
            created: "2019-01-01T12:00:00.000Z"
        },
    ]
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Wallets
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    currency: "btc"
} 
{ // Response
    wallets: [
        {
            address: "2aEGopqS3edMUgh69wqeNX2Hmqmn1",
            currency: "btc",
            name: "My New Wallet",
            updated: "2019-01-01T12:00:00.000Z",
            created: "2019-01-01T12:00:00.000Z"
        }
    ]
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/WalletsAdd
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    name: "My new wallet", // Optional
    currency: "btc",
    address: "31Cr5eoSDd5o3LfdE0uvNhEra4bdZcTGqN",
}
{} // Response
// Possible Errors
{ error: "InvalidAddress" }
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/WalletsEdit
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    name: "My new wallet", // Optional
    newAddress: "2g9Wm1FJNdiNtkB15ocBsAt6XFP8uxo", // Optional
    currency: "btc",
    address: "31Cr5eoSDd5o3LfdE0uvNhEra4bdZcTGqN",
}
{} // Response
// Possible Errors
{ error: "InvalidAddress" }
{ error: "InvalidSession" }
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/WalletsDelete
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    currency: "btc",
    address: "31Cr5eoSDd5o3LfdE0uvNhEra4bdZcTGqN",
}
{} // Response
// Possible Errors
{ error: "InvalidAddress" }
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/Currencies
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{} // Request
{ // Response
    rub: {
        "name": "RUB",
        "nameFull": "Russian Rouble",
        "symbol": "₽",
        "round": 2,
        "withdraw": false,
        "topup": false
    },
    btc: {
        "name": "BTC",
        "nameFull": "Bitcoin",
        "symbol": "₿",
        "round": 7,
        "withdraw": {
            "model": "Address",
            "fee": 0.00046307
        },
        "topup": {
            "model": "Address",
            "fee": 0
        },
        "regexAddress": "/^[123][a-km-zA-HJ-NP-Z0-9]{26,34}$/m"
    },
    eth: {
        "name": "ETH",
        "nameFull": "Ethereum",
        "symbol": "Ξ",
        "round": 6,
        "withdraw": false,
        "topup": false,
        "regexAddress": "/^0x[a-fA-F0-9]{40}$/m"
    }
}
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/WebhookSet
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{ // Request
    webhook: "https://game-store.com/api/payment-webhook",
}
{} // Response
// Possible Errors
{ error: "InvalidWebhook" }
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/cheque/WebhookDelete
// Headers:
X-Auth-Token: tciG+pxPC5BK0ba4nLXBIkNvUWur6PV9fyuvTcdLJw4=
{} // Request
{} // Response
// Possible Errors
{ error: "InvalidSession" }    
{ error: "InvalidRequest" }
{ error: "ServerError" }
POST /api/v2/Rates
{ // Response
    rates: {
        "usd>eur":{
            from: "usd",
            to: "eur",
            rate: 0.8842086554972975,
            updated:"2019-01-01T10:00:00.000Z"
        },
        "btc>eth":{
            from:"btc",
            to:"eth",
            rate:45.328829910285364,
            updated:"2019-01-01T10:00:00.000Z"
        },
        "rub>eth":{
            from:"rub",
            to:"eth",
            rate:0.0000698167943611293,
            updated:"2019-01-01T10:00:00.000Z"
        }
    }
}
// Possible Errors   
{ error: "InvalidRequest" }
{ error: "ServerError" }

Webhooks

When you set cheque's webhook via /api/v2/cheque/WebhookSet you will receive requests on specified url whenever there is financial operation made for this cheque, this includes:

  • Topup
{
    type: "topup",
    data: {
        operationId: "c0ad93d1-c984-45d2-b673-7598b441e8d1",
        amount: 1.2401,
        currency: "eth"
    }
}
  • Withdraw
{
    type: "withdraw",
    data: {
        operationId: "e8e92674-eb75-488a-9e11-e704a58b6b85",
        amount: 0.00124,
        currency: "btc"
    }
}