API

Basic
Response Codes:
HTTP code Field "status" Description
200 - Ok
204 - No Content
302 - Redirect to back_url upon successful payment
400 2 Payment is unsuccessful
400 4 Application token does not exist or application is blocked
400 5 Input data is insufficient or invalid
400 6 Temporary token does not exist
400 7 Invoice has already been processed
400 8 No suitable payment methods
400 9 Credit limit exceeded
400 10 Fields payment_no and invoice_id are empty
400 11 Invoice does not exist
400 12 Invoice with such payment_no already exists
400 13 Invoice is expired
400 14 Your operation has been cancelled
400 15 Application does not exist
400 16 Payment method is not available
400 17 Invalid date format
400 18 Invoice amount is too large
400 19 Unsupported Content-Type in header
400 20 Invalid company_id
400 21 Invalid currency code
400 22 Invalid payment amount
400 23 Incorrect payment commission
400 24 Insufficient funds on balance
401 - Unauthorized
403 - Access is denied
Invoice Statuses:
Field "invoice_status" Value
0 New
1 Confirmed
2 Failed
3 Expired
Undefined Transactions Types:
Field "type" Value
0 New
1 Linked
4 Rejected
Service Availability Check
Request:
POST
https://my.terminall.net/api/v1/alivecheck
Example Request:
curl --request POST \
    --url https://my.terminall.net/api/v1/alivecheck \
    --header 'Content-Type: application/x-www-form-urlencoded'
Successfully Response:
200
{
    "alive": true
}
Getting a Temporary Token
Description:

Getting a temporary token, creating invoice.

Request:
POST
https://my.terminall.net/api/v1/pay/token
Request Body:
Field Required Rules Description
app_token true - App token
amount true - Amount
currency true - Currency code
payment_no true - External payment id
method false - Payment method
Example Request:
curl --request POST \
    --url https://my.terminall.net/api/v1/pay/token \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'app_token=BtAcy3JwNxPan6rfg3jdqCBie6mBPoykCiHXtMRkUxLWl1Yr7bE9HJTjkIjm' \
    --data-urlencode 'currency=USD' \
    --data-urlencode 'amount=12' \
    --data-urlencode 'payment_no=qeqee131131313'
Successfully Response:
200
{
    "token": "nzz1mqq1ZyiocaiGbVzQiPz9YEzu4npmd7HcYpzdXpCQVTeBBZ6Var15mQLm"
}
Failed response:
400
{
    "status": 4
}
Transactions List
Description:

...

Request:
POST
https://my.terminall.net/api/v1/pay/transactions
Request Body:
Field Required Rules Description
app_token true - App token
payment_no false - External payment id
invoice_id false - Invoice id
start_date false - Start date ('YYYY-mm-dd')
end_date false - End date ('YYYY-mm-dd')
limit false - Limit (default: 1000, -1: all)
offset false - Offset
countonly false - Getting only transactions count
Invoice Details:
Field Types Description
payment_no string External payment id
invoice_id string Invoice id
amount float Invoice Amount
amount_paid float Invoice amount paid
fee float Fee
currency string Invoice currency
crypto_amount float Invoice crypto amount
crypto_amount_paid float Invoice crypto amount paid
btc_amount_paid float Invoice crypto amount paid in BTC
crypto_currency string Crypto currency
rate float Crypto currency rate at the time of invoice creation
btc_rate float BTC against currency / cryptocurrency at the time of the invoice creation
address string Address
method string Invoice payment method
date_add string Date of invoice creation
state state Invoice state in payment system
include_fee integer Fee included in invoice amount
invoice_status integer Invoice status
transactions array Transactions array
Transaction Details:
Field Types Description
tx_id string Transaction id
amount float Transaction amount
currency string Transaction currency
crypto_amount float Transaction crypto amount
crypto_currency string Crypto currency
crypto_tx_id string Blockchain Transaction ID
date_add string Date of transaction creation
linked integer Parameter that determines whether a transaction with an invoice was linked manually by the administrator
Example Request:
curl --request POST \
    --url https://my.terminall.net/api/v1/pay/transactions \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'app_token=BtAcy3JwNxPan6rfg3jdqCBie6mBPoykCiHXtMRkUxLWl1Yr7bE9HJTjkIjm' \
    --data-urlencode 'limit=1'
Successfully Response:
200
{
    "count": 1,
    "invoices": [
        {
            "payment_no": "11",
            "invoice_id": "9d0e1ac00f7410639052",
            "amount": 0.08,
            "amount_paid": 0.08,
            "fee": 0,
            "currency": "USD",
            "crypto_amount": 0.00057935,
            "crypto_amount_paid": 0.00057935,
            "btc_amount_paid": 0.00002052,
            "crypto_currency": "ETH",
            "rate": 138.086771,
            "btc_rate": 0.035413,
            "address": "0xa9c44f5709736af0637b8d2ca1fd03be26d038b0",
            "method": "ethereum",
            "date_add": "2019-03-06 14:28:35",
            "state": "",
            "include_fee": 0,
            "invoice_status": 1,
            "transactions": [
                {
                    "tx_id": "9991fd3193f4dfb4c1fe",
                    "amount": 0.08,
                    "currency": "USD",
                    "crypto_amount": 0.00057935,
                    "crypto_currency": "ETH",
                    "crypto_tx_id": "0xa870ba3f9c3172daf1e02c7791e1589924022e7848c39f48a176e62426080ce9",
                    "linked": 0,
                    "date_add": "2019-03-06 15:11:27"
                }
            ]
        }
    ]
}
Failed response:
400
{
    "status": 4
}
Undefined Transactions List
Description:

...

Request:
POST
https://my.terminall.net/api/v1/pay/undefined/list
Request Body:
Field Required Rules Description
app_token true - App token
payment_no false - External payment id
type false - Transactions type (default: -1; 0: unlinked, 1: linked, 4: rejected, -1: all)
limit false - Limit (default: 25, -1: all)
offset false - Offset
countonly false - Getting only transactions count
Invoice Details:
Field Types Description
payment_no string External payment id
invoice_id string Invoice id
amount float Invoice Amount
amount_paid float Invoice amount paid
fee float Fee
currency string Invoice currency
crypto_amount float Invoice crypto amount
crypto_amount_paid float Invoice crypto amount paid
btc_amount_paid float Invoice crypto amount paid in BTC
crypto_currency string Crypto currency
rate float Crypto currency rate at the time of invoice creation
btc_rate float BTC against currency / cryptocurrency at the time of the invoice creation
address string Address
method string Invoice payment method
date_add string Date of invoice creation
state state Invoice state in payment system
include_fee integer Fee included in invoice amount
invoice_status integer Invoice status
transactions array Transactions array
Transaction Details:
Field Types Description
tx_id string Transaction id
amount float Transaction amount
currency string Transaction currency
crypto_amount float Transaction crypto amount
crypto_currency string Crypto currency
crypto_tx_id string Blockchain Transaction ID
date_add string Date of transaction creation
linked integer Parameter that determines whether a transaction with an invoice was linked manually by the administrator
type integer Transaction type
Example Request:
curl --request POST \
    --url https://my.terminall.net/api/v1/pay/undefined/list \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'app_token=rPJS3NAGLFoZGTHZAN6guRuKWQGwVTi9vhNIFp3XYzQZ4B0Pnl94kyPm7dJ0' \
    --data-urlencode 'limit=1' \
    --data-urlencode 'type=1'
Successfully Response:
200
{
    "count": 1,
    "invoices": [
        {
            "payment_no": "15",
            "invoice_id": "08acc2ebc0da9861dec3",
            "amount": 0.1,
            "amount_paid": 0.11,
            "fee": 0,
            "currency": "USD",
            "crypto_amount": 0.00072703,
            "crypto_amount_paid": 0.00082,
            "btc_amount_paid": 0.00002904,
            "crypto_currency": "ETH",
            "rate": 137.545643,
            "btc_rate": 0.035413,
            "address": "0xc9a62ee17edd72d24c105862bede09e70a17fbfc",
            "method": "ethereum",
            "date_add": "2019-03-06 14:35:25",
            "state": "",
            "include_fee": 0,
            "invoice_status": 1,
            "transactions": [
                {
                    "tx_id": "b1f4f0e1916794c597af",
                    "amount": 0.11,
                    "currency": "USD",
                    "crypto_amount": 0.00082,
                    "crypto_currency": "ETH",
                    "crypto_tx_id": "0x5f192f428f2c44820a6d6bd794fd405b2cca114a4dd8b415cf4aeab7ba7a40c9",
                    "linked": 1,
                    "type": 1,
                    "date_add": "2019-03-06 15:11:35"
                }
            ]
        }
    ]
}
Failed response:
400
{
    "status": 15
}
Undefined Transactions Actions
Description:

...

Request:
POST
https://my.terminall.net/api/v1/pay/undefined/link
Request Body:
Field Required Rules Description
app_token true - App token
invoice_id true - Invoice id
tx_id true - Transactions id
type true - Action type (1: link, 4: reject)
Example Request:
curl --request POST \
    --url https://my.terminall.net/api/v1/pay/undefined/link \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'app_token=rPJS3NAGLFoZGTHZAN6guRuKWQGwVTi9vhNIFp3XYzQZ4B0Pnl94kyPm7dJ0' \
    --data-urlencode 'invoice_id=57212f291a0b372fa57e' \
    --data-urlencode 'tx_id=1622266635981469' \
    --data-urlencode 'type=1'
Successfully Response:
200
[]
Failed response:
400
{
    "status": 5
}
Redirect For Payment
Description:

...

Request:
GET
https://my.terminall.net/pay/method?token={token}&back_url={back_url}
Request Query:
Field Required Rules Description
token true - Temporary payment token
back_url true - Back URL
Successfully Response:
302
HTTP/1.1 302 Found
Location: http://back_url/
Failed response:
302
HTTP/1.1 302 Found
Location: http://back_url?status=6

PHP Client

Install

Download library and include autoloader script src/autoload.php

<?php

require_once '/path/to/library/src/autoload.php';

$appToken = 'BtAcy3JwNxPan6rfg3jdqCBie6mBPoykCiHXtMRkUxLWl1Yr7bE9HJTjkIjm';

$terminall = new \Terminall\ApiClient($appKey);

// Set request timeout (default 10 seconds)
$terminall->setTimeout(10);
Service Availability Check
<?php

if ($terminall->alivecheck()) {
    echo 'Alive';
} else {
    echo 'Not alive';
}
Getting a Temporary Token
<?php

try {
    $invoiceData = [
        'amount' => 12,
        'payment_no' => '3129a15e5a9',
    ];

    $result = $terminall->createInvoice($invoiceData);

    if ($result->success) {
        var_dump($result->token);
    }

} catch (Exception $e) {
    var_dump($e->getMessage());
}
Transactions List
<?php

try {
    $result = $terminall->getTransactions(['payment_no' => '3129a15e5a9']);

    if ($result->success) {
        var_dump($result->count);
        var_dump($result->invoices);
    }

} catch (Exception $e) {
    var_dump($e->getMessage());
}
Undefined Transactions List
<?php

try {
    $result = $terminall->getUndefinedTransactions(['limit' => '5']);

    if ($result->success) {
        var_dump($result->count);
        var_dump($result->invoices);
    }

} catch (Exception $e) {
    var_dump($e->getMessage());
}
Undefined Transactions Actions
<?php

try {
    $invoiceId = '3129a15e5a9';
    $txId = 'aecbd6ac974d6fc2e0ae';

    // use $terminall->undefinedLink($invoiceId, $txId) for link
    // or $terminall->undefinedReject($invoiceId, $txId) for reject
    $result = $terminall->undefinedActions($invoiceId, $txId, 1);

    if ($result->success) {
        var_dump('...');
    }

} catch (Exception $e) {
    var_dump($e->getMessage());
}
Redirect For Payment
<?php

try {
    $back_url = 'http://back_url';
    $result = $terminall->createInvoice($invoiceData);

    if ($result->success) {
        $link = $terminall->paymentLink($result->token, $back_url);
        header('Location: ' . $link);
        die();
    }

} catch (Exception $e) {
    var_dump($e->getMessage());
}