ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / How to proceed? / Programming
  • Importing the necessary elements
  • Modifying the "backtostore" page
  • Adding location code
  • Customizing the payment page
  • The "Pay" link
  • The other links: where to position the code that saves 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 indicates: "Pending order with human intervention required"
  • How to enable the logs (WLOG) and read them?
How to include secure payment in a WEBDEV site?
Importing the necessary elements
  1. Open your WEBDEV project.
  2. 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.
  3. 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 WW_Secure_payment component found in the WEBDEV subdirectory: "Components\Example components\WW_SecurePayment"
    • 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_Secure_Payment_ATOS.wwh".
      • The "backtostore.wwh" page.
    • Validate. The pages are imported into the project.
  4. Recompile the project to take these pages into account: on the "Project" tab, in the "Project" group, expand "Recompile and synchronize" and select "Recompile project and generate HTML pages".
Modifying the "backtostore" page
  1. Open the "backtostore" page in the editor.
  2. This page contains an Internal Page control named "IPAGE_RETURN".
  3. Open the description window of "IPAGE_RETURN".
  4. In the "General" tab, modify the internal page linked to the control: replace "IPAGE_Payback" by "SecurePayment.IPAGE_Payback".
  5. Save the page ().
  6. Save a copy of this page with a custom name: on the "Home" tab, in the "General" group, expand "Save" and select "Save as".
  7. In the window that is displayed, specify the new page name and validate.

    Remark: Customizing this page with a specific name increases the payment security.
  8. Make sure that this page is not referenced:
    • Open the description window of the renamed page.
    • In the "Details" tab, check "Do not allow SEO".
    • Validate the description window.
Adding location code
You must add, at the beginning of the project code (in the "Initialize project after connecting to the site" 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
  1. 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
  2. Delete the "Question mark" button that references an information page that was not imported into this project.
  3. 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.
  4. Adjust the type of page according to the type of page that will be used in your project: Session, AWP, Zoning mode, Responsive mode, etc.
  5. 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 selected type of payment. This code contains explanatory comments specific to the requested parameters.
Example for ATOS:
  • A "company code" must be specified:
    MyPayment:CompanyCode
  • 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 found in the "Mercanet" subdirectory: 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 return page from "server to server" (also called 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 site 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. In the "Configuration" tab, "Return URL" section, ENABLE the option "Notification URL at the end of payment".
Caution: your code for managing the end of payment must not be found in 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:
  1. Open the code of the "Pay" link.
  2. 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.

The other links: where to position the code that saves 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.
    Caution: Some Web users never go back to the merchant site, further to an operating error or to an Internet failure for example. However, in test mode, on a computer not accessible by the bank server, it is the only code that is run.
  • The "Return from Server to Server" link (also called "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.
    Caution: This code is run via a direct call to the bank server, therefore outside any context, cookies, session, ... of the Web 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 code of the "Send to server" link: in this code, you must save the payment, update the database and send an email with the invoice. However, this code is not run in test mode: the implementation is complex.
  • In the code of the "Back to store" link: you must check that the return from server to server was already saved, 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.
Payment test
To test the payment, you can:
  • Start the imported page directly,
  • Add a code that will start the imported page and pass as parameter the necessary elements to the page: amount due, buyer email, test or real 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 the deployment, you must exclude from deployment the HFSQL "Transaction" files that contain the test transactions performed locally:
Common problems

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 of another page if some parameters are not received.
  • Case 2: The network parameter of server do not allow it to join itself.
To find a solution:
  1. 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.
  2. The test of this URL must display OK
    • If the test displays OK: the problem may be linked to the server 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 page, you probably are in case 1: check the project code and make sure that no page display is forced (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 indicates: "Pending order 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:
  1. 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.
  2. 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 through programming.

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:
  1. Enable the logs.
  2. Deploy the site (if the problem occurs in deployment only).
  3. Perform the operation that triggered the problem again.
  4. Get the WLOG files to open them with WEBDEV.
Caution: WEBDEV will not display the entire information found in the WLOG files: it will only display the information regarding the active configuration of project opened 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.
Caution: The logs should not be left enabled on a permanent basis: this may slow down the site and reduce the 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
Minimum version required
  • Version 23
Comments
Click [Add] to post a comment

Last update: 06/12/2023

Send a report | Local help