Tuesday 19 April 2016

PayU payment gateway integration with Django

  Introduction  


         This Blog is describes the steps for technical integration process between merchant website and PayU Payment Gateway for enabling online transactions. This Blog is covered payment gateway integration with Django Framework.

PayU Payment Gateway


      PayU offers electronic payment services to merchant website through its partnerships with various banks and payment instrument companies. Through PayU, the customers would be able to make  

Electronic payments through a variety of modes which are mentioned below:

  • Credit cards
  • Debit cards
  • Online net banking accounts
  • EMI payments
  • Cash Cards
  • Email Invoicing
  • IVR
  • Cash on Delivery (COD)


PayU also offers an online interface (known as PayU Dashboard) where the merchant has access to various features like viewing all the transaction details, settlement reports, analytical reports etc.Through this interface, the merchant can also execute actions like capturing, cancelling andrefunding the transactions. This online interface can be accessed through Payu using the username and password provided to you.

Payment Gateway Process Flow 





PayU payment Gateway Process Flow





Steps for Integration Process

The steps for integrating with PayU can technically be described as below:

1)   To start off the integration process, you would be provided a test setup by PayU where you
would be given a test merchant account and test credit card credentials to have a first-hand
experience of the overall transaction flow. Here, you need to make the transaction request
on our test server (and not the production server). Once your testing is complete, then only
you will be ready to move to the PayU production server.

2)   To initiate a transaction, the merchant needs to generate a POST REQUEST - which must
consist of mandatory and optional parameters mentioned in the later section. This POST
REQUEST needs to be hit on the below mentioned PayU URLs:

Test Url                     :  https://test.payu.in/_payment
Production(live) Url : https://secure.payu.in/_payment

3)   In the merchant initiated POST REQUEST, one of the mandatory parameters is named as
hash. The details of this hash parameter have been covered in the later section. But it is
absolutely critical for the merchant to calculate the hash correctly and post to us in the
request.

4) When the transaction POST REQUEST hits the PayU server, a new transaction entry is
created in the PayU Database. To identify each new transaction in the PayU Database, a
unique identifier is created every time at PayU’s end. This identifier is known as the PayU ID
(or MihPayID).

5) With thPOST REQUEST, customer would be re-directed to PayU’s payment page. Customer now selects the particular payment option on PayU’s page (Credit Card/Debit Card/NetBanking etc) and clicks on ‘Pay Now’. PayU re-directs the customer to the chosen bank. Thecustomer goes through the necessary authorization/authentication process at bank’s login page, and the bank gives the success/failure response back to PayU.

6) PayU marks the transaction status on the basis of response received from Bank. PayU
provides the final transaction response string to the merchant through a POST RESPONSE.
The parameters in this response are covered in the subsequent sections.

7) In the POST RESPONSE sent by PayU, you would receive the final status of the transaction.
You will receive the hash parameter here also. Similar to step 3, it is absolutely crucial to
verify this hash value at your end and then only accept/reject the invoice order. This is done
to strictly avoid any tampering attempt by the user.

Note : 
Test URL: The Test URL is provided to PayU merchants to test the integration of their  server with that of PayU or Bank. It is understood that since this is merely a Test URL, the Merchant should not treat any transactions done on this Test server as live and should not deliver the products/services with respect to any such test transactions even in the case your server receive a successful transaction confirmation from PayU/Bank.

Merchants are herein forth requested to set up required control checks on their               (merchant) systems/servers to ensure that only those transactions should get routed to the  PayU test server which are initiated with sole intention of test the environment.

PayU payment Gateway Integration with DJANGO

Onces you create the account With Payu they will provide salt and secretkey. we need this two
credentials for the payment gateway integration

Parameters to be posted by Merchant to PayU in Transaction Request:

  •  key (Mandatory)
  • txnid (Mandatory)
  • amount(Mandatory)
  • productinfo(Mandatory)
  • firstname(Mandatory)
  • email (Mandatory)
  • phone (Mandatory)
  • lastname
  • Udf1-Udf5
  • address1
  • city
  • state
  • country
  • zipcode
  • surl(Mandatory)
  • furl(Mandatory)
  • curl(Mandatory)
  • hash(Checksum)Mandatory)     :sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT)
  • Udf : user defind field
  • Surl : Sucess URL ( Success redirection URLs ) 
  • Furl : Failure URL ( Failure redirectio URLs )
  • Curl : Cancelation URL( cancelation URLs)
Sample Code : payupayment sample code

No comments:

Post a Comment