Skip to content
On this page

Invoice creation ​

This documentation page describes the process of creating an invoice in Polus Payments using the HTTP API. By following the steps outlined in this guide, you can create an invoice and initiate a payment transaction through our platform. Whether you're a developer building a custom integration or a business owner looking to streamline your payment processes, this documentation provides a comprehensive overview of the API endpoints and parameters necessary to create successful invoice payments in Polus Payments.

API endpoint ​

Below is the official HTTP API endpoint for Polus Payments that you can use to integrate our payment platform into your application or website. TLS usage is mandatory.

https://api.poluspay.com/

Authorization ​

Authorization is a crucial step in using the Polus Payments API to securely interaction. To get started, merchants must register and create an account at app.poluspay.com, where they will be provided with a unique merchant ID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, as well as an API Key. To authorize API requests, merchants must generate a signature by applying HMAC SHA512 to the HTTP body, using their API Key as the key. This signature must be included in the x-signature header of each API request. Additionally, merchants must include their unique merchant ID in the x-merchant-id header to ensure that their requests are processed correctly.

go
package main

import (
	"crypto/hmac"
	"crypto/sha512"
	"encoding/hex"
	"fmt"
)

func main() {
	apiKey := []byte("b153...da1c")
	body := []byte(`{"some":"data"}`)

	h := hmac.New(sha512.New, apiKey)
	h.Write(body)

	sign := h.Sum(nil)
	fmt.Printf("x-signature: %s\n", hex.EncodeToString(sign))
}
python
import json
import hmac
import hashlib

def main():
    api_key = bytes("b153...da1c", 'utf-8')
    body = {"some": "data"}

    body_bytes = bytes(json.dumps(body, separators=(',', ':')), 'utf-8')
    sign = hmac.new(api_key, body_bytes, hashlib.sha512)

    print(f"x-signature: {sign.hexdigest()}")

if __name__ == "__main__":
    main()
java
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;

public class Main {
    public static String hex(byte[] bytes) {
        StringBuilder result = new StringBuilder();
        for (byte aByte : bytes) {
            result.append(String.format("%02x", aByte));
        }

        return result.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException {
        byte[] apiKey = "b153...da1c".getBytes();
        byte[] body = "{\"some\":\"data\"}".getBytes();

        Mac hmacSha512 = Mac.getInstance("HmacSHA512");
        SecretKeySpec keySpec = new SecretKeySpec(apiKey, "HmacSHA512");
        hmacSha512.init(keySpec);
        byte[] sign = hmacSha512.doFinal(body);

        System.out.printf("x-signature: %s\n", hex(sign));
    }
}
php
<?php

$apiKey = "b153...da1c";
$body = '{"some":"data"}';

$sign = hash_hmac('sha512', $body, $apiKey, true);
$signature = bin2hex($sign);

echo "x-signature: $signature\n";

Possible types

PaymentAssetRequest

fieldtypedesc
amountdecimalamount in human readable format, like: 100.00
addressstringdestination wallet address

CreatePaymentRequest

fieldtypedesc
descriptionstringinvoice description will be shown to merchant customer
assetsmap[network][assetName]PaymentAssetRequestlist of assets which merchant wants to receive

Possible values of network and assetName – you can get on POST /public/payment.assets.get

PaymentAsset

fieldtypedesc
networkstringselected network
namestringselected asset name
amountdecimalamount in the minimum unit of asset. e.g: 10200000
amount_decimalsdecimalhuman readable amount. e.g: 10.2
feedecimalfee in the minimum unit of asset
addressstringdestination wallet address

PaymentTransaction

fieldtypedesc
hashstringtransaction hash in blockchain
networkstringnetwork name, Example: polygon
network_idintnetwork id, Example: 137
notification_deliveredboolflag that indicates whether a webhook has been delivered

Payment

fieldtypedesc
iduuidunique identifier of that payment
merchant_iduuididentifier of your merchant
descriptionstringinvoice description passed in CreatePaymentRequest
assets[]PaymentAssetlist of assets which merchant wants to receive
evm_fee_addressstringservice fee address
statusstringpayment status
paid_assetPaymentAsset|nullone of asset from assets list which was received by merchant. Not null when payment is success
transactionPaymentTransaction|nullthat value will be filled after payment completion
expires_atdatedate of payment expiration in UTC
created_atdatedate of payment creation in UTC

Possible values of status – | "pending" | "in_progress" | "success" | "failed" CreateLitePaymentRequest

fieldtypedesc
merchant_iduuidyour merchant id
descriptionstringinvoice description will be shown to merchant customer
target_assetstringasset which you want to receive
amountdecimalamount in human readable format, like: 100.00
order_idstring|nullorder id in your system, can be null or empty
signaturestringhmac_sha512('description|target_asset|amount|order_id', merchant.signing_key) encoded in hex
auto_redirectbooldefault: false. Set this option to true if you want to redirect user to pay_link

Possible values of target_asset – you can get on POST /public/payment.assets.get

Payment creation with using presaved addresses in merchant dashboard ​

Important: Before using this method, you need add wallets in Dashboard > Merchants > Select your merchant > Tokens & Addresses

POST /lite/payment.create ​

That method returns Payment

example request

json
{
    "merchant_id": "8a349ce2-97a5-43d4-a65d-c8dcde946bd5",
    "description": "Test lite payment",
    "target_asset": "usdt",
    "amount": "10",
    "order_id": "asdasd1231",
    "signature": "86fa1a833e5d161a345f5c6d8d30c5889de1cc1386f268a55183f7e16ffd27508528591eb0ce465fcd79812ba269d988874c60ac2b18a469e125acaea0930167",
    "auto_redirect": false
}

example response

json
{
    "id": "4f18c147-da95-4454-882d-e154fd7ad8ee",
    "merchant_id": "8a349ce2-97a5-43d4-a65d-c8dcde946bd5",
    "description": "Telegram Premium",
    "pay_link": "https://form.poluspay.com/id/4f18c147-da95-4454-882d-e154fd7ad8ee",
    "order_id": "asdasd1231",
    "assets": [
        {
            "network": "polygon",
            "name": "usdt",
            "amount": "9950000",
            "amount_decimals": "9.95",
            "fee": "50000",
            "fee_decimals": "0.05",
            "address": "0x8C8D7C46219D9205f056f28fee5950aD564d7464"
        },
        {
            "network": "ethereum",
            "name": "usdt",
            "amount": "9950000",
            "amount_decimals": "9.95",
            "fee": "50000",
            "fee_decimals": "0.05",
            "address": "0x8C8D7C46219D9205f056f28fee5950aD564d7464"
        },
        {
            "network": "bsc",
            "name": "usdt",
            "amount": "9950000000000000000",
            "amount_decimals": "9.95",
            "fee": "50000000000000000",
            "fee_decimals": "0.05",
            "address": "0x8C8D7C46219D9205f056f28fee5950aD564d7464"
        }
    ],
    "paid_asset": null,
    "evm_fee_address": "0x71ca3dd1041c73d2445b48149eb982523ac7d4a5",
    "status": "pending",
    "transaction": null,
    "expires_at": "2023-06-08T14:47:50.317802Z",
    "created_at": "2023-06-08T13:47:50.31884Z"
}

Payment creation with passing addresses ​

POST /merchant/payment.create ​

example request

json
{
    "description": "Telegram Premium",
    "assets": {
        "litecoin": {
            "ltc": {
                "amount": "10",
                "address": "MLJhWniUivYwtou2RKfrLbwjxxyqGoibTY"
            }
        },
        "bitcoin": {
            "btc": {
                "amount": "10",
                "address": "bc1qx2x5cqhymfcnjtg902ky6u5t5htmt7fvqztdsm028hkrvxcl4t2sjtpd9l"
            }
        }
    }
}

example response

json
{
    "id": "4f18c147-da95-4454-882d-e154fd7ad8ee",
    "merchant_id": "8a349ce2-97a5-43d4-a65d-c8dcde946bd5",
    "description": "Telegram Premium",
    "pay_link": "https://form.poluspay.com/id/4f18c147-da95-4454-882d-e154fd7ad8ee",
    "assets": [
        {
            "network": "polygon",
            "name": "usdt",
            "amount": "9950000",
            "amount_decimals": "9.95",
            "fee": "50000",
            "fee_decimals": "0.05",
            "address": "0x8C8D7C46219D9205f056f28fee5950aD564d7464"
        },
        {
            "network": "ethereum",
            "name": "usdt",
            "amount": "9950000",
            "amount_decimals": "9.95",
            "fee": "50000",
            "fee_decimals": "0.05",
            "address": "0x8C8D7C46219D9205f056f28fee5950aD564d7464"
        },
        {
            "network": "bsc",
            "name": "usdt",
            "amount": "9950000000000000000",
            "amount_decimals": "9.95",
            "fee": "50000000000000000",
            "fee_decimals": "0.05",
            "address": "0x8C8D7C46219D9205f056f28fee5950aD564d7464"
        }
    ],
    "paid_asset": null,
    "evm_fee_address": "0x71ca3dd1041c73d2445b48149eb982523ac7d4a5",
    "status": "pending",
    "transaction": null,
    "expires_at": "2023-06-08T14:47:50.317802Z",
    "created_at": "2023-06-08T13:47:50.31884Z"
}

TIP

All fields containing time use ISO 8601 standart.