Skip to main content

Payme Software Development Kit

Support Group on Telegram

PyPI - Downloads

Welcome to payme-pkg, the Payme SDK for Python.

You can use it for test and production mode. Join our community and ask everything you need.

Watch the YouTube Demo

Installation

pip install payme-pkg

Table of Contents

Django Integration

Add 'payme' in to your settings.py

INSTALLED_APPS = [
    ...
    'payme',
    ...
]

Add 'payme' credentials inside to settings.py

One time payment (Однаразовый платеж) configuration settings.py

PAYME_ID = "your-payme-id"
PAYME_KEY = "your-payme-key"
PAYME_ACCOUNT_FIELD = "order_id"
PAYME_AMOUNT_FIELD = "total_amount"
PAYME_ACCOUNT_MODEL = "orders.models.Orders"
PAYME_ONE_TIME_PAYMENT = True

PAYME_DISABLE_ADMIN = False # (optionally configuration if you want to disable change to True)

Create a new View that about handling call backs

from payme.views import PaymeWebHookAPIView


class PaymeCallBackAPIView(PaymeWebHookAPIView):


    def handle_successfully_payment(self, params, result, *args, **kwargs):
        """
        Handle the successful payment. You can override this method
        """
        print(f"Transaction successfully performed for this params: {params} and performed_result: {result}")

    def handle_cancelled_payment(self, params, result, *args, **kwargs):
        """
        Handle the cancelled payment. You can override this method
        """
        print(f"Transaction cancelled for this params: {params} and cancelled_result: {result}")

Add a payme path to core of urlpatterns:

from django.urls import path
from django.urls import include

from your_app.views import PaymeCallBackAPIView

urlpatterns = [
    ...
    path("payment/update/", PaymeCallBackAPIView.as_view()),
    ...
]

Run migrations

python manage.py migrate

🎉 Congratulations you have been integrated merchant api methods with django, keep reading docs. After successfull migrations check your admin panel and see results what happened.

Payme Client SDK

The Payme SDK provides a unified client interface for working with all Payme services.

Initialization

Initialize the Payme client with your credentials:

from payme import Payme

# Basic initialization (for Cards API and Payment Links)
payme = Payme(
    payme_id="your-payme-id",
    is_test_mode=True,  # Optional: defaults to False
)

# Full initialization (for all features including Receipts API)
payme = Payme(
    payme_id="your-payme-id",
    payme_key="your-payme-key",  # Required for Receipts API
    is_test_mode=True,
)

Cards API

Manage card tokenization and verification.

Create Card

Create a new card token.

response = payme.cards_create(
    number="8600495473316478",
    expire="0399",  # MMYY format
    save=True,  # Optional: save card for future use
    timeout=10  # Optional: request timeout in seconds
)

print(response.result.card.token)  # Card token
print(response.result.card.number)  # Masked card number

Get Verify Code

Request a verification code for a card.

response = payme.cards_get_verify_code(
    token="card-token",
    timeout=10
)

print(response.result.sent)  # True if code was sent
print(response.result.phone)  # Phone number where code was sent

Verify Card

Verify a card with the code received via SMS.

response = payme.cards_verify(
    token="card-token",
    code="666666",  # Code from SMS
    timeout=10
)

print(response.result.card.verify)  # True if verified

Check Card

Check the status of a card.

response = payme.cards_check(
    token="card-token",
    timeout=10
)

print(response.result.card.verify)  # Verification status

Remove Card

Remove a card token.

response = payme.cards_remove(
    token="card-token",
    timeout=10
)

print(response.result.success)  # True if removed

Test Cards

Run comprehensive tests for card operations.

payme.cards_test()

Receipts API

Manage payment receipts (requires payme_key).

Create Receipt

Create a new payment receipt.

response = payme.receipts_create(
    account={"order_id": 12345},
    amount=50000,  # Amount in tiyins (50000 tiyins = 500 UZS)
    description="Payment for order #12345",  # Optional
    detail={  # Optional
        "items": [
            {"name": "Product 1", "price": 25000, "quantity": 1},
            {"name": "Product 2", "price": 25000, "quantity": 1}
        ]
    },
    timeout=10
)

print(response.result.receipt._id)  # Receipt ID

Pay Receipt

Pay a receipt using a card token.

response = payme.receipts_pay(
    receipts_id="receipt-id",
    token="card-token",
    timeout=10
)

print(response.result.receipt.state)  # Payment state (4 = paid)

Send Receipt

Send receipt details to a phone number.

response = payme.receipts_send(
    receipts_id="receipt-id",
    phone="998901234567",
    timeout=10
)

print(response.result.success)  # True if sent

Cancel Receipt

Cancel a receipt.

response = payme.receipts_cancel(
    receipts_id="receipt-id",
    timeout=10
)

print(response.result.receipt.state)  # State (50 = cancelled)

Check Receipt

Check the status of a receipt.

response = payme.receipts_check(
    receipts_id="receipt-id",
    timeout=10
)

print(response.result.state)  # Current state

Get Receipt

Get detailed information about a specific receipt.

response = payme.receipts_get(
    receipts_id="receipt-id",
    timeout=10
)

print(response.result.receipt)  # Receipt details

Get All Receipts

Get all receipts within a time range.

response = payme.receipts_get_all(
    count=10,  # Number of receipts to retrieve
    from_=1609459200000,  # Start timestamp (milliseconds)
    to=1640995200000,  # End timestamp (milliseconds)
    offset=0,  # Pagination offset
    timeout=10
)

for receipt in response.result:
    print(receipt._id, receipt.amount)

Set Fiscal Data

Set fiscal data for a receipt.

response = payme.receipts_set_fiscal_data(
    receipt_id="receipt-id",
    qr_code_url="https://ofd.uz/check?t=123&s=456&r=789&c=2024",
    timeout=10
)

print(response.result.success)  # True if set

Test Receipts

Run comprehensive tests for receipt operations.

payme.receipts_test()

Payment Initialization

Generate payment links for customers.

Generate Pay Link

Generate a payment link for checkout.

pay_link = payme.generate_pay_link(
    id=12345,  # Account ID
    amount=5000,  # Amount in UZS (will be converted to tiyins)
    return_url="https://example.com/success"
)

print(pay_link)
# Output: https://checkout.paycom.uz/bT1...

Generate Fallback Link

Generate a fallback payment link with custom form fields.

fallback_link = payme.generate_fallback_link(
    form_fields={  # Optional
        "driver_id": 12345,
        "amount": 1000
    }
)

print(fallback_link)
# Output: https://payme.uz/fallback/merchant/?id=...&driver_id=12345&amount=1000

Note: The fallback ID is different from the merchant ID. Contact the Payme team to get your fallback ID.

Metadata

Release files for payme-pkg 3.4.1

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

Source distribution (sdist)

Source distribution for payme-pkg 3.4.1
File Size Uploaded
payme_pkg-3.4.1.tar.gz 27.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for payme-pkg 3.4.1
File Interpreter ABI Platform
payme_pkg-3.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 58.9 kB

Release files / payme_pkg-3.4.1.tar.gz

Download URL payme_pkg-3.4.1.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4cd1ad7bc343fd02869813d62d81488c0f51cf327e620203116a468d24ec6c8c
BLAKE2b-256 checksum
How to use checksums
2dc56fe09e09f315c596246a242b9cb82132c6ab566d5ac696169184ea1ac143
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / payme_pkg-3.4.1-py3-none-any.whl

Download URL payme_pkg-3.4.1-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a136a29705cfa6ef6e518028b8356b9d73cf80cc4d52372ace5d34ea560eee02
BLAKE2b-256 checksum
How to use checksums
82cbaade965b6d55ddef764a0d1cab22a5ae3ec8e5677f3632817868acb90c36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6
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