Requirements
pip install django
pip install djangorestframework
pip install payme-drf
pip install requests
# supported versions
python 3.5 +
django 2 +
djangorestframework 3.7 +
payme-drf 0.01 +
settings.py
PAYME_SETTINGS = {
"KASSA_ID": "",
"SECRET_KEY": "",
"INTEGRATION_INTEND": "" # either web or mobile
}
INSTALLED_APPS = [
...
'rest_framework',
'payme',
...
]
python manage.py migrate
Create payme user
python manage.py create_payme_user
view.py
from payme.methods.merchant.validation_classes import BaseMerchantValidationClass
from payme.methods.merchant.views import BaseMerchantAPIView
class MerchantValidationClass(BaseMerchantValidationClass):
"""
MerchantValidationClass implements abstract methods from BaseMerchantValidationClass
to handle specific payment validation logic.
Exceptions Handled:
- OrderNotFoundException: Raised when the order is not found.
- InvalidAmountException: Raised when the transaction amount is invalid.
"""
def check_order(self, amount, account, **kwargs):
"""Validates the existence and correctness of the order."""
...
def successful_payment(self, params, *args, **kwargs):
"""Processes actions for a successful payment."""
...
def cancel_payment(self, params, *args, **kwargs):
"""Processes actions for canceling a payment."""
...
class PaymeMerchantAPIView(BaseMerchantAPIView):
"""
PaymeMerchantAPIView handles API requests for Payme merchant operations
by using the MerchantValidationClass to validate transactions.
"""
validation_class = MerchantValidationClass
urls.py
from django.urls import path
urlpatterns = [
path('payme/', PaymeMerchantAPIView.as_view())
]
create_initialization.py
https://help.paycom.uz/uz/initsializatsiya-platezhey/otpravka-cheka-po-metodu-get
You can pass multiple items to ac_params to customize the payment request.
from payme.methods.merchant.helpers import PaymeHelper
from decimal import Decimal
helper = PaymeHelper()
ac_params = {"order_id": "12221"} # Here, your account parameters
url = helper.create_initialization(amount=Decimal(5000.00), ac_params=ac_params, return_url='https://example.com/success/')
print(url)
Metadata
Release files for payme-drf 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| payme_drf-1.0.0.tar.gz | 26.1 kB | Without provenance | Details for payme_drf-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| payme_drf-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for payme_drf-1.0.0-py3-none-any.whl |
Total release size: 62.4 kB
Release files / payme_drf-1.0.0.tar.gz
| Download URL | payme_drf-1.0.0.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46d7658948daeedbe5e3fc6e92cf8049786bcefa4d66f6ed71d5f1fdb35d8952
|
|
BLAKE2b-256 checksum How to use checksums |
0ae1311821976f25cfae05e08533a08bf29bf96a1f201fc045026a141e52eeaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Release files / payme_drf-1.0.0-py3-none-any.whl
| Download URL | payme_drf-1.0.0-py3-none-any.whl |
|---|---|
| Size | 36.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd1d7777147d9353e017d3899199380d5491a134dfda74cb4e921fdf8e536db5
|
|
BLAKE2b-256 checksum How to use checksums |
08c281b019399c17a367e673469b767fc97da816a1ab935dae0051ef8e740f83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Security for payme-drf 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.