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.
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.
Thank you for your appreciation, I’m just sharing what i learned today interestingly from my job. On my own.
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 …
@Ramkumar : You may missed some parameter in your request. You can refer this link for more detail http://www.docstoc.com/docs/9651984/Merchant-Integration
If we are already passing the details of a customer into hidden values, Why the same customer would need to place the same information again while being redirected to https://test.timesofmoney.com/direcpay/jsp/home.jsp ?? There must be some work around..
Pingback: Not matching the Collaborator error on virtuemart direcpay integration - Code Cocktail
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.
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.
Hi gowri,
I’m newbie in PHP,
I’m using the sample code payment gateway working fine in localhost,but in my server it is not working, can you explain me the solution.
Url: https://test.direcpay.com/direcpay/secure/dpTransactionErrorNew.jsp?errorCode=isDecoded
Error is —>Error while decoding the transaction request.
please revert me.
Esai,
Have a look at this document to find the what issue you are facing.
http://catchway.biz/clonesnscripts/DPintegrate/Integration_FAQ.pdf
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
Hi i am getting Jboss error while i try to deploy this code anyone help me how do fix this
can i change header and footer ?
and add website header and footer while on trasaction process.
pls let me know thank’s
manish
Hello Manish,
I think you can do it. But I don’t remember, I worked very long before.
-Gowri
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 !!
Hey Rehan I worked long before on this. I don’t remember. can you please check with payment gateway developer support. Good luck
Thanks gowri.But I have one doubt.How I can get response from direcpay?