No project description provided
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file payme_sdk-0.0.1.tar.gz.
File metadata
- Download URL: payme_sdk-0.0.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a19dd6837288073366910e4ffffb47ae9af5dd3f14b7004c46bca334198cbf56
|
|
| MD5 |
843dfb33ef26edabadf54e3808b95459
|
|
| BLAKE2b-256 |
c3796dffbe23d50f8ff50b0b4fbfa867dc06f05934bb067181c1f8a518e7b15c
|
File details
Details for the file payme_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: payme_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e09dad9b410dc506c47e56287f87f6de6f358f38e967daf11a5a336c1839c550
|
|
| MD5 |
fc74d6d22c7043ddbcd6743f4c5152b2
|
|
| BLAKE2b-256 |
d730aaf10ac577f72bbc9248a93d23531d416a7695fad896e0e62b0cc8fd7527
|