- Importing the necessary elements
- Modifying the "backtostore" page
- Adding location code
- Customizing the payment page
- The "Pay" link
- Other links: where to put the code that registers the payment?
- Payment test
- The elements to deploy for the payment
- Common problems
- Error: The return page did not return the expected result
- After deployment, a message appears: "Order to be put on hold with human intervention required"
- How to enable the logs (WLOG) and read them?
How to include secure payment in a WEBDEV website? Importing the necessary elements - Open your WEBDEV project.
- Import the "WW_SecurePayment" external component.
- On the "Project" tab, in the "Project" group, expand "Import" and select "An External component .. From a file".
- Specify the path of the desired WDI file. In our case, this file corresponds to "SecurePayment.wdi", located in the WEBDEV subdirectory: "\Components\Example components\WW_SecurePayment\Exe\Component".
- The component description window is displayed. Close this window.
- To get a database for including the secure payment, we advise you to import 2 specific pages into your project:
- On the "Project" tab, in the "Project" group, expand "Import" and select "WEBDEV elements and their dependencies".
- Select the import directory. This directory corresponds to the directory of the WW_Payment_sécurise component in the WEBDEV sub-directory: "Components\Example components\WW_PaymentSecurise"
- The list of pages is displayed.
- Select:
- The page corresponding to the secure payment solution to use. The name of this page starts with "PAGE_Secure_Payment_XXX". For example: "PAGE_Payment_Securise_ATOS.wwh".
- The "backtostore.wwh" page.
- Validate. The pages are imported into the project.
- Recompile the project to take these pages into account: in the "Project" pane, in the "Project" group, pull down "Recompile and synchronize" and select "Recompile the project and generate the HTML pages".
Modifying the "backtostore" page - Open the "backtostore" page in the editor.
- This page contains an Internal Page control named "IPAGE_RETURN".
- Open the description window of "IPAGE_RETURN".
- In the "General" tab, modify the internal page linked to the field: replace "PI_Payback" with "SecuredPayment.PI_Payback".
- Save the page (
). - Save a copy of this page with a custom name: under the "Home" pane, in the "General" group, pull down "Save" and select "Save as".
- In the window that is displayed, specify the new page name and validate.
Note: Personalizing this page with a specific name increases payment security. - Make sure that this page is not referenced:
- Open the description window of the renamed page.
- On the "Details" tab, check "Do not allow SEO".
- Confirm changes and close the description window.
You must add, at the beginning of the project code (in the "Initialization in pre-launched session mode" event, for example), the code allowing the component to locate the payment file and to define its password. This code is as follows: <BLOCK Location of file for the secure payment component> //To trace on the server if necessary //dbgEnableLog(fDataDir()+["\"]+"paymentlog_[%Date%]_[%Time%].wlog",LogAll) //Location of payment file DataParameters(fDataDir() + "\Payment", "file password to customize") // //or using a connection, for example: // gcntCSDatabase is connection // gcntCSDatabase..Provider=hAccessHFClientServer // gcntCSDatabase..User="admin" // gcntCSDatabase..server="127.0.0.1" // gcntCSDatabase..Database="mydatabase" // DtaParameters("Payment","file password to customize", ... // gcntCSDatabase, "PasswordDatabaseConnection") <END>
Customizing the payment page - Open the "PAGE_Secure_Payment_xxx" page where xxx corresponds to the payment solution that will be used. In this example, we will use the "PAGE_Secure_Payment_ATOS.wwh" page
- Delete the "Question mark" button that references an information page that was not imported into this project.
- For ATOS only:
- Delete the "IMG_BANK" Image control whose image was not imported into this project.
- Delete the code that relates to the "IMG_BANK" control in the global declarations of the page.
- Adjust the page type according to the type of page you want in your project: Session, AWP, Zoning mode, Responsive mode, ...
- For ATOS, make sure that the target of "Pay" link is the "IFRM_PAYMENT" iFrame.
The "Pay" link This link contains the code that triggers the secure payment. 1. Parameters specific to the bank account The parameters specific to the bank account must be specified in this code. The information differs according to the selected payment solution. Your project contains a specific page corresponding to the desired payment: in the code of this link, you will find a code adapted to the type of payment chosen. This code contains explanatory comments specific to the requested parameters. Example for ATOS: - A "company code" must be specified:
- You must also replace the files found in the subdirectory whose name relates to the secure payment solution used by the files supplied by the bank. In this example, the files in the "Mercanet" subdirectory previously copied are: pathfile, parmcom.08258434141111, parmcom.mercanet and certif.fr.082584341411111
Example for Lyra (Systempay, Cyberplus, Spplus, Payzen, etc.): You must specify: - a "site identifier": MyPayment:SiteIdentifier
- a certificate number MyPayment:Certificate.
This information can be found in the back-office site, in the store setting, "Certificates" tab. 2. Name of "server-to-server" return page (also known as IPN: Instant Payment Notification)In this code, the name of IPN page must be replaced with the custom page name. For example: MyPayment:IPN Page="custompagenameforthereturns2s" becomes: MyPayment:IPNPage="RETURN_S2S_B6SH7ZEX" Depending on the selected payment solution, the URL at which this page will be accessible must be specified in the bank back-office. This URL has the following format: http://<domain>/<Site name>_WEB/<Language>/<Page name>.awp Example: - Using a return page (named "RETURN_S2S_B6SH7ZEX") for a WEBDEV website that is named "shop" and that is deployed on a server with the domain name "www.mydomain.eu" in English:
http://www.mydomain.eu/SHOP_WEB/EN/RETURN_S2S_B6SH7ZEX.awp - In the back-office site for the Lyra solution, you must go into the store setting. On the "Configuration" tab, "Return URL" section, ENABLE the option "Notification URL at the end of payment".
Attention Do not enter your payment completion management code on these pages. Your code for managing the end of payment must be found in "the link for going back to the store" and in "the return link from server to server" (this topic will be explained in the rest of this document). 3. Images of cards for ATOS For ATOS, the images of bank cards may not be displayed. In this case: - Open the code of the "Pay" link.
- Add the following code after the declaration of MyPayment variable:
MyPayment is SecurePayment(nBank) // Existing line MyPayment.FolderWebLogo = FolderWeb() + "/SecurePayment/EN/ATOS/"
4. Other customizations You can also edit other details. Follow the instructions in the comment of the "Pay" link. Depending on the payment solutions, you can: - specify the invoicing address.
- specify the delivery address.
- specify the basket content.
- specify some types of credit cards.
- create subscriptions.
- ...
The "FormParameterAdd" method is used to modify or add information into the form sent to the bank. For more details, see the documentation of selected payment. Other links: where to put the code that registers the payment? Two other links are found in the page: - The "Back to store" link:
The code of this link is run when the Web user ends his payment, no matter whether it is successful or not, when he goes back to the site. Attention Some Internet users never return to the merchant site, for example because of a handling error or a cut in their Internet access. However, in test mode, on a computer not accessible by the bank server, it is the only code that is run. - The "Server to Server Return" link (also known as "IPN": Instant Payment Notification)
The code of this link is run when the Web user validates his payment on the bank site before he decides to go back to the merchant site or not. Warning This code is executed via a direct call to the bank's server, i.e. without any context, cookies, session, etc., on the part of the Internet user. In development, in test mode, on a computer not accessible by the bank server, this code is not run.
Where to position the code that saves the payment? One of the best solutions is to place the code that saves the payment in the code associated with both links "Back to store" and "IPN" but with small variations. - In the "Return Server to Server" link code: in this code, the payment should normally be recorded, the database updated and, for example, an email sent with the invoice. But in test mode, this code doesn't run: the focus is complex.
- In the "Back to store" link code: check that the server-to-server return has already been recorded, except in test mode. Otherwise, the payment must be saved as being in anomaly and it must be checked.
If information must be displayed to the Web user further to payment, continue ; or if you want to ask him for new information, this can be done in this code.
To test the payment, you can: - Start the imported page directly,
- Add a code that will launch the imported page and pass the necessary elements to the page as parameters: amount to be paid, payer's email, test or actual payment, etc.
What changes once the site is deployed? Once the site is deployed on a server, the IPN must be run in addition to the return to the store as previously explained. When the tests are validated, you will have to change the option specifying that it is a test payment and indicate that the payments are now real. The elements to deploy for the payment During deployment, you must exclude from deployment the HFSQL "Transaction" data files containing test transactions carried out locally: Error: The return page did not return the expected result This error may occur once the site is deployed. It means that the component unsuccessfully tried to access the 'back to store' page or the 'IPN' page. The main reasons are: - Case 1: In the project initialization code, there is a code that forces the display of a specific page on another page if certain parameters are not received.
- Case 2: The server's network parameters do not allow it to join itself.
To find a solution: - Check this URL in your browser:
http://www.mydomain.eu/MYSITE_WEB/EN/backtostore.awp?TEST=O by replacing : - "www.mydomaine.eu" by the site name or IP address,
- "MYSITE" by the name of the site project,
- "backtostore" by the name of the 'back to store' page then by the name of the IPN page.
- The test of this URL must display OK
- If the test shows OK the problem is probably linked to the server's network configuration (case 2). Make sure that the component does not run this test by enabling the following line of code (that must be already found but in comment):
MyPayment.IgnoreTestReturnPage = True
- If the test displays another pageyou're probably in case 1: you need to check the project code and make sure that no page display is forced (function PageDisplay). And for example, don't perform this action in AWP mode (InAWPMode).
- If the test displays an error, you must find the origin of this error.
- If none of the previous cases matches, enable the logs (wlog) to understand what happens.
After deployment, a message appears: "Order to be put on hold with human intervention required" This message may appear when going back to the site after payment when the received information indicates that the payment was validated but that the IPN was not saved. The IPN being performed in deployment only, this message cannot be displayed in test mode. To find a solution: - Check this URL in your browser:
http://www.mydomain.eu/MYSITE_WEB/EN/customipnpage.awp?TEST=O by replacing : - "www.mydomaine.eu" by the site name or IP address,
- "MYSITE" by the name of the site project,
- "customipnpage" by the name of return page then by the name of IPN page.
- If the test displays:
- another page, check the project code to see whether a page display is not forced in some cases (PageDisplay). And for example, don't perform this action in AWP mode (InAWPMode).
- an error, you must find the origin of this error.
- OK or if none of the previous cases matches, check te transaction log in the "Transactions" table, "LogInfo" item. This log can also be retrieved by TransactionLog, TransactionLogAccordingToID programmatically.
How to enable the logs (WLOG) and read them? The log creation (WLog) is a WLanguage feature that is used to save in a file all lines of code that are run in a WLOG file with more or less details. To do so, you must use dbgEnableLog. If you read this document carefully, in the project code, there is a line for which the comments can be removed: dbgEnableLog(fDataDir()+["\"]+"paymentlog_[%Date%]_[%Time%].wlog", LogAll)
In case of difficulty, you must: - Enable the logs.
- Deploy the site (if the problem occurs in deployment only).
- Perform the operation that triggered the problem again.
- Get the WLOG files to open them with WEBDEV.
Please note WEBDEV will not show all the information in the WLOG files: it will only show the information in the active configuration of the project open in the editor. - No information will be displayed if no project is opened.
- If your project is opened, you will see the lines of code run by your project.
- If the project of secure payment component is opened with the configuration of enabled component, you will see the lines of code run by the component.
Warning: Don't leave logs permanently activated: this may slow down the site and quickly take up disk space. To avoid having to recompile the site in order to enable the logs, the activation can be triggered according to an information in a setting file for example. For example: IF Val(INIRead("PARAMETER", "WLOG", "0" , fDataDir() + ["\"] + "param.ini")) = 1 THEN dbgEnableLog(fDataDir() + ["\"] + "paymentlog_[%Date%]_[%Time%].wlog", LogAll) END
|
|
|