How to integrate PayUMoney payment gateway in Django

In this article we will see how to integrate PayUmoney payment gateway in your Django app.

Steps:

– Register with PayUMoney.Com as seller/merchant. Fill your details in the form and submit.
– Select the product Payment Gateway.


– On the next screen select your Business filing status, Business Name and kind of business. Name of Bank Account Holder should be same as Business Name.
– Similarly complete the next few steps and get your salt and keys.
– You will need to provide your PAN card details, Bank Account Details and Address for account to activate.
– Once above details are provided, you will receive a confirmation call from payumoney and you will require to send the document to them. After that your account will be fully active.

Once above steps are complete and your account is waiting for documents, we can proceed and work on coding part.

Code:

– Create HTML page for payment. Display all the information on the page. For simplicity, I am not displaying editable information on the page. Amount, Email Id of payer and other details are already fetched from system. You may add editable fields.

– Please pay attention to the fields. Must include fields are – key, txnid, hash, amount, email, firstname, phone, productinfo, surl (success url), furl (failure url) and service provider.

Django PayUmoney Payment gateway

–  Now write your view. I have provided the appropriate comment above the line in code in view.py  file.

– Constants file content.

– Config file content.

– Then we need to add URLs to url.py  file.

– Add appropriate content in success.html  and failure.html  templates.

– Hash string is generated as :

where udf1 to udf10 are user defined fields which you might want to send as post data from payment form.

– Once ‘Pay Now’ button is clicked, page is redirected to payumoney site and success or failure page is displayed at the end based on transaction status.

Points to remember:

– Most frequently faced error is ‘checksum failed’. Make sure you have included all the fields in your form and hash string.
– Amount should be float and not an integer or string in form.
– Use absolute URL values for surl  and furl .
– It is advisable to use constant and config files.
– If you are using test URL to test payment and receiving error, make sure your test account is activate and use the SALT and KEY of test account. Contact customer care service to activate test account.

Why PayUMoney:

– Easy Integration.
– Fix charges per transaction.
– No account setup fee.
– Great customer care support.

Create PayUMoney merchant account.

After your web app is completed, you might want to host it. PythonAnyWhere is the best hosting service provider exclusively for Python-Django hosting.

Hosting Django app on PythonAnyWhere Server for free.

 

(Visited 1,355 times, 1 visits today)

You must read this :

4 thoughts on “How to integrate PayUMoney payment gateway in Django”

Leave a Reply

Your email address will not be published. Required fields are marked *