Skip to main content

No project description provided

Project description

Payme PKG

Welcome to payme-pkg, the open source payme sdk for python.

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

Visit to full documentation for Merchant and Subcribe Api

Installation

pip install payme-pkg

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

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

python3 manage.py makemigrations && 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=

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

payme_pkg-3.0.9.tar.gz (19.6 kB view details)

Uploaded Source

File details

Details for the file payme_pkg-3.0.9.tar.gz.

File metadata

  • Download URL: payme_pkg-3.0.9.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.11.1 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.2.2 tqdm/4.66.5 importlib-metadata/8.4.0 keyring/25.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.12.7

File hashes

Hashes for payme_pkg-3.0.9.tar.gz
Algorithm Hash digest
SHA256 f9c9c57d1ac7664e362f41846c0f5b5ccb6bc47c6be861c08012904529e9afa7
MD5 def874e87a9805583309abc7b6185aa9
BLAKE2b-256 18427a82ebda2acd121354113815c3934fde32c6f6d9f3ac6bd0fe7f02b9e2ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page