Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Helper for the KASS <https://www.kass.is/>
_ payment gateway. Written for python 3.8.5 (probably works on versions >= 3.6).
See the KASS API docs <https://kass.github.io/api/>
_ for more info.
This module is not affiliated with KASS.
Here is a short guide to get you started.
This will dispatch a payment to the KASS API.
.. code-block:: sh
poetry add kass-flow
pip install kass-flow
.. code-block:: python
from kass_flow.kass import KassBilling from kass_flow.interfaces import KassRequestPaymentDict
kass_token: str = "some-token" kass_url: str = "https://api.kass.is/v1/payments" instance = KassBilling(kass_token, kass_url)
payload: KassRequestPaymentDict = { "amount": 2199, "description": "Kass bolur", "image_url": "https://photos.kassapi.is/kass/kass-bolur.jpg", "order": "ABC123", "recipient": "7798217", "terminal": 1, "expires_in": 90, "notify_url": "https://example.com/callbacks/kass", }
result, is_valid = instance.dispatch(payload)
When the recipient cancels or pays the requested order KASS will send a callback to the notify_url
\ , which you need to catch on your server and probably validate the signature that is included in the POST payload.
At some point in time the user will pay/reject the requested order. Here is an example on how to validate the payload.
.. code-block:: python
from kass_flow.kass import KassBilling from kass_flow.interfaces import KassRequestPaymentDict
def some_view_that_handles_kass_callback(request): payload = request.data kass_token: str = "some-token" kass_url: str = "https://api.kass.is/v1/payments" instance = KassBilling(kass_token, kass_url)
if instance.is_signature_valid(payload):
# process the payload.
.. code-block:: sh
pip install poetry # to manage envs yourself poetry config virtualenvs.create false poetry install pytest tests
If you are using VSCode for development there is a .vscode/settings.example.json
for sensible defaults. Since mypy is used you need to install the mypyls
language server.
.. code-block::
poetry install "https://github.com/matangover/mypyls/archive/master.zip#egg=mypyls[default-mypy]"
pip install "https://github.com/matangover/mypyls/archive/master.zip#egg=mypyls[default-mypy]"
FAQs
Library to manage payments using the KASS API
We found that kass-flow 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.