Integrate direcpay in website Times of money

on with 16 Replies

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.

http://www.timesofmoney.com/direcpay/downloads/dpEncodeRequest.zip

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>
<script>
function encodeTxnRequest()
{
document.ecom.requestparameter.value =
encodeValue(document.ecom.requestparameter.value);
document.ecom.submit();
}
</script>

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: https://test.timesofmoney.com/direcpay/secure/dpMerchantTransaction.jsp
Live URL: https://www.timesofmoney.com/direcpay/secure/dpMerchantTransaction.jsp

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|
None|http://test.timesofmoney.com/direcpay/secure/merchant.jsp|
http://test.timesofmoney.com/direcpay/secure/merchant.jsp|TOML”

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

<form name="ecom" method="post"
action="https://test.timesofmoney.com/direcpay/secure/dpMerchantTransaction.jsp"
onSubmit="encodeTxnRequest();">
<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="yourmail@gmail.com">
<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"
value="200904281000001|DOM|IND|INR|12|cocktail-order|others|http://yoursite.com/success.html|
http://yoursite.com/fail.html|TOML">
<input type="submit" name="submit" value="Submit">
</form>

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

responseparams

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|
wrongdirecpayreferenceid

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):

URL: https://test.timesofmoney.com/direcpay/jsp/home.jsp
Login ID: demo@direcpay.com
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

Documentation

 

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 4+ years experience. PHP, jQuery, WordPress, Magento and Symfony2 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. ramkumar

    hi ..i have worked on direcpay on my client website (Joomla_1.5.23
    virtueMart_1.1.9-COMPLETE_PACKAGE.j15) .i have followed those steps given by direcpay (http://www.timesofmoney.com/direcpay/jsp/dpShoppingCart.jsp)for joomla shopping cart.and also configured it in admin panel . but i got error in (https://test.timesofmoney.com/direcpay/jsp/home.jsp) payment page. ” invalid referrer “. what can i do ??? please if you have any idea please share …

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

  3. 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.

    Reply
  4. Abhilash

    Hi
    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.

    Reply
  5. Ripos

    Dear,
    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 =
    encodeValue(document.ecom.requestparameter.value);
    document.ecom.submit();
    }

    requestparameter = “200904281000001|DOM|IND|INR|10|1335502321695|
    None|http://test.timesofmoney.com/direcpay/secure/merchant.jsp|
    http://test.timesofmoney.com/direcpay/secure/merchant.jsp|TOML”

    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

    Reply
  6. 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 !!

    Reply
    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

      Reply

Leave a Reply to dinesh Cancel reply

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