<h1 align="center">Payme Software Development Kit</h1>
<p align="center">
<a href="https://t.me/+lO97J78xBj45MzBi">
<img src="https://img.shields.io/badge/Support%20Group-blue?logo=telegram&logoColor=white" alt="Support Group on Telegram"/>
</a>
</p>
<p align="center">
<a href="https://docs.pay-tech.uz"><img src="https://img.shields.io/static/v1?message=Documentation&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1"></a>
<a href="https://github.com/PayTechUz/payme-pkg"><img src="https://img.shields.io/badge/Open_Source-❤️-FDA599?"/></a>
<a href="https://github.com/PayTechUz/payme-pkg/issues">
<img src="https://img.shields.io/github/issues/PayTechUz/payme-pkg" />
</a>
<a href="https://pepy.tech/project/payme-pkg">
<img src="https://static.pepy.tech/badge/payme-pkg" alt="PyPI - Downloads" />
</a>
</p>
<p align="center">Welcome to payme-pkg, the open source payme SDK for Python.</p>
<p align="center">You can use it for test and production mode. Join our community and ask everything you need.</p>
<a href="https://docs.pay-tech.uz">
<p align="center">Visit the full documentation for Merchant and Subscribe API</p>
</a>
<a href="https://youtu.be/xxiIggu_RNk?si=Idpg8omFvFDCYtcm" target="_blank">
<p align="center">
<img style="width: 60%;" src="https://i.postimg.cc/WbD32bHC/payme-pkg-demo-m4a.gif" alt="Payme PKG Demo">
</p>
</a>
<p align="center">
<a href="https://youtu.be/7q7-c72tHpc?si=Sr0EAmEawWAFRk1m" target="_blank">
<img src="https://img.shields.io/badge/Watch%20Demo-red?logo=youtube&logoColor=white&style=for-the-badge"
alt="Watch the YouTube Demo"
style="width: 150px; height: 30px; border-radius: 7px;" />
</a>
</p>
## Installation
```shell
pip install payme-pkg
```
## Installation to Django
Add `'payme'` in to your settings.py
```python
INSTALLED_APPS = [
...
'payme',
...
]
```
Add `'payme'` credentials inside to settings.py
One time payment (Однаразовый платеж) configuration settings.py
Example project: https://github.com/PayTechUz/shop-backend
```python
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
```python
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
```python
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:
```python
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
```shell
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
```python
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.
```python
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Muhammadali-Akbarov/payme-pkg",
"name": "payme-pkg",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "paymeuz paycomuz payme-merchant merchant-api subscribe-api payme-pkg payme-api",
"author": "Muhammadali Akbarov",
"author_email": "muhammadali17abc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c9/af/6fc31ab71f2be63be6f9162aad38de5a5163a1d653d30cbbbcca475a2324/payme_pkg-3.0.17.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">Payme Software Development Kit</h1>\n\n<p align=\"center\">\n <a href=\"https://t.me/+lO97J78xBj45MzBi\">\n <img src=\"https://img.shields.io/badge/Support%20Group-blue?logo=telegram&logoColor=white\" alt=\"Support Group on Telegram\"/>\n </a>\n</p>\n\n<p align=\"center\">\n <a href=\"https://docs.pay-tech.uz\"><img src=\"https://img.shields.io/static/v1?message=Documentation&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1\"></a>\n <a href=\"https://github.com/PayTechUz/payme-pkg\"><img src=\"https://img.shields.io/badge/Open_Source-\u2764\ufe0f-FDA599?\"/></a>\n <a href=\"https://github.com/PayTechUz/payme-pkg/issues\">\n <img src=\"https://img.shields.io/github/issues/PayTechUz/payme-pkg\" />\n </a>\n <a href=\"https://pepy.tech/project/payme-pkg\">\n <img src=\"https://static.pepy.tech/badge/payme-pkg\" alt=\"PyPI - Downloads\" />\n </a>\n</p>\n\n<p align=\"center\">Welcome to payme-pkg, the open source payme SDK for Python.</p>\n\n<p align=\"center\">You can use it for test and production mode. Join our community and ask everything you need.</p>\n\n<a href=\"https://docs.pay-tech.uz\">\n <p align=\"center\">Visit the full documentation for Merchant and Subscribe API</p>\n</a>\n\n<a href=\"https://youtu.be/xxiIggu_RNk?si=Idpg8omFvFDCYtcm\" target=\"_blank\">\n <p align=\"center\">\n <img style=\"width: 60%;\" src=\"https://i.postimg.cc/WbD32bHC/payme-pkg-demo-m4a.gif\" alt=\"Payme PKG Demo\">\n </p>\n</a>\n\n<p align=\"center\">\n <a href=\"https://youtu.be/7q7-c72tHpc?si=Sr0EAmEawWAFRk1m\" target=\"_blank\">\n <img src=\"https://img.shields.io/badge/Watch%20Demo-red?logo=youtube&logoColor=white&style=for-the-badge\" \n alt=\"Watch the YouTube Demo\" \n style=\"width: 150px; height: 30px; border-radius: 7px;\" />\n </a>\n</p>\n\n\n## Installation\n\n```shell\npip install payme-pkg\n```\n\n## Installation to Django\n\nAdd `'payme'` in to your settings.py\n\n```python\nINSTALLED_APPS = [\n ...\n 'payme',\n ...\n]\n```\n\nAdd `'payme'` credentials inside to settings.py\n\nOne time payment (\u041e\u0434\u043d\u0430\u0440\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0442\u0435\u0436) configuration settings.py\n\nExample project: https://github.com/PayTechUz/shop-backend\n```python\nPAYME_ID = \"your-payme-id\"\nPAYME_KEY = \"your-payme-key\"\nPAYME_ACCOUNT_FIELD = \"order_id\"\nPAYME_AMOUNT_FIELD = \"total_amount\"\nPAYME_ACCOUNT_MODEL = \"orders.models.Orders\"\nPAYME_ONE_TIME_PAYMENT = True\n```\n\nMulti payment (\u041d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439) configuration settings.py\n\nExample project: Coming soon\n```python\nPAYME_ID = \"your-payme-id\"\nPAYME_KEY = \"your-payme-key\"\nPAYME_ACCOUNT_FIELD = \"id\"\nPAYME_ACCOUNT_MODEL = \"clients.models.Client\"\nPAYME_ONE_TIME_PAYMENT = False\n```\n\nCreate a new View that about handling call backs\n```python\nfrom payme.views import PaymeWebHookAPIView\n\n\nclass PaymeCallBackAPIView(PaymeWebHookAPIView):\n def handle_created_payment(self, params, result, *args, **kwargs):\n \"\"\"\n Handle the successful payment. You can override this method\n \"\"\"\n print(f\"Transaction created for this params: {params} and cr_result: {result}\")\n\n def handle_successfully_payment(self, params, result, *args, **kwargs):\n \"\"\"\n Handle the successful payment. You can override this method\n \"\"\"\n print(f\"Transaction successfully performed for this params: {params} and performed_result: {result}\")\n\n def handle_cancelled_payment(self, params, result, *args, **kwargs):\n \"\"\"\n Handle the cancelled payment. You can override this method\n \"\"\"\n print(f\"Transaction cancelled for this params: {params} and cancelled_result: {result}\")\n```\n\nAdd a `payme` path to core of urlpatterns:\n\n```python\nfrom django.urls import path\nfrom django.urls import include\n\nfrom your_app.views import PaymeCallBackAPIView\n\nurlpatterns = [\n ...\n path(\"payment/update/\", PaymeCallBackAPIView.as_view()),\n ...\n]\n```\n\nRun migrations\n```shell\npython3 manage.py makemigrations && python manage.py migrate\n```\n\ud83c\udf89 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.\n\n## Generate Pay Link\n\nExample to generate link:\n\n- Input\n\n```python\nfrom payme import Payme\n\npayme = Payme(payme_id=\"your-payme-id\")\npay_link = payme.initializer.generate_pay_link(id=123456, amount=5000, return_url=\"https://example.com\")\nprint(pay_link)\n```\n\n- Output\n\n```\nhttps://checkout.paycom.uz/bT15b3VyLXBheW1lLWlkO2FjLmlkPTEyMzQ1NjthPTUwMDAwMDtjPWh0dHBzOi8vZXhhbXBsZS5jb20=\n```\n\n\n## Generate Fallback Link\n\n\nExample to generate fallback link:\n\n- Input\n\nThe ID in the fallback is different from the merchant ID. You can get the ID from the Payme team.\n```python\nfrom payme import Payme\n\npayme = Payme(payme_id=\"your-payme-id\", fallback_id=\"your-fallback-id\")\n\nform_fields = {\n \"driver_id\": 12345,\n \"amount\": 1000\n}\n\nfallback_link = payme.initializer.generate_fallback_link(form_fields) # form field is optional\nprint(fallback_link)\n```\n\n- Output\n\n```\nhttps://payme.uz/fallback/merchant/?id=examplelinkgenerated&driver_id=12345&amount=1000\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": null,
"version": "3.0.17",
"project_urls": {
"Homepage": "https://github.com/Muhammadali-Akbarov/payme-pkg"
},
"split_keywords": [
"paymeuz",
"paycomuz",
"payme-merchant",
"merchant-api",
"subscribe-api",
"payme-pkg",
"payme-api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "746eb0fc1f930591a6215854e9c93ef15ce8aadd34a984f05bb94dd83625cdf7",
"md5": "624d0486cd0f44cc4ef045f430a0ecc1",
"sha256": "74a866889d3948389b7a111ffb76cd2ed19a06ae580233047855f4c594cd69bc"
},
"downloads": -1,
"filename": "payme_pkg-3.0.17-py3-none-any.whl",
"has_sig": false,
"md5_digest": "624d0486cd0f44cc4ef045f430a0ecc1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24110,
"upload_time": "2024-12-09T08:08:11",
"upload_time_iso_8601": "2024-12-09T08:08:11.151327Z",
"url": "https://files.pythonhosted.org/packages/74/6e/b0fc1f930591a6215854e9c93ef15ce8aadd34a984f05bb94dd83625cdf7/payme_pkg-3.0.17-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c9af6fc31ab71f2be63be6f9162aad38de5a5163a1d653d30cbbbcca475a2324",
"md5": "45fc668d4dd3b2541d38bb7a17482891",
"sha256": "0b66b1a331d8333189283ea06f80d11c4fc93d1a5ef2e5d3ffc6728318b6a111"
},
"downloads": -1,
"filename": "payme_pkg-3.0.17.tar.gz",
"has_sig": false,
"md5_digest": "45fc668d4dd3b2541d38bb7a17482891",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20629,
"upload_time": "2024-12-09T08:08:12",
"upload_time_iso_8601": "2024-12-09T08:08:12.955196Z",
"url": "https://files.pythonhosted.org/packages/c9/af/6fc31ab71f2be63be6f9162aad38de5a5163a1d653d30cbbbcca475a2324/payme_pkg-3.0.17.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 08:08:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Muhammadali-Akbarov",
"github_project": "payme-pkg",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "payme-pkg"
}