Coder Social home page Coder Social logo

kapital-bank-payment-gateway's Introduction

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)

-> pip install requests

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="12345/TAKSIT=5", lang="AZ")
>>> print(result)

For PreAuth Request use pre_auth=True (default is False) More information about PreAuth

Result:

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

Example (Complete/Reverse PreAuth Order):

>>> result = gateway.complete_order(order_id=12345, session_id="A12345",amount=10\
description='54321',lang="AZ")
>>> print(result)
'00'
>>> result = gateway.reverse_order(order_id=12345, session_id="A12345"\
description='54321',lang="AZ")
>>> print(result)
'00'

complete order description change order description (54321)

reverse order description append to original order description (1234554321)

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')

Example (Get Order Information):

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

Result:

returns PaymentInformation object

>>> PaymentInformation(order_id=12345, session_id='A12345', order_type='Purchase' state='CREATED', amount=10, order_description='12345/TAKSIT=5', fee=0, create_date=datetime.datetime(2022, 5, 21, 3, 45, 4), pay_date=datetime.datetime(2022, 5, 21, 3, 45, 31))

Methods

Example: get_payment()

>>> payment_obj = gateway.get_payment()
>>> payment_obj
>>> Payment(amount=10, order_id=12345, session_id='A12345', payment_url='https://e-commerce.kapitalbank.az/index.jsp'\
status_code='00',order_description='12345/TAKSIT=5', 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')

Example: get_payment_information()

>>> payment_information_obj = gateway.get_payment_information()
>>> payment_information_obj
>>> PaymentInformation(order_id=12345, session_id='A12345', order_type='Purchase' state='CREATED', amount=10, order_description='12345/TAKSIT=5', fee=0, create_date=datetime.datetime(2022, 5, 21, 3, 45, 4), pay_date=datetime.datetime(2022, 5, 21, 3, 45, 31))

kapital-bank-payment-gateway's People

Contributors

arzuhuseyn avatar zakirabdulla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.