Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Ksher will shut down the API connection via .vip.ksher.net. That make new register merchant will unable to use system over .vip.ksher.net.
Merchants are currently connected, Please change the API to connection http://api.ksher.net.
This is python sdk for integrating your python application with Ksher Payment Gateway. Please refers to our official api document here
Python 3.7
Ksher Payment API Account
API_URL
API_TOKEN
The Payment SDK for accessing *.vip.ksher.net
there are two option two install this package;
pip install ksherpay
git clone https://github.com/ksher-solutions/payment_sdk_python
cd payment_sdk_python
pip install -r requirements.txt
pip install .
or if you want to pip install from local please use
pip install ./payment_sdk_python --user
you need to first init the payment object and that you can use it to;
ksherpay have multiple api (apiType) such as;
you can read about it here
currently this python sdk support only two api; 'redirect api' and 'c scan b api'
the default api is redirect api you can just init it like this
from ksherpay import Payment
API_URL = 'https://sandboxbkk.vip.ksher.net'
API_TOKEN = testtoken1234
payment_handle = Payment(base_url=API_URL, token=API_TOKEN)
to use 'C_Scan_B API', you need to specified it when init the object
as shown in the code, please use ksherpay package's provided value to specified the apiType value
from ksherpay import Payment, API_TYPE
API_URL = 'https://sandboxbkk.vip.ksher.net'
API_TOKEN = testtoken1234
payment_handle = Payment(base_url=API_URL, apiType=API_TYPE.CSCANB, token=API_TOKEN)
to use 'B_Scan_C API', you need to specified it when init the object
as shown in the code, please use ksherpay package's provided value to specified the apiType value
from ksherpay import Payment, API_TYPE
API_URL = 'https://sandboxbkk.vip.ksher.net'
API_TOKEN = testtoken1234
payment_handle = Payment(base_url=API_URL, apiType=API_TYPE.BSCANC, token=API_TOKEN)
to use 'Finance API', you need to specified it when init the object
as shown in the code, please use ksherpay package's provided value to specified the apiType value
from ksherpay import Payment, API_TYPE
API_URL = 'https://sandboxbkk.vip.ksher.net'
API_TOKEN = testtoken1234
payment_handle = Payment(base_url=API_URL, apiType=API_TYPE.FINANCE, token=API_TOKEN)
data = {
"mid": "35618",
"signature": "string",
"timestamp": "string"
}
resp = payment_handle.settlements.channels(params=data)
In early phase of implementation. You might want to disable Sign Verification to debug on other thing without the need to worry if the bug is coming for signature.
*** for Security purpose, don't forget to enable this sign verification back first before going on Production environment.
to disable sign you simply do this;
from ksherpay import Payment
API_URL = 'https://sandboxbkk.vip.ksher.net'
API_TOKEN = testtoken1234
payment_handle = Payment(base_url=API_URL, token=API_TOKEN, verify=False)
merchant_order_id need to be unique or else the request will end with error
to create new order, each apiType has slightly different required parameters
data = {
"amount": 100,
"merchant_order_id": "OrderId000001",
"channel": "linepay,airpay,wechat,bbl_promptpay,truemoney,ktbcard",
"note": "string",
"redirect_url": "http://www.baidu.com",
"redirect_url_fail": "http://www.baidu.com"
}
resp = payment_handle.order.create(data)
print(resp.status_code) # this should return 200
for 'C_Scan_B API', redirect_url is not needed and you can specified one channel at a time.
data = {
"amount": 100,
"merchant_order_id": "OrderId000001",
"channel": "truemoney",
"note": "string",
}
resp = payment_handle.order.create(data)
print(resp.status_code) # this should return 200
merchant_order_id = 'OrderId000001'
resp = payment_handle.order.query(merchant_order_id)
print(resp.status_code) # this should return 200
Refund_id need to be unique or else the request will end with error
merchant_order_id = 'OrderId000001'
refund_id = "Refund_" + merchant_order_id
data = {
'refund_amount':100,
'refund_order_id':refund_id
}
resp = payment_handle.order.refund(merchant_order_id,params=data)
print(resp.status_code) # this should return 200
FAQs
python implementation for Khser Payment API.
We found that ksherpay demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.