Worldpay for FinDock

Worldpay is a global Payment Service Provider that provides processing of Card payments. The Worldpay for PaymentHub package provides integration with the Worldpay corporate service. This service allows not only one-off payments, but also supports recurring bulk credit card transactions and as such is more suitable for larger volumes.

Multi-merchantMulti-currency
nono
Payment MethodOne-timeRecurringRefunds
Credit Cardyesyesyes

Installation and Activation

Follow the standard procedure for installing and activating the Worldpay for Findock payment extension.

Configuration

After activation of the Payment Extension, you will need to do some configuration to connect it to your account.

Configuration for callbacks

In order to correctly receive the callbacks from Worldpay with regards to transactions, you will need to configure a Salesforce Site to receive these message. If you haven't already, Follow the steps outlined in the article Configuring a Salesforce Site to correctly configure the base site.

Next, we need to add the Worldpay specific callback processor to the site. This callback processor will receive the updates from Worldpay and make sure payments are correctly registered in the system. Navigate to the Site's configuration page in the Salesforce setup screen.

Navigate to sites using the quick search

In the list of sites, click the name of the site you wish to use to process callbacks. On the site detail page, click the Public Access Settings button to edit the security for this site. A Salesforce Profile Details page will open. On this detail page, click Apex Class Access.

Site Apex class access

On the page that opens, you can allow the site access to the worldpay callback processor. Click the Edit button to change the Enabled Apex Classes.

Add Worldpay callback processor

From the list of Available Apex Classes, select the wpayc.WorldPayCallback class and click the add button to add it to the Enabled Apex Classes. Click Save to store the new configuration. Now that you have configured the Site, return to the site detail page, and take note of the site URL. Use the secure.force.com url whenever it's available to ensure an encrypted connection. Next, we need to configure the Worldpay extension itself.

Worldpay Extension configuration

Navigate to the FinDock setup screen and click the PaymentHub-Worldpay tile to open the configuration screen.

Worldpay tile

Worldpay configuration page

The Worldpay configuration page has several options that need to be configured.

Endpoint: This is the Worldpay server address the application will use to initiate transactions and authorizations. By default Worldpay offers two endpoints:

Merchant Code , Username and Password are either set by your Worldpay administrator, or can be found in the Worldpay Merchant Administration Interface. The Base URL is the URL of the configured Site where you've added the Worldpay callback processor as an Enabled Apex Class. make sure the end the url with a slash '/'. When you have entered all the details, click Save to store the configuration.

Activating the Payment Methods

After you have configured the Worldpay Payment Extension, you can activate the payment methods that it support. Navigate to the FinDock Setup screen, and click the Activate/Deactivate tab. Locate Worldpay in the list of installed Extensions and click the Payment Methods button next to it.

Activate or Deactivate Payment Methods in the Worldpay Payment Extension

Clicking the button enables a dialog box that allows you to activate or deactivate the payment methods for this extension.

Click Activate to activate the Creditcard Payment Method

When you click activate, the Creditcard payment method is enabled and made available throughout FinDock. If Worldpay is your only, or your preferred Creditcard Payment Service provider, make sure to enable the Default toggle.

Creating a Worldpay Target

When using Worldpay to collect recurring credit card transactions in bulk, you will need a Target that allows the bulk upload to be correctly routed.

Creating the Target

Target creation is managed through the ProcessingHub setup page. To create a new target and configure it:

  1. Navigate to the FinDock setup page by opening the App Launcher (the 3×3 grid button on the top left of the page, just below the Salesforce cloud logo), enter “FinDock” in the search box and click the FinDock app and select Setup in the navigation.
  2. Click on the ProcessingHub tile to open up the ProcessingHub setup page.
  3. Click on the Targets tab.
  4. Click the Add Target button to create a new target.
  5. On the New Target dialog, give this Target the name of one of the accounts you wish to configure.
  6. Select the Target type: “PaymentHub Worldpay”
  7. Click Save to store the Target.

Worldpay target

Configuring the target

After you have created one or more targets, we can configure all their settings. In the list of targets, click the arrow icon, and click Settings.

Opening the settings screen for a target

The settings screen for this particular target is opened. Different target types, have different screens and configuration options.

Worldpay target configuration

  • BATCH_XML_VERSION: Leave this at the default value, unless you have a specific reason to switch to a different version.
  • CURRENCY: If your currency is different from the one presented here, change this to your default currency.
  • MERCHANT_CODE: the Merchant code provided to you by Worldpay
  • RECORDS_PER_FILE: The maximum number of transaction per file, if the number of transactions exceed this threshold, FinDock will create multiple files. Unless otherwise instructed, leave this at the default value.
  • XML_API_ENDPOINT: This is the Worldpay server address the application will use to initiate transactions and authorizations. By default Worldpay offers two endpoints:
  • XML_API_USERNAME & XML_API_PASSWORD, these are set by your Worldpay administrator in the Worldpay Merchant Administration Interface. When you have entered all the details click Save to store the new configuration.

Multi currency

When multi currency is enabled, FinDock checks whether there is an ISO code in the JSON. If there is, we use the currency of the JSON (else we use the org default currency).

For recurring payments FinDock uses the currency which is filled out in your WorldPay target, to create installments and payments.

Testing and Go-live

To test your Worldpay configuration, you can use the following request in combination with the API. This will initiate a one-time credit card transaction with Worldpay.

note

In production, recurring credit card tokens are created with an initial lifetime of four years. In sandbox, tokens are created with a lifetime of seven days.

{
"FailureURL": "https://www.example.com/error",
"Origin": "API Test",
"Payer": {
"AllowDeduplication": true,
"Contact": {
"Email": "test@demo.com",
"FirstName": "Test",
"LastName": "Tester"
},
"ContactUpdate": "replace"
},
"Payment": {
"Amount": "25"
},
"PaymentMethod": {
"Name": "Creditcard",
"Processor": "PaymentHub-WorldPay"
},
"SourceConnector": {
"Name": "PaymentHub"
},
"SuccessURL": "https://www.example.com/success"
}

The following request can be used to initiate a payment when multi currency is enabled.

{
"SuccessURL":"http://success.com",
"FailureURL":"http://failure.com",
"Payer":{
"Contact":{
"FirstName":"Me",
"LastName":"Test",
"Email":"me@test.com"
},
"ContactUpdate":"Enrich",
"AllowDeduplication":true,
"PrimaryRelation":"Contact"
},
"Payment":{
"Amount": 11.15,
"CurrencyIsoCode":"USD"
},
"PaymentMethod":{
"Name":"Creditcard",
"Processor":"PaymentHub-WorldPay",
"Target":"Worldpay"
},
"SourceConnector":{
"Name":"PaymentHub"
}
}

If your configuration is correct, you should be able to navigate to the RedirectURL provided in the response and pay the amount specified. When a redirect ends in an unexpected error, the error message is stored in the last status reason of the installment.