Create invoice
Creates a merchant invoice and returns a payment link.
curl -X POST "https://api.example.com/v1/api/v1/create-invoice" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"amount": "1500.00",
"callback_url": "https://yoursite.com/webhooks/payment",
"currency_code": "UAH",
"customer_id": "user_12345",
"external_id": "order-2026-0001",
"fail_url": "https://yoursite.com/payment/failed",
"purpose": "Payment for Premium subscription",
"success_url": "https://yoursite.com/payment/success"
}'
import requests
import json
url = "https://api.example.com/v1/api/v1/create-invoice"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
data = {
"amount": "1500.00",
"callback_url": "https://yoursite.com/webhooks/payment",
"currency_code": "UAH",
"customer_id": "user_12345",
"external_id": "order-2026-0001",
"fail_url": "https://yoursite.com/payment/failed",
"purpose": "Payment for Premium subscription",
"success_url": "https://yoursite.com/payment/success"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.example.com/v1/api/v1/create-invoice", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"amount": "1500.00",
"callback_url": "https://yoursite.com/webhooks/payment",
"currency_code": "UAH",
"customer_id": "user_12345",
"external_id": "order-2026-0001",
"fail_url": "https://yoursite.com/payment/failed",
"purpose": "Payment for Premium subscription",
"success_url": "https://yoursite.com/payment/success"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"amount": "1500.00",
"callback_url": "https://yoursite.com/webhooks/payment",
"currency_code": "UAH",
"customer_id": "user_12345",
"external_id": "order-2026-0001",
"fail_url": "https://yoursite.com/payment/failed",
"purpose": "Payment for Premium subscription",
"success_url": "https://yoursite.com/payment/success"
}`)
req, err := http.NewRequest("POST", "https://api.example.com/v1/api/v1/create-invoice", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.example.com/v1/api/v1/create-invoice')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
request.body = '{
"amount": "1500.00",
"callback_url": "https://yoursite.com/webhooks/payment",
"currency_code": "UAH",
"customer_id": "user_12345",
"external_id": "order-2026-0001",
"fail_url": "https://yoursite.com/payment/failed",
"purpose": "Payment for Premium subscription",
"success_url": "https://yoursite.com/payment/success"
}'
response = http.request(request)
puts response.body
{
"invoice_id": "example_string",
"external_id": "example_string",
"amount": "example_string",
"currency": "example_string",
"status": "example_string",
"payment_link": "example_string",
"customer_id": "example_string",
"purpose": "example_string",
"callback_url": "example_string",
"success_url": "example_string",
"fail_url": "example_string",
"created_at": "example_string",
"expires_at": "example_string",
"finished_at": "example_string"
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "API_KEY_MISSING",
"message": "Missing X-Api-Key header"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "API_KEY_INVALID",
"message": "Invalid or inactive API key"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "OWNER_BLOCKED",
"message": "Merchant owner is blocked"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "MERCHANT_BLOCKED",
"message": "Merchant is banned"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "MERCHANT_NOT_ACTIVE",
"message": "Merchant is inactive"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "CUSTOMER_RATE_LIMIT",
"message": "Customer created too many unpaid invoices"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "DUPLICATE_EXTERNAL_ID",
"message": "External ID for this merchant is already exists, try to generate another External ID"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "CURRENCY_INVALID",
"message": "Currency not found or disabled"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "PAYMENT_METHOD_NOT_FOUND",
"message": "No active payment method for currency/amount"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "AMOUNT_BELOW_MIN",
"message": "Amount is below the minimum supported by any active payment method for this currency"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "AMOUNT_ABOVE_MAX",
"message": "Amount exceeds the maximum supported by any active payment method for this currency"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "MISSING_REQUIRED_URLS",
"message": "callback_url, success_url and fail_url are required. Provide them in the request or set defaults in merchant settings"
}
}
{
"successful": false,
"request_id": "a1b2c3d4-...",
"error": {
"code": "DEALS_SYSTEM_DISABLED",
"message": "Deals system is disabled"
}
}
/api/v1/create-invoice
Target server for requests. Edit to use your own host.
The media type of the request body
Payment amount in fiat currency. At most 2 decimal places (e.g. 100, 100.5, 100.50). More than 2 decimals is rejected with 422.
ISO 4217 currency code (3 uppercase letters)
Unique customer identifier in your system. Used for rate limiting
Your unique invoice/order ID. Must be unique per merchant.
Payment description shown to customer on payment page
HTTPS URL for webhook notifications. Falls back to merchant default if omitted
URL to redirect customer after successful payment. Falls back to merchant default if omitted
URL to redirect customer after failed/expired payment. Falls back to merchant default if omitted
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Merchant API Key.
Body
Payment amount in fiat currency. At most 2 decimal places (e.g. 100, 100.5, 100.50). More than 2 decimals is rejected with 422.
ISO 4217 currency code (3 uppercase letters)
Unique customer identifier in your system. Used for rate limiting
Your unique invoice/order ID. Must be unique per merchant.
Payment description shown to customer on payment page
HTTPS URL for webhook notifications. Falls back to merchant default if omitted
URL to redirect customer after successful payment. Falls back to merchant default if omitted
URL to redirect customer after failed/expired payment. Falls back to merchant default if omitted
Responses
Internal invoice ID (UUID). Use this for /payment-methods and /select-method
Invoice amount in fiat currency
pending — awaiting method selection
URL to redirect the customer to the payment page
Invoice TTL expiration before method selection. After select-method, deal-level expiration applies