Русский O'zbek English

API Documentation

Integrate SmartPay into your site in minutes with REST API, webhooks, and payment links.

Authentication

All API calls (except invoice creation) require the header:

X-Api-Key: spk_your_api_key

Copy the API key from Dashboard → Settings.

Creating a payment (invoice)

POST /api/create

Creates an invoice and returns the payment page URL.

Parameter Type Required Description
merchant_id string Your merchant UUID
amount float Charge amount
currency string Currency code (UZS, USD, EUR...)
order_id string Unique order identifier on your side
sign string SHA256 signature (see below)
description string Payment description
success_url string Redirect URL on success
fail_url string Redirect URL on failure
webhook_url string Override webhook URL for this invoice
lang string Payment page language (ru/uz/en)
email string Customer email for notifications
user_data string Vendor data visible in dashboard

Signature generation (sign)

sign = SHA256(merchant_id:amount:currency:secret_key1:order_id)

// PHP example
$sign = hash('sha256',
    $merchant_id.':'.$amount.':'.$currency.':'.$secret_key1.':'.$order_id
);

Response example

{
  "type": "success",
  "invoice_id": "SP3a7f...",
  "url": "https://your-domain.com/pay/?id=SP3a7f...",
  "amount": 50000,
  "currency": "UZS",
  "order_id": "ORD-123",
  "expires_at": "2024-01-01 12:00:00"
}

Retrieve payment status

GET /api/info?invoice_id=SP...

Requires X-Api-Key and invoice_id parameters.

{
  "type": "success",
  "invoice_id": "SP3a7f...",
  "order_id": "ORD-123",
  "amount": 50000,
  "currency": "UZS",
  "status": "paid",
  "paid_at": "2024-01-01 11:45:00"
}

Possible statuses: pending, awaiting, checking, paid, rejected, expired.

Payment methods

GET /api/methods returns all active cashiers for your merchant.

Webhook notifications

SmartPay will POST to your webhook URL every time a payment status changes.

POST https://yoursite.com/webhook
Content-Type: application/x-www-form-urlencoded

invoice_id=SP3a7f...&order_id=ORD-123&amount=50000¤cy=UZS&status=paid&sign=SHA256...

Verify webhook signature

sign = SHA256(sorted_values_joined_colon + ":" + secret_key2).

$data = ['invoice_id'=>..., 'order_id'=>..., 'amount'=>..., 'currency'=>..., 'status'=>...];
ksort($data);
$sign = hash('sha256', implode(':', array_values($data)).':'.$secret_key2);

Integration checklist

  1. Register a merchant account and copy the UUID/API keys.
  2. Add cashiers (payment methods) with currencies, limits, and icons.
  3. Create invoices through /api/create with amount, order_id, description, and signature.
  4. Redirect customers to the returned URL and track status via /api/info or webhook.

Platform workflow