Integrate direcpay in website Times of money


How to integrate direcpay in our website

What is directpay?
Direcpay is the online payment gateway for indian merchants. It is one of the first Indian payment solutions providing a credit card payment gateway integrated with debit cards, Net Banking & mobile payments.

Ok, Lets see directly integration of direcpay.

Step 1: Download required file from timesofmoney

dpEncodeRequest.js is required to integrate directpay. So we can download it from below URL.

Step 2: Add Javascript in your checkout file.

We need to add the downloaded dpEncodeRequest.js file in our header and we need to difine encodeTxnRequest function as shown in below.

<script type="text/javascript" src="dpEncodeRequest.js"></script>
function encodeTxnRequest()
document.ecom.requestparameter.value =

Step 3: Add your checkout form in the same checkout file.

Include below code in your body section.Here you can note few things like form action.

Sanbox URL:
Live URL:

And you can note requestparameter. This is mandatory, We can see below sample requestparameter. requestparameter

requestparameter = “Merchant_id | Operating_Mode | Country_Code |
Currency_Code | Amount | Order_no | Other_details | Success_Url | Failure_Url | Collaborator_id”

Example :-

requestparameter = “200904281000001|DOM|IND|INR|10|1335502321695|

Then you need to change your billing address and other personal stuff with dummy placeholder things.

<form name="ecom" method="post"
<input type="hidden" name="custName" value="Code Cocktail Test User">
<input type="hidden" name="custAddress" value="Mumbai">
<input type="hidden" name="custCity" value="Mumbai">
<input type="hidden" name="custState" value="Maharashtra">
<input type="hidden" name="custPinCode" value="400001">
<input type="hidden" name="custCountry" value="IN">
<input type="hidden" name="custPhoneNo1" value="91">
<input type="hidden" name="custPhoneNo2" value="022">
<input type="hidden" name="custPhoneNo3" value="28000000">
<input type="hidden" name="custMobileNo" value="9820000000">
<input type="hidden" name="custEmailId" value="">
<input type="hidden" name="deliveryName" value="Test User">
<input type="hidden" name="deliveryAddress" value="Mumbai">
<input type="hidden" name="deliveryCity" value="Mumbai">
<input type="hidden" name="deliveryState" value="Maharashtra">
<input type="hidden" name="deliveryPinCode" value="400234">
<input type="hidden" name="deliveryCountry" value="IN">
<input type="hidden" name="deliveryPhNo1" value="91">
<input type="hidden" name="deliveryPhNo2" value="022">
<input type="hidden" name="deliveryPhNo3" value="28000000">
<input type="hidden" name="deliveryMobileNo" value="9920000000">
<input type="hidden" name="otherNotes" value="Code Cocktail test transaction for direcpay">
<input type="hidden" name="editAllowed" value="N">

<input type="hidden" name="requestparameter"
<input type="submit" name="submit" value="Submit">

That’s all we are integrated direcpay with our web application.Hit submit button.

We will redirect to the sandbox timesofmoney site here we need to complete the process like billing address, shipping address and pay type ( credit card, debit card, or online transaction)

I shared few screenshot below to make a clear picture about payment process

1.Billing address
2.Shipping address
3.Choose payment type


After completing progress we will get responseparams

DirecPay will send the response back to the merchant in the following format.
Parameter name=responseparams
Format type in case of proper response:
responseparams =direcpayreferenceid|responseflag|country|currency|
otherdetails|merchantorderno|posting amount|

For Example: responseparams=1000001xxxxxxxxx|SUCCESS|IND|INR| details|orderno|100| Format type in case of error in sending response: responseparams=direcpayreferenceid|ERROR|errormessage| For Example: responseparams=1000001xxxxxxxxx|ERROR|

Error may occur due to any of the following reasons:
1. Wrong DirecPay Reference ID
2. Wrong MID
3. Mismatch in the DirecPay Reference ID and MID mapping
4. Database error while fetching the record
5. Server error while fetching the record

We should use the following details to check for DirecPay merchant
interface (on sanbox mode):

Login ID:
PIN: password_0

If your using any e-commerce shopping cart web application like Magento, Joomla virtuemart, Cubecart, Oscommerce, WHMCS, XCART or ZenCart. Then you no need to worry direcpay already provides the corresponding coding to integrate with our web application.

We can find it here.

Download sample code



I hope this will help someone. How this really seek to integrate direcpay in web application. Share with your developer community if this really helps.

Posted in Cocktail and tagged by .

About Gowri

I am professional web developer with 8+ years experience. PHP, jQuery, WordPress, Angular and Ionic are my key skills in web development. I am working with strong enthusiastic team with spirit. We provide all web related solution like HTML/CSS development, Web graphic design and Logo.

16 thoughts on “Integrate direcpay in website Times of money

  1. Pingback: Not matching the Collaborator error on virtuemart direcpay integration - Code Cocktail

  2. dinesh

    Hi, I have worked on direcpay on my client website (Joomla_1.5.25). But there is an error in matching country and city code from my joomla to direcpay page.

  3. Abhilash

    Thank you so much for the effort. I am taken to the payment page, but on trying to make payment through net banking/ cc takes me to an error page with message “Invalid page referer. Direct parameter posting to this page not allowed. Click here to continue.”. Even i tried your code. It has the same issue. All parameters are set.
    I used stage environment.
    Any help would be much appreciated as i haven’t worked on direcpay yet.

  4. Ripos

    I’m using the sample code payment gateway. but I was finding error while decoding the transaction request. Click here, I can’t understand where I can put Requestparameter, Please help me for correct it… my code is given bellow

    function encodeTxnRequest()
    document.ecom.requestparameter.value =

    requestparameter = “200904281000001|DOM|IND|INR|10|1335502321695|

    Please help he for same & tell me where can it put Requestparameter in given Code pls correct it

    1. Head
    2. Body
    3. Form = action
    4. Requestparameter
    5. Input

  5. Rehan Sunasra

    I have a problem regarding the parameter “otherdetails”…
    I am passing the Billing Info & Shipping Info to the payment gateway and the values and properly auto-populated in the fields on the payment gateway page… But when i modify the values and then make the payment, the Payment gateway response is sending me old values instead of the values that is updated…

    Please help !!

    1. Gowri Post author

      Hey Rehan I worked long before on this. I don’t remember. can you please check with payment gateway developer support. Good luck

Comments are closed.