Python-Django integration kit for pay with easebuzz pay.easebuzz.in
setup python-django kits on test/development/production environment install below software
- pip
- python 2.7
- Django 1.11
- requests 2.18.4
We strongly recommend to set up this kits inside virtual environment to avoid any conflict with your's existing projects.
- virtualenv
Once set up python environment then follow below steps
-
clone paywitheasebuzz-python-django-lib on your's system.
-
unzip paywitheasebuzz-python-django-lib.
-
using virtual environment
-
go to your's python environment folder using terminal or command prompt.
- active environment using below command.
source bin/activate
- goto paywitheasebuzz-python-django-lib kit folder and run command like
python manage.py runserver
- type URL: http://127.0.0.1:8000/
- active environment using below command.
-
-
without virtual environment
- goto paywitheasebuzz-python-django-lib kit folder.
- run the below command.
python manage.py runserver
- type URL: http://127.0.0.1:8000/
- goto paywitheasebuzz-python-django-lib kit folder.
- copy and paste easebuzz_lib folder in your's project directory.
- include easebuzz_payment_gateway.py file in your's views.py file.
from easebuzz_lib.easebuzz_payment_gateway import Easebuzz
- set MERCHANT_KEY, SALT, and ENV.
MERCHANT_KEY = "10PBP71ABZ2"; SALT = "ABC55E8IBW"; ENV = "test"; // "test for test enviroment or "prod" for production enviroment
- create Easebuzz class object and pass MERCHANT_KEY, SALT and ENV.
easebuzzObj = Easebuzz(MERCHANT_KEY, SALT, ENV)
- call Easebuzz class methods or function based on your's requirements.
-
Initiate Payment API POST Format and call initiatePaymentAPI
postDict = { 'txnid': 'T3SAT0B5OL', 'firstname': 'jitendra', 'phone': '1231231235', 'email': 'jitendra@gmail.com' 'amount': '1.03', 'productinfo': 'Apple Mobile', 'surl': 'http://localhost:8000/response/', 'furl': 'http://localhost:8000/response/', 'city': 'aaaa', 'zipcode': '123123', 'address2': 'aaaa', 'state': 'aaaa', 'address1': 'aaaa', 'country': 'aaaa', 'udf1': 'aaaa', 'udf2': 'aaaa', 'udf3': 'aaaa', 'udf4': 'aaaa', 'udf5': 'aaaa' } final_response = easebuzzObj.initiatePaymentAPI(postDict) result = json.loads(final_response) if result['status'] == 1: # note: result['data'] - contain payment link. return redirect(result['data']) else: return render(request, 'response.html', {'response_data': final_response})
-
Transaction API POST Format and call transactionAPI
postDict = { 'txnid':'T300', 'amount':'1.03', 'phone':'1231231235', 'email':'jitendra@gmail.com' } final_response = easebuzzObj.transactionAPI(postDict) return render(request, 'response.html', {'response_data': final_response})
-
Transaction API (by date) POST Format and call transactionDateAPI
postDict = { 'merchant_email':'jitendra@gmail.com', 'transaction_date':'06-06-2018' } final_response = easebuzzObj.transactionDateAPI(postDict) return render(request, 'response.html', {'response_data': final_response})
-
Refund API POST Format and call refundAPI
postDict = { 'txnid':'T300', 'refund_amount':'0.9', 'phone':'1231231235', 'amount':'1.03', 'email':'jitendra@gmail.com' } final_response = easebuzzObj.refundAPI(postDict) return render(request, 'response.html', {'response_data': final_response})
-
Payout API POST Format and call payoutAPI
postDict = { 'merchant_email':'jitendra@gmail.com', 'payout_date':'06-06-2018' } final_response = easebuzzObj.payoutAPI(postDict) return render(request, 'response.html', {'response_data': final_response})
-
Response of Inititate Payment API
Initiate Payment API response will be sent on success URL or failure URL using HTTP form post.
final_response = easebuzzObj.easebuzzResponse(request.POST) return render(request, 'response.html', {'response_data': final_response})
-