Using WorldPay

Support for WorldPay was added into mojoPortal as of version 2.3.9.3 released 2012-10-11

It is supported in the WebStore feature as well as in the updated versions of Site Membership Pro, Web Invoice Pro, and event Calendar Pro.

Main Configuration

Once you have established your account with WorldPay you need to add some configuration setting in user.config. If you are using a single site installation or want to use the same WorldPay account in all sites in your installation you can use the global configuration settings. If you only want to enable it in a single site or want to use different WorldPay accounts in different sites you can use site specific config settings. In all cases you need to enter an url in your WorldPay configuration web page for the payment response url, so that WorldPay can post the results back to your site to trigger order processing and order confirmation email in the mojoPortal commerce features. It would be best if you have an SSL certificate installed for your site since customer information is posted, but I'm not sure if WorldPay actually requires it (they do not require it at least for test mode). If you do not have SSL then the https:// below would be just http://

The url you should enter into the WorldPay Web page is in the format:

https://yoursiteroot/Services/WorldPayPostbackHandler.aspx

Using Global Settings

The following example shows how to configure global settings that apply to all sites in a given installation of mojoPortal.

<add key="CommerceUseGlobalSettings" value="true" />

<add key="CommerceGlobalUseTestMode" value="false" />

<add key="CommerceGlobalPrimaryGateway" value="WorldPay" />
<add key="CommerceGlobalWorldPayInstallationId" value="yourinstallationid" />
<add key="CommerceGlobalWorldPayMd5Secret" value="yourmd5secret" />
<add key="CommerceGlobalWorldPayResponsePassword" value="yourpaymenresponsepassword" />

Using Site Specific Settings

The following example shows site specific configuration using the Site ID.

<add key="CommerceUseGlobalSettings" value="false" />

<add key="Site1-PaymentGatewayUseTestMode" value="false" />

<add key="Site1-PrimaryPaymentGateway" value="WorldPay" />
<add key="Site1-WorldPayInstallationId" value="yourinstallationid" />
<add key="Site1-WorldPayMd5Secret" value="yourmd5secret" />
<add key="Site1-WorldPayResponsePassword" value="yourpaymenresponsepassword" />

Customizing or Disabling the Shopper Response Page

By default, all of the mojoPortal commerce features do return shopper response HTML to WorldPay when WorldPay posts the transaction to your site. The HTML sent back to WorldPay is then rendered to the user's web browser from the WorldPay server, so the user is not really at your site, but you can customize the HTML to add branding, or you can disable the shopper respnse HTML and WorldPay will render their own shopper result with default WorldPay branding. Note that you definitely must enable the payment response from WorldPay so that orders are processed even if you disable the shopper response. The only difference is if the shopper response is disabled then mojoPortal features do not respond to the payment post with HTML. If no HTML or incorrect HTML is returned to WorldPay then they will generate their own shopper response page or use HTML response templates that you upload to their server. The advantage of using the built in support for generating a shopper response is that more details aboout the order can be included.

The default shopper response templates used in mojoPortal features are just minimal HTML and the result is a plain white page with no branding at all. So you definitely will want to either disable it and use the default shopper response created by WorldPay or customize it to make it look more professional and include your branding.

Customizing or Disabling the Shopper Response in the WebStore Feature

You can disable the shopper response globally or per site as shown in the examples below:

<add key="CommerceGlobalWorldPayProduceShopperResponse" value="false" />
<add key="CommerceGlobalWorldPayProduceShopperCancellationResponse" value="false" />

<add key="Site1-WorldPayProduceShopperResponse" value="false" />
<add key="Site1-WorldPayProduceShopperCancellationResponse" value="false" />

By default the WebStore feature uses the following template files for shopper responses for completed and cancelled WorldPay transactions.

/Data/MessageTemplates/en-US-DefaultWorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-DefaultWorldPayOrderCancelledTemplate.config

To customize them you should copy those files and rename them, for example:

/Data/MessageTemplates/en-US-CustomWorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-CustomWorldPayOrderCancelledTemplate.config

Note that the language prefix doesn't have to be en-US, bu tit must match whatever language your are forcing as the UI culture for your site.

To make WebStore use your custom files you need to add either global or site specific configuration settings to user.config as shown in the example below:

<add key="CommerceGlobalWorldPayShopperResponseTemplate" value="CustomWorldPayOrderConfirmationTemplate.config" />
<add key="CommerceGlobalWorldPayShopperCancellationResponseTemplate" value="CustomWorldPayOrderCancelledTemplate.config" />

<add key="Site1-WorldPayShopperResponseTemplate" value="CustomWorldPayOrderConfirmationTemplate.config" />
<add key="Site1-WorldPayShopperCancellationResponseTemplate" value="CustomWorldPayOrderCancelledTemplate.config" />

Notice that you leave out the language prefix in the setting even though the file on disk must be named with the language prefix.

Now that you have configured it to use your custom files you can safely modify them without worry that they will be overwritten the next time you upgrade mojoPortal.

You can edit the files with a text editor and you will see that there are a few tokens that you can use and one required token used by WorldPay. WorldPay requires the following token:

<WPDISPLAY ITEM=banner>

If that is missing then WorldPay will not use your shopper response.

The following additional tokens are supported by the WebStore feature but are optional so you can leave out ones that you don't want:

  • #CustomerName
  • #OrderId
  • #StorePageLink
  • #OrderDetailLink
  • #OrderDetails

Note that you can use custom CSS and images in the template, but in order to do that you  must upload the css file and images to your  WorldPay account and reference them with special syntax.

For example you can add a css file into the head of your template with the following syntax:

<link rel="stylesheet" href="/i/<wpdisplay item=instId>/stylesheetname.css" type="text/css" />

and you can add images like this:

<img src="/i/<wpdisplay item=instId>/imagename.gif" />

Customizing or Disabling the Shopper Response in Site Membership Pro

You can disable the shopper response for Site Membership Pro  either globally or per site as shown in the examples below.

<add key="MembershipPro:UseGlobalWorldPayCustomizationSettings" value="true" />
<add key="MembershipPro:GlobalWorldPayProduceShopperResponse" value="false" />
<add key="MembershipPro:GlobalWorldPayProduceShopperCancellationResponse" value="false" />

<add key="MembershipPro:UseGlobalWorldPayCustomizationSettings" value="false" />
<add key="Site1-MembershipPro:WorldPayProduceShopperResponse" value="false" />
<add key="Site1-MembershipPro:WorldPayProduceShopperCancellationResponse" value="false" />

The default shopper response template files used by Site Membership Pro are:

/Data/MessageTemplates/en-US-Membership-WorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-Membership-WorldPayOrderCancelledTemplate.config

You can copy those files and rename them as in the following example:

/Data/MessageTemplates/en-US-Membership-Custom-WorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-Membership-Custom-WorldPayOrderCancelledTemplate.config

Then you can add these settings in user.config to make it use your custom templates:

<add key="MembershipPro:GlobalWorldPayShopperResponseTemplate" value="Membership-Custom-WorldPayOrderConfirmationTemplate.config" />
<add key="MembershipPro:GlobalWorldPayShopperCancellationResponseTemplate" value="Membership-Custom-WorldPayOrderCancelledTemplate.config" />

<add key="Site1-MembershipPro:WorldPayShopperResponseTemplate" value="Membership-Custom-WorldPayOrderConfirmationTemplate.config" />
<add key="Site1-MembershipPro:WorldPayShopperCancellationResponseTemplate" value="Membership-Custom-WorldPayOrderCancelledTemplate.config" />

Now you can safely edit your custom templates and they will not be overwritten during upgrades.

In addition to the required WorldPay token mentioned above in the WebStore section, Site Membership Pro supports the following optional tokens:

  • #CustomerName
  • #OrderId
  • #StorePageLink
  • #OrderDetailLink
  • #OrderDetails

See additional notes in the WebStore section above about adding custom CSS and images.

Customizing or Disabling the Shopper Response in Web Invoice Pro

You can disable the shopper response for Web Invoice Pro either globally or per site as shown in the examples below.

<add key="WebInvoicePro:UseGlobalWorldPayCustomizationSettings" value="true" />
<add key="WebInvoicePro:GlobalWorldPayProduceShopperResponse" value="false" />
<add key="WebInvoicePro:GlobalWorldPayProduceShopperCancellationResponse" value="false" />

<add key="WebInvoicePro:UseGlobalWorldPayCustomizationSettings" value="false" />
<add key="Site1-WebInvoicePro:WorldPayProduceShopperResponse" value="false" />
<add key="Site1-WebInvoicePro:WorldPayProduceShopperCancellationResponse" value="false" />

The default shopper response template files used by Web Invoice Pro are:

/Data/MessageTemplates/en-US-WebInvoice-WorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-WebInvoice-WorldPayOrderCancelledTemplate.config

You can copy those files and rename them as in the following example:

/Data/MessageTemplates/en-US-WebInvoice-Custom-WorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-WebInvoice-Custom-WorldPayOrderCancelledTemplate.config

Then you can add these settings in user.config to make it use your custom templates:

<add key="WebInvoicePro:GlobalWorldPayShopperResponseTemplate" value="WebInvoice-Custom-WorldPayOrderConfirmationTemplate.config" />
<add key="WebInvoicePro:GlobalWorldPayShopperCancellationResponseTemplate" value="WebInvoice-Custom-WorldPayOrderCancelledTemplate.config" />

<add key="Site1-WebInvoicePro:WorldPayShopperResponseTemplate" value="WebInvoice-Custom-WorldPayOrderConfirmationTemplate.config" />
<add key="Site1-WebInvoicePro:WorldPayShopperCancellationResponseTemplate" value="WebInvoice-Custom-WorldPayOrderCancelledTemplate.config" />

Now you can safely edit your custom templates and they will not be overwritten during upgrades.

In addition to the required WorldPay token mentioned above in the WebStore section, Web Invoice Pro supports the following optional tokens:

  • #CustomerName
  • #InvoiceNumber

See the WebStore customization section above for more details about adding CSS and images to your template.

Customizing or Disabling the Shopper Response in Event Calendar Pro

You can disable the shopper response for Event Calendar Pro either globally or per site as shown in the examples below.

<add key="EventCalendarPro:UseGlobalWorldPayCustomizationSettings" value="true" />
<add key="EventCalendarPro:GlobalWorldPayProduceShopperResponse" value="false" />
<add key="EventCalendarPro:GlobalWorldPayProduceShopperCancellationResponse" value="false" />

<add key="EventCalendarPro:UseGlobalWorldPayCustomizationSettings" value="false" />
<add key="Site1-EventCalendarPro:WorldPayProduceShopperResponse" value="false" />
<add key="Site1-EventCalendarPro:WorldPayProduceShopperCancellationResponse" value="false" />

The default shopper response template files used by Event Calendar Pro are:

/Data/MessageTemplates/en-US-EventCalendarPro-WorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-EventCalendarPro-WorldPayOrderCancelledTemplate.config

You can copy those files and rename them as in the following example:

/Data/MessageTemplates/en-US-EventCalendarPro-Custom-WorldPayOrderConfirmationTemplate.config
/Data/MessageTemplates/en-US-EventCalendarPro-Custom-WorldPayOrderCancelledTemplate.config

Then you can add these settings in user.config to make it use your custom templates:

<add key="EventCalendarPro:GlobalWorldPayShopperResponseTemplate" value="EventCalendarPro-Custom-WorldPayOrderConfirmationTemplate.config" />
<add key="EventCalendarPro:GlobalWorldPayShopperCancellationResponseTemplate" value="EventCalendarPro-Custom-WorldPayOrderCancelledTemplate.config" />

<add key="Site1-EventCalendarPro:WorldPayShopperResponseTemplate" value="EventCalendarPro-Custom-WorldPayOrderConfirmationTemplate.config" />
<add key="Site1-EventCalendarPro:WorldPayShopperCancellationResponseTemplate" value="EventCalendarPro-Custom-WorldPayOrderCancelledTemplate.config" />

Now you can safely edit your custom templates and they will not be overwritten during upgrades.

In addition to the required WorldPay token mentioned above in the WebStore section, Event Calendar Pro supports the following optional tokens:

  • #CustomerName
  • #EventName
  • #EventDetailLink
  • #OrderId
  • #EventTimeZone
  • #EventTime
  • #TicketQuantity
  • #TicketPrice
  • #OrderSubTotal
  • #SalesTax
  • #OrderTotal
  • #CalendarPageLink

See the WebStore customization section above for more details about adding CSS and images to your template.

 

Created by Joe Audette on Oct 11, 2012
Last Modified by Joe Audette on Oct 11, 2012