Introduced in Feature Pack 1

Customizing the Boleto payment method

Create Java classes in the WebSphereCommerceServerExtensionsLogic project to customize the Boleto payment method. For the developer environment, create the classes under the WebSphereCommerceServerExtensionsLogic project. After the development work is done, you can package and deploy the project into the WebSphere Commerce instance.

About this task

Sample code is provided to help you customize the Boleto payment method. The sample code is written in adherence to the jBoleto open source libraries. Review the licenses for these packages before you use them. If you want to use a different Boleto generation library, you can use the sample code that is provided as a model.


  1. Copy the required Java JAR files to the store library.
    Download the following files:
    • iText-version.jar, where version is the latest version of the file. This file is downloadable from iText.
    • jBoleto.jar, which is downloadable from jboleto.jar.
    • jbarcodebean.jar, which is downloadable from JBarcodeBean.
    Put the files into the following path:
    • WC_eardir/Stores/WebContent/WEB-INF/lib
    • WebSphere Commerce Developerworkspace_dir/wc/Stores.war/WEB-INF/lib
  2. Fix a bug in the jBoleto.jar file.
    The jBoleto code generates the Linha digitável (human-input number) incorrectly in certain scenarios due to a conversion error. Use the following steps to fix this bug.
    1. Download the jboleto-src.tar.gz file from the Boleto website and extract it.
    2. Find the file file, which is in the source code under the path src, in the package org\jboleto.
    3. Search for code that contains replace or replaceAll String methods ()
    4. Replace the following string:
      For example, change:
      valor = valor.replace(",","").replace(".","");
      valor = valor.replace(",","").replace("\\.","");
    5. Compile the changed code, and update the JBoletoBean.class to the jBoleto.jar.
  3. Write the class that is used to calculate the due date.
    In the package, create the task command that is based on the attached sample files, , and, then implement the logic of calculating the due date. Usually, the logic is to use the current date plus the "days_pay_boleto" configured when you configure the merchant to access the Boleto payment method.
  4. Write the logic that is used to read merchant properties that you will use when you configure the merchant to access the Boleto payment method.
    In the package, create the classes that are based on the attached sample files,, and These files are used to read the merchant properties when you configure the merchant to access the Boleto plug-in.
  5. Write a scheduler command to update the payment on WebSphere Commerce, according to the results of the Boleto payment processing from the bank.
    Write the command that is based on the attached sample files, and These sample files provide a simple example to demonstrate how to update the order status. Customize them based on the actual bank interface and reliability requirements.
  6. After the command is ready, change the struts-config-ext.xml of the SiteAdministration.
    1. Open the struts-config-ext.xml file in the following path:
      • WC_eardir/SiteAdministration.war/WEB-INF
      • WebSphere Commerce Developerworkspace_dir/wc/SiteAdministration.war/WEB-INF
    2. Add the following action mapping:
              path="/BoletoPaymentOrderStatusUpdate" type="">
              <set-property property="https" value="0:0"/>
              <set-property property="authenticate" value="0:0"/>
  7. Configure the command as a scheduler as follows:
    1. Open an SQL command console.
    2. Run the following SQL statement:
      insert into SCHCMD (schcmd_id, storeent_id, pathinfo) values (100,STOREENT_ID,'BoletoPaymentOrderStatusUpdate');
      where STOREENT_ID is the store ID.
    3. Run the following SQL statement and make note of the CHKCMD_ID.
      select * from CHKCMD;
    4. Run the following SQL statement:
      insert into CHKARRANG (chkcmd_id, schcmd_id) values (-1, 100);
      where chkcmd_id is the CHKCMD_ID that you noted.
  8. Schedule the BoletoPaymentOrderStatusUpdate job.
    The scheduler reads the payments status information from the boletoPayments.xml file. For each payment, the scheduler updates that payment status from pending to either failed or success, according to the status in the boletoPayments.xml file. Put the boletoPayments.xml file under the path:
    • WC_eardir/wasprofile
    • WebSphere Commerce Developerworkspace_dir/wc/profiles/instance_name
    The following is an example of the format that is used in the boletoPayments.xml file:
    <!-- status codes: 0 (success), 1 (failed) -->
  9. Check if there is WebSphereCommerceServerExtensionsLogic.jar file already in the path WC_eardir/.