Skip to main content

Payme Software Development Kit

Installation

pip install payme-sdk

Installation to Django

Add 'payme' in to your settings.py

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

Add 'payme' credentials inside to settings.py

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

Example project: https://github.com/PayTechUz/shop-backend

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

Multi payment (Накопительный) configuration settings.py

Example project: Coming soon

PAYME_ID = "your-payme-id"
PAYME_KEY = "your-payme-key"
PAYME_ACCOUNT_FIELD = "id"
PAYME_ACCOUNT_MODEL = "clients.models.Client"
PAYME_ONE_TIME_PAYMENT = False

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_created_payment(self, params, result, *args, **kwargs):
        """
        Handle the successful payment. You can override this method
        """
        print(f"Transaction created for this params: {params} and cr_result: {result}")

    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.

Generate Pay Link

Example to generate link:

  • Input
from payme import Payme

payme = Payme(payme_id="your-payme-id")
pay_link = payme.initializer.generate_pay_link(id=123456, amount=5000, return_url="https://example.com")
print(pay_link)
  • Output
https://checkout.paycom.uz/bT15b3VyLXBheW1lLWlkO2FjLmlkPTEyMzQ1NjthPTUwMDAwMDtjPWh0dHBzOi8vZXhhbXBsZS5jb20=

Generate Fallback Link

Example to generate fallback link:

  • Input

The ID in the fallback is different from the merchant ID. You can get the ID from the Payme team.

from payme import Payme

payme = Payme(payme_id="your-payme-id", fallback_id="your-fallback-id")

form_fields = {
    "driver_id": 12345,
    "amount": 1000
}

fallback_link = payme.initializer.generate_fallback_link(form_fields)  # form field is optional
print(fallback_link)
  • Output
https://payme.uz/fallback/merchant/?id=examplelinkgenerated&driver_id=12345&amount=1000

Release files for payme-sdk 0.0.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-sdk 0.0.1
File Size Uploaded
payme_sdk-0.0.1.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for payme-sdk 0.0.1
File Interpreter ABI Platform
payme_sdk-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / payme_sdk-0.0.1.tar.gz

Download URL payme_sdk-0.0.1.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a19dd6837288073366910e4ffffb47ae9af5dd3f14b7004c46bca334198cbf56
BLAKE2b-256 checksum
How to use checksums
c3796dffbe23d50f8ff50b0b4fbfa867dc06f05934bb067181c1f8a518e7b15c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / payme_sdk-0.0.1-py3-none-any.whl

Download URL payme_sdk-0.0.1-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e09dad9b410dc506c47e56287f87f6de6f358f38e967daf11a5a336c1839c550
BLAKE2b-256 checksum
How to use checksums
d730aaf10ac577f72bbc9248a93d23531d416a7695fad896e0e62b0cc8fd7527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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