Python-Ansar

Bank Ansar API

Download as .zip Download as .tar.gz View on GitHub

Welcome to the Python-Ansar wiki!

Summery:

Connect your application to Iran Bank Ansar payment gateway

Install?

1- Download this package from main page and run : python setup.py install
2- sudo pip install pyansar

Methods :

1- reverse_transaction
2- logout
3- verify
4- settlement

Where is reserve id? (payment_token??)

In this gateway there is NO payment_token! Just post user with data to bank page

Usage :

After user payment, on your post back page : from PyAnsar.API import AnsarAPI
api = AnsarAPI('username', 'password')
POST data contains the keys
res = api.verify('bank_reference_number')
res[0] => True or False: Shows if the payment was success
res[1] => Touple: (amount, bank_ref_code)

When Should I Reverse?

If the amount of paid price was not equal to invoice price you can reverse transaction.
reverse_transaction(amount, ref_num, rev_num)

saeed auditore