# Ksher SDK for Python
[![Python Package](https://github.com/ksher-solutions/ksher_sdk_python/actions/workflows/python-publish.yml/badge.svg)](https://github.com/ksher-solutions/ksher_sdk_python/actions/workflows/python-publish.yml)
[![Version](https://img.shields.io/pypi/v/ksher)](https://pypi.org/project/ksher/)
Ksher payment SDK for Python.
📄 **Documentation**: [API Reference](http://api.ksher.net)
## Available SDKs
Ksher SDK is available in multiple languages:
- **Java**: [Ksher SDK (Java)](https://github.com/ksher-api/ksher-sdk/tree/master/java)
- **Python**: [Ksher SDK (Python)](https://github.com/ksher-solutions/ksher_sdk_python)
- **Go**: [Ksher SDK (Go)](https://github.com/ksher-api/ksher-sdk/tree/master/go)
- **PHP**: [Ksher SDK (PHP)](https://github.com/ksher-api/ksher-sdk/tree/master/php)
- **.NET Core**: [Ksher SDK (.NET Core)](https://github.com/ksher-api/ksher-sdk/tree/master/netcore)
- **Node.js**: [Ksher SDK (Node.js)](https://github.com/ksher-solutions/ksher_sdk_nodejs)
---
## 📦 Installation
There are two ways to install this package:
### Option 1: Install via Pip
```sh
pip install ksher
```
### Option 2: Clone and Install Manually
#### Step 1: Clone the Repository
```sh
git clone https://github.com/ksher-solutions/ksher_sdk_python.git
```
#### Step 2: Navigate and Install Dependencies
```sh
cd ksher_sdk_python
pip install -r requirements.txt
pip install .
```
Alternatively, install locally with:
```sh
pip install ./ksher_sdk_python --user
```
---
## 🚀 How to Use
First, initialize the payment object to perform various payment actions:
- **Initialize Payment Object**
- **Create New Order**
- **Query Order Status**
- **Refund an Order**
### 🔹 Redirect API (Default)
To use the **Redirect API**, initialize as follows:
```python
from ksher.ksher_pay_sdk import KsherPay
appid = "mch35000"
privatekey = "/path/to/mch_privkey.pem"
pubkey = "/path/to/ksher_pubkey.pem"
payment_handle = KsherPay(appid, privatekey, pubkey)
data = {
"total_fee": "100",
"fee_type": "THB",
"mch_code": "",
"refer_url": "http://www.example.com",
"mch_redirect_url": "http://www.example.com/success",
"mch_redirect_url_fail": "http://www.example.com/fail",
"mch_notify_url": "http://www.example.com/notify",
"product_name": "",
"channel_list": "promptpay,linepay,airpay,truemoney,atome,card,ktc_instal,kbank_instal,kcc_instal,kfc_instal,scb_easy,bbl_deeplink,baybank_deeplink,kplus,alipay,wechat,card,ktc_instal,kbank_instal,kcc_instal,kfc_instal"
}
data['mch_order_no'] = "HelloWebsite"
resp = payment_handle.gateway_pay(data)
```
### 🔹 C_Scan_B API (QR Code Payment)
To use the **C_Scan_B API**, specify the API type when initializing:
```python
from ksher.ksher_pay_sdk import KsherPay
appid = "mch35000"
privatekey = "/path/to/mch_privkey.pem"
pubkey = "/path/to/ksher_pubkey.pem"
payment_handle = KsherPay(appid, privatekey, pubkey)
data = {
"mch_order_no": "202208101150",
"total_fee": "100",
"fee_type": "THB",
"channel": "promptpay",
"notify_url": "http://www.example.com/notify"
}
data['mch_order_no'] = "HelloKiosk"
resp = payment_handle.native_pay(data)
```
---
## 📌 Notes
- Ensure that the `appid`, `privatekey`, and `pubkey` are correctly set.
- Replace URLs with your actual endpoint URLs.
- `pubkey` inside SDK, The file name is `ksher_pubkey.pem`. This value is optional, you not need to pass with it.
- Use the correct `channel_list` based on your integration.
---
📖 For full documentation, visit [Ksher API Docs](http://api.ksher.net).
Raw data
{
"_id": null,
"home_page": "https://github.com/ksher-solutions/ksher_sdk_python",
"name": "ksher",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Ksher, ksher, ksher-payment, ksher-payment-api, ksherpay",
"author": "Ksher",
"author_email": "support@ksher.com",
"download_url": "https://files.pythonhosted.org/packages/ab/da/f1a8307b4b902653ae6e4c3798d85ee9090b273ad81d73d06dd499a92f1d/ksher-1.0.0.tar.gz",
"platform": null,
"description": "# Ksher SDK for Python\n\n[![Python Package](https://github.com/ksher-solutions/ksher_sdk_python/actions/workflows/python-publish.yml/badge.svg)](https://github.com/ksher-solutions/ksher_sdk_python/actions/workflows/python-publish.yml)\n[![Version](https://img.shields.io/pypi/v/ksher)](https://pypi.org/project/ksher/)\n\nKsher payment SDK for Python.\n\n\ud83d\udcc4 **Documentation**: [API Reference](http://api.ksher.net)\n\n## Available SDKs\nKsher SDK is available in multiple languages:\n- **Java**: [Ksher SDK (Java)](https://github.com/ksher-api/ksher-sdk/tree/master/java)\n- **Python**: [Ksher SDK (Python)](https://github.com/ksher-solutions/ksher_sdk_python)\n- **Go**: [Ksher SDK (Go)](https://github.com/ksher-api/ksher-sdk/tree/master/go)\n- **PHP**: [Ksher SDK (PHP)](https://github.com/ksher-api/ksher-sdk/tree/master/php)\n- **.NET Core**: [Ksher SDK (.NET Core)](https://github.com/ksher-api/ksher-sdk/tree/master/netcore)\n- **Node.js**: [Ksher SDK (Node.js)](https://github.com/ksher-solutions/ksher_sdk_nodejs)\n\n---\n\n## \ud83d\udce6 Installation\n\nThere are two ways to install this package:\n\n### Option 1: Install via Pip\n```sh\npip install ksher\n```\n\n### Option 2: Clone and Install Manually\n#### Step 1: Clone the Repository\n```sh\ngit clone https://github.com/ksher-solutions/ksher_sdk_python.git\n```\n\n#### Step 2: Navigate and Install Dependencies\n```sh\ncd ksher_sdk_python\npip install -r requirements.txt\npip install .\n```\n\nAlternatively, install locally with:\n```sh\npip install ./ksher_sdk_python --user\n```\n\n---\n\n## \ud83d\ude80 How to Use\nFirst, initialize the payment object to perform various payment actions:\n- **Initialize Payment Object**\n- **Create New Order**\n- **Query Order Status**\n- **Refund an Order**\n\n### \ud83d\udd39 Redirect API (Default)\nTo use the **Redirect API**, initialize as follows:\n```python\nfrom ksher.ksher_pay_sdk import KsherPay\n\nappid = \"mch35000\"\nprivatekey = \"/path/to/mch_privkey.pem\"\npubkey = \"/path/to/ksher_pubkey.pem\"\n\npayment_handle = KsherPay(appid, privatekey, pubkey)\ndata = {\n \"total_fee\": \"100\",\n \"fee_type\": \"THB\",\n \"mch_code\": \"\",\n \"refer_url\": \"http://www.example.com\",\n \"mch_redirect_url\": \"http://www.example.com/success\",\n \"mch_redirect_url_fail\": \"http://www.example.com/fail\",\n \"mch_notify_url\": \"http://www.example.com/notify\",\n \"product_name\": \"\",\n \"channel_list\": \"promptpay,linepay,airpay,truemoney,atome,card,ktc_instal,kbank_instal,kcc_instal,kfc_instal,scb_easy,bbl_deeplink,baybank_deeplink,kplus,alipay,wechat,card,ktc_instal,kbank_instal,kcc_instal,kfc_instal\"\n}\ndata['mch_order_no'] = \"HelloWebsite\"\nresp = payment_handle.gateway_pay(data)\n```\n\n### \ud83d\udd39 C_Scan_B API (QR Code Payment)\nTo use the **C_Scan_B API**, specify the API type when initializing:\n```python\nfrom ksher.ksher_pay_sdk import KsherPay\n\nappid = \"mch35000\"\nprivatekey = \"/path/to/mch_privkey.pem\"\npubkey = \"/path/to/ksher_pubkey.pem\"\n\npayment_handle = KsherPay(appid, privatekey, pubkey)\ndata = {\n \"mch_order_no\": \"202208101150\",\n \"total_fee\": \"100\",\n \"fee_type\": \"THB\",\n \"channel\": \"promptpay\",\n \"notify_url\": \"http://www.example.com/notify\"\n}\ndata['mch_order_no'] = \"HelloKiosk\"\nresp = payment_handle.native_pay(data)\n```\n\n---\n\n## \ud83d\udccc Notes\n- Ensure that the `appid`, `privatekey`, and `pubkey` are correctly set.\n- Replace URLs with your actual endpoint URLs.\n- `pubkey` inside SDK, The file name is `ksher_pubkey.pem`. This value is optional, you not need to pass with it.\n- Use the correct `channel_list` based on your integration.\n\n---\n\n\ud83d\udcd6 For full documentation, visit [Ksher API Docs](http://api.ksher.net).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "python implementation for Khser Payment API.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/ksher-solutions/ksher_sdk_python"
},
"split_keywords": [
"ksher",
" ksher",
" ksher-payment",
" ksher-payment-api",
" ksherpay"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0e5e6d81181b94b0461a5811bb49079efca0046d359251e3522b642ff82d5510",
"md5": "3aaa4a1095a0f123aef212d03e17b66f",
"sha256": "367c4d93a20890032e2c1d04c8c942c0d689bf4926969c9031a4f7774628733d"
},
"downloads": -1,
"filename": "ksher-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3aaa4a1095a0f123aef212d03e17b66f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3552,
"upload_time": "2025-01-30T11:26:33",
"upload_time_iso_8601": "2025-01-30T11:26:33.579107Z",
"url": "https://files.pythonhosted.org/packages/0e/5e/6d81181b94b0461a5811bb49079efca0046d359251e3522b642ff82d5510/ksher-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "abdaf1a8307b4b902653ae6e4c3798d85ee9090b273ad81d73d06dd499a92f1d",
"md5": "dc26d567ec26c821f257c22770305558",
"sha256": "9dff1b8f0676cea9c2fc66fb3a015ebc358fce117c29c53032beffe1a4e3eb54"
},
"downloads": -1,
"filename": "ksher-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "dc26d567ec26c821f257c22770305558",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3641,
"upload_time": "2025-01-30T11:26:35",
"upload_time_iso_8601": "2025-01-30T11:26:35.120971Z",
"url": "https://files.pythonhosted.org/packages/ab/da/f1a8307b4b902653ae6e4c3798d85ee9090b273ad81d73d06dd499a92f1d/ksher-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-30 11:26:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ksher-solutions",
"github_project": "ksher_sdk_python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ksher"
}