IDEAL ING payment method
Author: Rick De Rooij
Visited 3188,
Followers 1,
Shared 0
Is there a solution yet to integrate ING iDEAL payment into WX5v10?
I really need to combine the two, but I have really lost faith in how to do that.
Posted on the
You have the optionto installanypaymentmethods,by incorporatingthe code forthe provider of thepayment method.
See alsoinhelp forpayment (the variablesfortransfer)
GreetingsJJ
Google Translation from german
Sie haben die Möglichkeit beliebige Zahlungsmethoden einzubauen, indem Sie den Code dafür vom Anbieter der Zahlungsmethode einbauen.
Sehen Sie dazu auch in Hilfe zu Zahlungsart (auch die Variablen für Übergabe)
Gruss JJ
Author
I know, but the code I received from my bank does not work together with the shopping cart sofar. I don't seem to be able to pass the php-variables correctly in the HTML-form.
It is getting frustrating.
Hello Rick,
What happens when you try to use the payment code?
Are you adding the variables [ORDER_NO] and [PRICE] in the correct place in the code you got from the bank?
Many thanks!
Author
The order number is, the price not yet. None of variables is processed at all. So my conclusion sofar is that the php-server is not involved. In the X5 preview mode I have not been able to activate the php server. Furthermore someone told me that it is necessary that the index-file should have the extension .php to tell the php-server that somewhere in the site there is php-code to process.How can I do that in X5 or will that have to be a manual actionn?
Hello Rick,
If you select the shopping cart in step 2 and then you open the properties, in the Expert Tab you can change the name file format to php. To test php pages you will need to export the project on the server, since the preview cannot run PHP files and only on a server it is possible to run them.
Please feel free to write back if you need more information.
Author
I had already changed the extension to .php, but that did not solve the problem. I have put the extra code in a separate file, called Test_144106.php, uploaded that file to my site and then called mlsweetheart.nl\Test_144106.php in my browser. That worked, the php gets handled properly, except, since it is not part of the shopping cart, it does not receive the order_no and price. So, I am pretty much out of options it seems. The code itself works, the php-server works, I put it in the shopping cart (step 4, second tab) at the extra code for the iDEAL payment method at the HTML-code for the 'Pay now'-button and it does not work.
Stop ... It says HTML-code. Is that the problem? Can it only handle HTML-code and no php?
I don't believe that I am the first one to encounter this problem ....
Author
See also http://answers.websitex5.com/post/63359 It is about the same problem ...
Author
I just succeeded in a succesful test transaction, that has been approved by the bank. But, I used a separate page outside X5, since indide X5, the php does not seem to work. But at least I know that the code is syntaxwise and programmingwise correct. That is a major step, but not the whole deal yet.
Author
Last update: I passed all banktests with the separate page. So the code is definitely working, so now I have to make it work from within the shopping cart. As far as I can judge this, that is an X5 problem or even a bug. I hope Incomedia can solve this.
I was thinking that a workaround could be to call an extra page (like the separate test-page) in the last step (http://mlsweetheart.nl/cart/index.php#step4) of the shopping cart and have the extra page do the call to the iDeal system. That would need the two shopping cart variables (AMOUNT and ORDER_NO) to be passed safely and unchangeable by the customer to the extra page. Could that work?
Hello Rick,
Yes this would definitively work. The variables would be only Order Number and Price and you can use a script, as example in javascript with ajax, to grab the variables and send them to the other page.
If you require any further information, please feel free to write back.
Author
Well, I could use some help to get this workaround going. I do not have any experience with javascript in Ajax, so I would appreciate to receive the correct instructions to get this working. Since this would only be a workaround, I would really like to know why the code is not owrking within the shopping cart directly and what Incomedia is going to do to solve that.
And I wonder if the workaround would be perfectly safe with no possible interception, illegal interference or phishing by any illwilling customer.
Hello Rick,
Most payment codes works automatically once added the variables used by the program. We also added the PayPal payment system to simplify the setup of an ecommerce.
Since the the functionality of the custom payment code doesn't depends directly on the program we cannot give support. For the payment code used by your bank you need to ask support to them, since we don't know how this specific code works.
We can try to help you to add it in the program by explaining you where to add it but we cannot give support to a code provided by another.
Many thanks!
Author
Hello Claudio, you must have misinterpret this. The acual php code works fine. I proved that by passing the bank tests succesfully. But the problem arises when I put the same code in the new pay-module provided by the X5 cart. I added the code to: Step 4, shopping cart, second tab (order management), new payment (iDEAL), Type, Pay-now, in the box with 'HTML-code for pay-now button'. Then it does not work anymore.
So please help me to add it to the program, preferably in the cart itself, but as an emergency solution, in the workaround I suggested. I included the code in the php-file Test_los.php. I blanked the hashkey and the merchant_ID, since they are sort of private. But if you would like to test them I can send them to you.
Allora, aiuta me per favore ...
Rick
Author
Dimenticato il file. That does not work either. Why can't I upload a php-file even when it is zipped? It is just 1k.
Author
Well, then I put the verbatim text of the file here, so you can take notice. If you want to try, mlsweetheart.nl/Test_los.php:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$key = 'xxxxxxxxxxx';
$merchantID = '0050xxxxx';
$subID = '0';
$purchaseID = '[130530-QWERT]'; //ORDER_NO
$paymentType = 'ideal';
$validUntil = date('Y-m-d\TH:i:s.000\Z', time()+900);
$itemNumber1 = '1';
$itemDescription1 = 'Uw bestelling bij MLSweetheart.nl';
$itemQuantity1 = 1;
$itemPrice1 = 10 // '[PRICE]';
$amount = $itemQuantity1 * $itemPrice1;
$shastring = "$key$merchantID$subID$amount$purchaseID$paymentType$validUntil"
. "$itemNumber1$itemDescription1$itemQuantity1$itemPrice1";
$shastring = preg_replace(
array("/[ \t\n]/", '/&/i', '/</i', '/>/i', '/"/i'),
array( '', '&', '<', '/>', '"'),
$shastring);
$shasign = sha1($shastring);
$language = 'nl';
$currency = 'EUR';
$description = 'Uw bestelling bij MLSweetheart.nl';
$baseurl = 'http://www.MLSweetheart.nl'
$urlSuccess = "$baseurl/succes.html";
$urlCancel = "$baseurl/afgebroken.html";
$urlError = "$baseurl/fout.html";
?>
<form method="post" action="https://idealtest.secure-ing.com/ideal/mpiPayInitIng.do" name="form1">
<input type="hidden" name="merchantID" value="<?php echo $merchantID; ?>">
<input type="hidden" name="subID" value="<?php echo $subID; ?>">
<input type="hidden" name="amount" value="<?php echo $amount; ?>">
<input type="hidden" name="purchaseID" value="<?php echo $purchaseID; ?>">
<input type="hidden" name="language" value="<?php echo $language; ?>">
<input type="hidden" name="currency" value="<?php echo $currency; ?>">
<input type="hidden" name="description" value="<?php echo $description; ?>">
<input type="hidden" name="hash" value="<?php echo $shasign; ?>">
<input type="hidden" name="paymentType" value="<?php echo $paymentType; ?>">
<input type="hidden" name="validUntil" value="<?php echo $validUntil; ?>">
<input type="hidden" name="itemNumber1" value="<?php echo $itemNumber1; ?>">
<input type="hidden" name="itemDescription1" value="<?php echo $itemDescription1; ?>">
<input type="hidden" name="itemQuantity1" value="<?php echo $itemQuantity1; ?>">
<input type="hidden" name="itemPrice1" value="<?php echo $itemPrice1; ?>">
<input type="hidden" name="urlSuccess" value="<?php echo $urlSuccess; ?>">
<input type="hidden" name="urlCancel" value="<?php echo $urlCancel; ?>">
<input type="hidden" name="urlError" value="<?php echo $urlError; ?>">
<input type="submit" name="submit2" value="Betalen met iDEAL"></form>
</body>
</html>
Hello Rick,
In the payment code the php part of code can be removed and instead of having in the html form as example:
<?php echo $urlError; ?>
you can add the value that you find in the php code directly there so it would look like:
<input type="hidden" name="urlError" value="'" target="_blank" rel="nofollow">http://www.MLSweetheart.nl/fout.html">
instead of:
<input type="hidden" name="urlError" value="<?php echo $urlError; ?>">
Only look after the sections where they have $baseurl where you need to add before http://www.MLSweetheart.nl/
In the line Purchase ID you add this:
<input type="hidden" name="purchaseID" value="[ORDER_NO]">
and in the price lice you add this:
<input type="hidden" name="itemPrice1" value="[PRICE]">
So you will have a payment code completely in HTML since the PHP code is only used to write the variables in the form and it's not using a system to hide these values.
Many thanks!
Author
Ciao Claudio, grazie mille per il tuo risposto!
I still do not understand how I can calculate the shastring that is needed to validate the parameters passed to the bank. Can that be done in HTML code as well? In the string is key, that I have and the bank has, so the bank is able to check the string to see if it has been tampered with and to verify that the values passed ar genuine.
I think that is where the real problem lies:
$shastring = "$key$merchantID$subID$amount$purchaseID$paymentType$validUntil"
. "$itemNumber1$itemDescription1$itemQuantity1$itemPrice1";
$shastring = preg_replace(
array("/[ \t\n]/", '/&/i', '/</i', '/>/i', '/"/i'),
array( '', '&', '<', '/>', '"'),
$shastring);
$shasign = sha1($shastring);
And then in the HTML:
<input type="hidden" name="hash" value="<?php echo $shasign; ?>">
I don't see how to do that in HTML, but I am far from an expert.
This still keeps open the question: why does the php-code not work in the shopping cart, even when the pages appear to be .php? It looks like a bug in X5 to me or am I mistaken?
Rick
Author
Ciao Claudio,
As I see it now there are two solutions:
1. For Incomedia to fix the bug so php-code simply works as expected in the shopping cart. Since that might take some time, there can be a work around ...
2. A small piece of code that actually works and that transfers the two parameters from the shopping cart (PRICE and ORDER_NO) page to a new page, where the real transaction will be handled. I would like you to show me how to transfer those two parameters to the next page and how I have to refer to the two variables using php within the second page.
Could you provide me with those two pieces of code and the exact instructions to implement?
And, of course, when X5 has been repaired, with an alert, so I can put everything back in the shopping cart.
Regards,
Rick
Author
I have found some Ajax-code that seems to be useful:
$.ajax({url: "mlsweetheart.nl/iDEAL_page.php",
type: "post",
data: {
"PRICE=": PRICE,<br /> "ORDER_NO=": ORDER_NO<br /> }})</p> <p>I suppose this should go into the shopping cart (where?), but does it need some activation or altering of the shopping cart page? Is .html ok?</p> <p>Then in the iDEAL-page I have added these code parts to pick up the values:</p> <p>$_SESSION['purchaseID'] = (isset($_POST['ORDER_NO']) ? $_POST['ORDERNO'] : "";
$_SESSION['itemPrice1'] = (isset($_POST['PRICE']) ? $_POST['PRICE'] : "";
It does not work yet, because the Ajax statement is displayed on screen, so please tell me what I am overlooking.
Regards,
Rick
Author
Come on, guys. I am really waiting for this to get it working. I am even considering buying another program to get our website up with iDEAL.
Hello Rick,
You can alternatively add following code in the HTML Code in the cart:
<form action="pay.php" method="post">
<input type="hidden" name="price" value="[PRICE]">
<input type="hidden" name="ordernumber" value="[ORDER_NO]">
<button>Pay now</button>
</form>
You will need to change the value of pay.php with the name of the file where you added the php payment code. This code works if the php file is in the cart folder.
and then in the php code to get the price and the order number you need to add these 2 variables:
$_POST["price"]
$_POST["ordernumber"]
in this way;
$itemPrice1 = $_POST["price"];
$purchaseID = $_POST["ordernumber"];
With this code in Step 4 will appear a Pay now button and after clicking it, it will send the variables to your payment php file and then it will work the code.
Your ajax code has be be inserted between the <script></script> tags and it has to be added in the HTML Code section of the custom payment in Payment Type in the Type Tab.
Hope this helps.
Author
Grazie Claudio!
The first part you mentioned, the <form action ..., that goes into the cart (Step 2, page properties, after the tag </BODY>)? Correct?
Do I still need the Ajax code with your solution or is your solution really meant as an alternative?
Author
Where do I put the Ajax code? Which <script> tags you are referring to?
Author
Claudio, mi dispiace, però non funziona già.
I have put the <form action ..> code into the cart as I described above, changing the name of the php page to the right name, ideal_page.php.
Then I changed the php code as you wrote.
I uploaded the file (ideal_page.php) and put it into the cart-directory manually
I have put the Ajax code in the HTML-section of the custom payment type in the type tab, like you wrote surrounded with the <script> and </script> tags.
Now what happens is: The button appears already in the first step in the bottom left hand corner of the screen. But it is just a button that does not trigger any action.
If you want to see for yourself, the address is: t3st.mlsweetheart.nl.
Regards,
Rick
Hello Rick,
Try to delete from the custom code the ajax code because they have not to be put together. they are alternative you can use.
Use only the form code and add the name of the page you refer. I would suggest instead of adding only the file name, to add the whole url like as example:
http://t3st.mlsweetheart.nl/cart/ideal_page.php
so that the button will also work from the email sent to the customer.
I tested it without the ajax code and it appears only at the end.
Please keep me updated.
Author
Ciao Claudio,
I removed the Ajax code, put in the full url as you wrote me, I only left out the "http://" since I was doubting it to be https, so I am going to try that next. I deleted all files to make a clean upload. Since I have the ideal page as one of the regular hidden pages, I moved it manually to the cart directory. But the effect was none: Already in step#1 the button appears bottom left and it does not trigger any action I can notice.
Since it worked when you tested it, I must miss something.
It stops in the cart page at step#4 ("http://t3st.mlsweetheart.nl/cart/index.html#step4"), so it does not reach the ideal_page.php. So it must be in de form code or in the place I put it. Right?
I put the code in Step 2, special pages, Shopping cart for E-commerce, Properties (or something like that, I am using the Dutch version where it says "Eigenschappen"), Advanced, AFTER TAG </BODY>. Is this the right place?
This is the actual code now:
<form action="http://t3st.mlsweetheart.nl/cart/ideal_page.php" method="post">
<input type="hidden" name="price" value="[PRICE]">
<input type="hidden" name="ordernumber" value="[ORDER_NO]">
<button>BetaalTEST met iDEAL</button>
</form>
I hope you can find where I put in the error.
I attached a picture of the site when on the last page.
Hello Rick,
If your server is not supporting https then it's not necessary to add it. The secure transfer with https has to be made when the customer pays on the bank website. On yours there are not informations that needs to be protected.
You need to remove the code from step 2 and add it in step 4 - shopping cart - in the order management tab under payment type list by doubleclicking on the existing payment type so that a new window will appear and in this window you need to choose the Type tab and then activate Pay Now and from the dropdown list choose "custom code" so you will be able to paste it. I added a screenshot to the post to show you where it goes.
Please feel free to write back if you need more information.
Author
Grazie Claudio, this sure helped much. I moved the code according your instructions. The screen shot made it all very clear.
Now it actually shows the button in the middle (where I like it) and it performs the jump to the final page, the ideal page. But it can't find it. That is strange since I am sure i put in the cart directory. I checked syntax (capitols and such) but it still gives a server error (http-error 500), claiming it can not find the file "ideal_page.php". It says that it has found an unexpected value when calling the page. I send you the screenshots of the error, the placing of the page, the code of the page, the cart code and the directory.
Author
Second file
Author
third file
Author
fourth
Author
fifth
Author
and the last
Author
Ok, I got another step further by splitting the code for the ideal_page to the head and the body part. The code works now, but by moving the page from the root-directory to the cart directory, all site layout is gone (see attachment). So, how do I repair this?
Author
I have been digging in the code that X5V10 produces for the ideal_page.php. Since I have to move this page manually from the root directory to the cart directory, I presume relative links will be a problem. So I started to add to all href-links "../" in front of the links. It turned out that the link to the styletemplate produces both the background/look/feel of the site as well as the error that the button does not work anymore.
<link rel="stylesheet" type="text/css" href="<span class="underline">../style/template.css" media="screen" />
So what can I do now? must I tweak the template.css file as well? That is too much of a hazzle everytime I update the site. What would you suggest?
Regards, Rick
Author
Ciao Claudio,
We have made quite some progress, but I sincerely hope your development team will put iDEAL is a 'standard' configurable pay method in the shopping cart. It would be so much easier and definitely safer than what we try here.
There would be a small numer of variables to configure, like the hashcode, customerID, the bank webaddress and maybe a few more. And then you would have the primary payment system of the Netherlands incorporated. ING and Rabobank are two of the big three banks in my country and they use this system in quite a similar way. I heard the third bank (ABN-AMRO) uses iDEAL slighly different.
I am absolutely willing to help your team with it, I can contribute the ING php.code. I even speak a little Italian...
Hello Rick,
I'm not sure now what exactly you modified in the page. If it's still like in the screenshots, then delete the php code you added in the Cart page in Step 2 and use it only in the ideal php file. The form code will send the variables to the ideal file and then this one will send all to the bank.
About to include this payment form, you can open an IDEA post to suggest it so the Developers, will take it in consideration for the future releases. Unfortunately I cannot tell you if and when it will be implemented since the new functions we add depends also on the request number, since if it's a function that will be used by the most users then this one has a higher priority.
In any case suggest it and if you have also a big part of the code done to make it work, this could be usefull.
Many thanks!
Author
Ciao Claudio,
I already had the php code deleted from the Cart page in Step 2. At the moment the cart page in step 2 only contains the script definition for the X5 engine (for tag </HEAD>) and the iDEAL banner (for tag </BODY>.
The ideal_page (located as shown in the picture ideal_page position.png) contains the php code as shown in ideal page code.PNG. X5 puts the ideal_page.php in the root directory of the site. I move it manually to the /cart directory as you suggested. See Websitedirectory.png. In the cart payment method is the transfer button included as you can see in Cart shot.png.
Then an error occurs, see the error shot.png. I found out it happens because the references are relative to the location of the original file. Since I moved it manually, these references won't work properly. So I changed them manually by adding the substring "../" upfront. That worked fine for most of the links, except for one, the link to this stylesheet:
<link rel="stylesheet" type="text/css" href="<span class="underline">../style/template.css" media="screen" />.
If I do NOT change this reference, the layout is missing most of the site's look and feel (see layout ideal_page.png), but the page still works. When I change that link as well, the look&feel is ok, but the button does not work anymore, so the payment method does not work.
So now I am at a loss. I don't understand why the button stops working and I can't accept a payment page that looks so badly, because any customer will think he is being frauded.
Can you help me out? Regards,
Rick
Hello Rick,
Ok now I understood how you are building it.
As first delete all the code and then proceed in this way:
In the Ideal Page you made in the program add the HTML&Widget Object where you add the payment code of your bank and then in step 2 you open the properties of this page and you change the file format to php and then you set the page to not visible.
then in the cart here you add the payment code you add only the form:
<form action=" Here the link to the page made in WebSite X5 with the payment code" method="post">
<input type="hidden" name="price" value="[PRICE]">
<input type="hidden" name="ordernumber" value="[ORDER_NO]">
<button>BetaalTEST met iDEAL</button>
</form>
In this way it will keep the same style of the other pages and it should send the payment.
Many thanks!
Author
Ciao Claudio, many thanks for your support, but your instructions are a little above my comprehension.
I do not understand what you mean. I should delete ALL code? That looks a bit too radical ...
What do you mean with the HTML&Widget object? Are that the form codes for X5 engine and the iDEAL banner?
Do you mean that the bank code goes out of the ideal_page (Step 2) and into the shopping cart at step 4?
But you also write to add ONLY the form you describe in your message to the shopping cart in step 4? I am confused now ... This is my first website and my first experience with HTML/php. I have quite some programming experience, but this is new for me. Sorry ...
I changed it the way I thought that you meant it. It does not work yet, so I have misunderstood your instructions. In the next messages I will show you the screen shots. First, the ideal_page, format is almost ok, the button and the ideal banner are in the wrong place. But the button doesnot work. See screenshot Result_ideal_page.png.
I have put the code for the ideal banner in the ideal_page.php (Step 2, properties, Advanced, see screenshot ideal_banner.png). The bank code (php) is in the same page, but in the </BODY tag, see screenshot bank_code.png. The page is set to php and is not visible.
In the shopping cart page (Step 2, properties, Advanced) I have removed all code except the X5.engine.boot script, that can not be removed, see screenshot cart_page.png.
In the cart itself (step 4, shopping cart, order management tab under payment type list) I have modified the code for the reference to the ideal_page as you suggested, see screenshot shopping_cart.png.
Where did I go wrong? I really would like to solve this before the weekend ..
Regards, Rick
Author
screenshot ideal_banner.png
Author
screenshot bank_code.png
Author
screenshot cart_page.png
Author
screenshot shopping_cart.png
Hello Rick,
You can send us an email with the project file (the file with .IWZIP extension) as attachment to file@answers.websitex5.com using as Subject “Post 62926 per Claudio D.” so I can directly see the project with all the codes and help you.
If your project size is more than 10 megabytes, you can use online services likewww.wetransfer.com to send us your project.
To export the project you want to send us use the function “Export the Project” in Step 5.
Please let me know as soon as you send it.
Many thanks!
Author
I have sent you the file test.iwzip using wetransfer.com.
Regards,
Rick
Hello Rick,
I tested the code and it seemed to send the correct data like price and Order Number to the ideal payment page.
To make the button to appear in the correct part you don't need to add it in step 2 properties. you will need to delete the code from this section and add it in the page in the HTML&Widget Object. So you will be able to decide where it has to appear.
Remove also the charset function you added because the program uses automatically UTF-8.
Please keep me updated.
Author
Dear Claudio,
I have lost track to which message you are referring to now. What do you mean with the HTML&Widget object?
The procedure works fine in the shopping cart now: There the button appears to go to the iDEAL page inside my website. Then, when you you push that button, you go to the ideal_page, the layout is quite ok, but the button that should bring you to the real ideal pages, that button does not work.
The button script is no longer part of the cart page in step 2, but has been added to the cart in step 4. (I suppose that is what you refer to as the HTML&Widget object, right?)
I have removed the charset function from the ideal_page.
So basically I have to get the ideal_page running ...
Do you know what is wrong with it?
Rick
Author
Ciao Claudio,
I just found out that when I use Internet Explorer V9, it actually works, but when I use my standard browser (Iron, based on Chrome), it does not.
When I do a page inspect, I can see that all the variables have been given their proper values, but strangely the button does not work.
Is this a setting in Iron or are the browsers so different?
Regards,
Rick
Author
Checked with firefox and on different computers.
With Firefox does not either, only with IE. Tested that from different computers.
So, why does it work on IE but not on the other browsers??
Good news: The code does work though ....
Hello Rick,
I tested it locally with Firefox and Chrome and it was working so there must be something that is not making it work now.
I made an order test to check it with firefox an I was in the html code that the order number and price was sent correctly.
What i meant before was to open the ideal_page.php in step 2 and copy and then delete the payment code you added in the expert tab in Properties and then paste this code in the same page but in step3 in the HTML&widget Object so you will be able to decide where it has to appear.
The code will be not influenced in any way by this operation.
Many thanks!
Author
Ciao Claudio,
Non so essattemente la ragione, però sembra a funzionare. Pfff.
Grazie mille!
Now I have to put all the resulting code in the real site and test it again. I probably will have some questions on the layout of the button, but this is a major step forwards.
I still have the offer for you to cooperate in making it a standard payment method inside the shopping cart. So please email me if you want that.
Regards,
Rick
Hello Rick,
Thank you very much for your offer. We will take it in consideration.
For any further question, write me anytime.
Many thanks!