PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK

  • Importing the necessary elements
  • Modifying the "backtostore" page
  • Retrieving specific elements associated with the secure payment
  • 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
  • Most 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" pane, in the "Project" group, expand "Import" and select "An external component .. From the file".
    • Specify the path of requested WDI file. In our case, this file corresponds to "SecurePayment.wdi" found in the WEBDEV sub-directory: "\Components\Example components\WW_SecurePayment\Exe\Component".
    • The description window of component 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" pane, 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 sub-directory: "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" pane, in the "Project" group, expand "Recompile and synchronize" and select "Recompile the project".
Modifying the "backtostore" page
  1. Open the "backtostore" page in the editor.
  2. This page contains an Internal Page control named "IPAGE_RETURN".
  3. Display the description window of "IPAGE_RETURN" control.
  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" pane, in the "General" group, expand "Save" and select "Save as".
  7. In the window that is displayed, specify the new page name and validate.

    Note: Customizing this page with a specific name increases the payment security.
  8. Make sure that this page is not referenced:
    • Display the description window of renamed page.
    • In the "Details" tab, the option "Don't reference" must be checked.
    • Validate the description window.
Retrieving specific elements associated with the secure payment
Depending on the secure payment solution used, directories must be retrieved in the "Exe\Example" directory of secure payment component.
For ATOS, you must retrieve:
  • the "ATOS_Windows" directory if the site is going to be deployed in Windows,
  • the "ATOS_Linux" directory if the site is going to be deployed in Linux.
  • depending on the bank, the sub-directory named like the bank solution. For example, "Mercanet" for the Mercanet solution proposed by BNP.
These sub-directories must be copied into the data directory, by default the "Exe" sub-directory in development.
Adding location code
You must add, at the beginning of the project code (in the "Initializing the project after connection 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 ths example, we will be using 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: dynamic, AWP, zoning mode, Responsive mode ...
  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 requested 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 sub-directory 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" sub-directory : 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 by 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 "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 also have the ability to customize various information, follow the instructions given in the comment of "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 bank cards.
  • perform subscriptions.
  • ...
The "FormParameterAdd" method is used to modify or add information into the form sent to the bank.
See the documentation of selected payment for more details.

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 in 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 :
When using the ATOS solution:
  • You must include the ATOS, Windows or Linux executables according to the server where the site is deployed, in a <site> sub-directory that must be called "ATOS_Windows" for a Windows server and "ATOS_Linux" for a Linux server :

    Caution: for a deployment in Linux, you will have to add execution rights onto the deployed executables.
  • You must also include the specific configuration files ("certif.fr...", "paramcom...") by specifying <data> in destination directory as well as the name of solution sub-directory (given by programming in the payment link with the PathFile property).
Most 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 initialization code of project, 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 site project,
    • "backtostore" by the name of 'back to store' page then by the name of IPN page.
  2. The test of this URL must display OK
    • If the test displays OK: the problem may be linked to the network configuration of server (case 2). Make sure that the component does not run this test by enabling the following code line (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 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 by 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 code lines 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 code lines run by your project.
  • If the project of secure payment component is opened with the configuration of enabled component, you will see the code lines 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