Add-ons and ModulesDocdata PSP

Docdata PSP

Sana Commerce 8.2
Your provider

Configure a Test Docdata Payment Module

In order to add the Docdata payment module to a project, please undertake the following steps:
Step 1: Request a test account from Docdata.

Step 2: Copy the 'Sana.Commerce.Payment.DocData.dll', 'Sana.Commerce.Payment.DocData.pdb' and 'Sana.Commerce.Payment.DocData.xml' files from the 'bin' folder of the Docdata add-on package to the 'Frontend/bin' folder of Sana Commerce.

Step 3: Configure the Sana Commerce frontend to use the Docdata payment module. This configuration is performed in the 'web.config' file of the Sana Commerce frontend:

  • Locate the 'DocData configuration section.txt' file in the 'configuration' folder, which contains the Docdata payment module configuration section;

  • Copy the whole text of this file into the <payment-configuration> section of the 'web.config' file, so it will look as follows:
<module name="DocData" type="Sana.Commerce.Payment.DocData.DocDataPaymentModule, Sana.Commerce.Payment.DocData">
        <clear />
        <add name="ResponseUseXml" value="false" isRequestParameter="false" />
        <add name="ResponseUsePost" value="true" isRequestParameter="false" />
        <add name="merchant_name" value="…" isRequestParameter="true" />
        <add name="merchant_password" value="…" isRequestParameter="false" />
        <add name="profile" value="…" isRequestParameter="false" /> 
        <add name="days_pay_period" value="14" isRequestParameter="false" />
        <add name="PostUrl" value=" isRequestParameter="false"  />
        <add name="statusUrl" value="" isRequestParameter="false" />
        <add name="PaymentPage" value="" isRequestParameter="true" />
       <add name="return_url_success" value="checkout/ordersubmit.aspx?id=" isRequestParameter="true" />
       <add name="return_url_canceled" value="checkout/Ordercancelled.aspx?id=" isRequestParameter="true" />
       <add name="return_url_pending" value="checkout/ordersubmit.aspx?id=" isRequestParameter="true" />
       <add name="return_url_error" value="checkout/orderfailed.aspx?id=" isRequestParameter="true" />
       <add name="DebugDomains" value="localhost" isRequestParameter="false" />
       <add name="DebugConfirmUrl" value="checkout/PaymentConfirm.aspx?id={0}" isRequestParameter="false" />

For an explanation of the configuration values, please read this chapter and the chapter 'DocData specific configuration values' below and the chapter 'General External Payment Method Configuration Values'.

Step 4: Configure the Docdata payment methods. There are two ways to do this:

  • Configure the Docdata payment methods in the Sana Commerce backoffice. For more information read this chapter.

  • Configure the DocData payment methods by executing the 'ConfigureDocDataInDB.sql' SQL script on the Sana Commerce database.
    The 'ConfigureDocDataInDB.sql' SQL script will add the 'American Express card', 'Master card', 'Ideal' and 'Banktransfer' payment methods.
    These payment methods will be available for all countries configured in the system. No translations for the payment methods will be set by this script - this should be done manually.

  • Before executing the script make sure that you have changed the '@siteId' variable (if needed) to match the appropriate website identifier and check whether the currency is correct.

    After the script has been executed, all fields should be checked for the correct values. By default the script makes these new payment methods active by setting the 'Active' field value to 'true' in the database. Therefore these payment methods will be immediately available on the frontend.

    Keep in mind that this script assigns each payment method to a separate payment profile. In the Sana Commerce database check that the names of the payment profiles in the 'PaymentMethods' table (the 'ExternalParameter' column) match the names of the payment profiles as configured in the Docdata backoffice.

Step 5: In the 'web.config' file of the Sana Commerce frontend modify the merchant_name and merchant_password to the merchant name and password you have received from Docdata. (Note that the password differs from the password used for logging into the Docdata backoffice.)

Step 6: Log into the Docdata backoffice and configure or verify payment profiles. This can be done under 'Settings -> Edit Payment profiles'. Each payment method must be configured under a separate profile. You can find the configured profiles in the following place in the Docdata backoffice (marked by the red box):

Configuring Payment Methods in the Docdata Backoffice 

Step 7: Check in the Sana Commerce backoffice (Settings -> Payment methods) that correct values are set in the 'PSP code' and 'PSP profile name' fields for Docdata payment methods. On the screenshot below you can see an example of the 'Master Card' Docdata payment method configured:

The 'Master Card' Docdata Payment Method in Sana Commerce Backoffice

Note that the values of the 'PSP code' field should match the identifiers of appropriate payment methods in the Docdata backoffice. Also, the values of the 'PSP profile name' field should match the names of appropriate payment profiles in the Docdata backoffice (see previous screenshot also).

If the value of the 'PSP profile name' field is not set for a certain payment method, then the system will use the default payment profile, which is specified in the DocData module configuration in the 'web.config' file of the Sana Commerce frontend. In the example below, the value of the default profile name in configuration is set to 'standard':

<add name="profile" value="standard" isRequestParameter="false" />  
In order to test the payment flow in the development environment, there are two possible scenarios:
  • The development machine/server cannot be accessed externally by the Docdata server (most common scenario): in this case add all domains used by the development server in the 'DebugDomains' setting in the 'web.config'. Multiple domains can be separated by the ',' character. This will make it possible to test the whole flow of a test payment, when the confirm page cannot be reached by Docdata. This setting is for debugging purposes only and should not be used in any live situation.
  • The development machine/server can be accessed. In this case you can configure Docdata to test the payment flow. Remove the 'DebugDomains' setting from the payment module configuration. In the Docdata backoffice configure the correct URL's under 'Settings -> View/Edit merchant profile > URL':

    Configuring URL Settings 
Configure URLs in the following way:
Name Value
 Return URL success  http://<domain>/checkout/ordersubmit.aspx?id=
 Return URL canceled  http://<domain>/checkout/orderfailed.aspx?id=
 Return URL error  http://<domain>/checkout/orderfailed.aspx?id=
 Return URL pending  http://<domain>/checkout/ordersubmit.aspx?id=
 Update URL  http://<domain>/checkout/paymentconfirm.aspx?id=

Step 8: Find the 'files' folder, where the Docdata payment method icons are stored. Copy the 'files' folder to 'Frontend\content\'. These icons will be displayed on the frontend in the payment method selection control.

Step 9: When all the changes are made, in the Sana Commerce backoffice click 'Refresh site cache'.

Step 10: Test the payment/checkout flow to see if everything works fine, using the newly configured payment methods and the correct payment statuses that are set.

Add-ons and ModulesDocdata PSP