ughurguliyev / Kapital-Bank-Payment-Gateway

simple python app for Kapital Bank Payment API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kapital-Bank-Payment-Gateway

Kapital Bank Payment Gateway for python based projects.

Compatibility

Tested on Python 3.8+

Get Started

First step: set your crt and key files path as environment variables. (SEE .env file)

Example (Create Order):

>>> from kapital_gateway import KapitalPayment
>>> 
>>> gateway = KapitalPayment(
>>>        merchant_id="E1000010",
>>>        approve_url="https://test.com/approve",
>>>        cancel_url="https://test.com/cancel",
>>>        decline_url="https://test.com/decline",
>>>    )

>>> result = gateway.create_order(amount=10, currency=944, description="Test", lang="AZ")
>>> print(result)

Result:

>>> {'url' : 'https://e-commerce.kapitalbank.az/?ORDERID=12345&SESSIONID=A12345'}

Example (Check Order Status):

>>> result = gateway.get_order_status(order_id=12345, session_id="A12345", lang="AZ")
>>> print(result)

Result:

returns PaymentStatus object

>>> PaymentStatus(order_id=12345, status_code='00', state='CREATED')

Methods

Example: get_payment()

>>> payment_obj = gateway.get_payment()
>>> payment_obj
>>> Payment(amount=123456, order_id=12345, session_id='A12345', payment_url='https://e-commerce.kapitalbank.az/index.jsp', status_code='00',order_description='xxxxxx', currency=944, language_code='RU')

Example: get_payment_status()

>>> payment_status_obj = gateway.get_payment_status()
>>> payment_status_obj
>>> PaymentStatus(order_id=12345, status_code='00', state='CREATED')

(C) Arzu Hussein

About

simple python app for Kapital Bank Payment API


Languages

Language:Python 98.9%Language:Shell 1.1%