Skip to main content

inPAY Python SDK

Official Python SDK for the inPAY payment platform (Uzbekistan). One inPAY contract → accept Click, Payme, UzCard/HUMO with a few lines of code.

Bitta inPAY shartnomasi bilan barcha to'lov usullarini qabul qiling.

O'rnatish / Installation

pip install inpay-sdk

Talab: Python ≥ 3.8. Tashqi bog'liqliksiz (faqat standart kutubxona).

Tez boshlash / Quick start

from inpay import InPay

inpay = InPay(
    merchant_id=12345,          # kassa merchant_id
    bearer_token="xxxxxxxx",    # kassa bearer token
    webhook_secret="yyyyyyyy",  # webhook imzosi uchun
)

# 1) To'lov yaratish
invoice = inpay.create(
    amount=50000,                       # so'm (min 1000)
    callback_url="https://shop.uz/inpay/webhook",
    order_id="A-123",                   # sizning ichki reference
)

print(invoice.pay_url)   # foydalanuvchini shu manzilga yo'naltiring

invoice:

Atribut Izoh
invoice.order_id inPAY buyurtma ID (16 hex)
invoice.pay_url Universal checkout sahifasi
invoice.pay_url_link So'ralgan usulga mos to'g'ridan havola
invoice.pay_links {"click": ..., "payme": ...} to'g'ridan havolalar

To'g'ridan-to'g'ri bitta usul

invoice = inpay.create(amount=50000, payment_method="click")  # "click"|"payme"|"myuzcard"

2) Holatni tekshirish / Status

tx = inpay.status("a1b2c3d4e5f6a7b8")
if tx.is_paid:
    ...
# tx.status: "pending" | "success" | "failed"

3) Webhook (payment.success)

inPAY to'lov muvaffaqiyatli bo'lganda callback_url'ingizga POST yuboradi va uni X-InPAY-Signature (HMAC-SHA256) bilan imzolaydi. SDK imzoni constant-time tekshiradi.

Flask misoli:

from flask import Flask, request
from inpay import InPay
from inpay.exceptions import SignatureError

app = Flask(__name__)
inpay = InPay(merchant_id=12345, bearer_token="xxxxxxxx", webhook_secret="yyyyyyyy")

@app.post("/inpay/webhook")
def inpay_webhook():
    sig = request.headers.get("X-InPAY-Signature", "")
    try:
        tx = inpay.webhook().verify(request.get_data(as_text=True), sig)
    except SignatureError:
        return {"ok": False}, 401

    if tx.is_paid:
        # ⚠️ IDEMPOTENT bo'ling — takror kelishi mumkin
        # if already_paid(tx.order_id): return {"ok": True}
        # mark_paid(tx.order_id, tx.amount)
        ...
    return {"ok": True}

Xavfsizlik: imzo tekshiruvidan o'tmagan webhook'ni HECH QACHON to'lov deb qabul qilmang.

Xatolar / Errors

from inpay.exceptions import ApiError, SignatureError, InPayError

try:
    inpay.create(amount=50000)
except ApiError as e:
    print(e.error_code)   # masalan "MERCHANT_INACTIVE", "AMOUNT_TOO_LOW"

Litsenziya

MIT © inPAY

Metadata

Release files for inpay-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inpay-sdk 1.0.0
File Size Uploaded Provenance Actions
inpay_sdk-1.0.0.tar.gz 11.2 kB Without provenance Details for inpay_sdk-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inpay-sdk 1.0.0
File Interpreter ABI Platform Actions
inpay_sdk-1.0.0-py3-none-any.whl Python 3 none any Details for inpay_sdk-1.0.0-py3-none-any.whl

Total release size: 21.2 kB

Release files / inpay_sdk-1.0.0.tar.gz

Download URL inpay_sdk-1.0.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4003445fb9fb3bd7b44898fa8c8e25de816fdbf3db053373a08f00206405b7f6
BLAKE2b-256 checksum
How to use checksums
89d756f1cd39c8c24477c9b093c59af8f1bf58a27784b52946dec0ea4c9620db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / inpay_sdk-1.0.0-py3-none-any.whl

Download URL inpay_sdk-1.0.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af47d203acc5cee783e5f68a3b784c941a239d0052f4b41481e70dbcf84a017d
BLAKE2b-256 checksum
How to use checksums
154656a160a16926d854134f7d8bf63542e37bcbb1022ec5edb39a53b49f662d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Security for inpay-sdk 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page