Customise HTML messages

Here's how you can customise and expand your orders, responses and other HTML messages. To customise, you make substitutions in the files used in the construction of pages or emails.

All parameters are available for substitution, provided that the transaction has reached the appropriate stage. For instance, there wouldn't be a transStatus value available before a transaction had been processed to completion. If you use an unavailable parameter in substitution then the default is used as specified in the substitution tag.

For details of the parameters available, refer to sectionParameters.

Substitute a parameter or file

You can substitute a parameter in any file that is used in the construction of pages or emails. To do a substitution, use WPDISPLAY tags. These tags can be placed anywhere, including within HTML tags. For more details, seeEmbed tags within tags.

You can also substitute files in the same way. An example is shown below, where a footer file has been substituted.

Parameters provide information about the transaction. For instance, the parameter amountString is the cost of the item or product in the payment pages, and desc is the description of the item or product. Other parameters hold other information, such as the shopper's billing address details and the transaction status. Any of these parameters can be substituted using WPDISPLAY tags.

Substitute the value of parameters

In the following example, a resultY.html response page, each ITEM tag is replaced with the values of the named parameters:

resources/images/resulty_response_page_thumb_350_0.png

You can also embed your standard header and footer, as well as any graphics you wish. Note that these graphics must be uploaded to our payment service, even if the page is returned as a result page by your server. For more information about uploading graphic files, see theCustomise (Basic)andCustomise (Developer)sections.

Note: If you use custom parameters in the order details, any "M" or "MC" parameters that you submit are also returned. Also note that "C_" parameters are not returned in the Payment Responses message, but are displayed to the shopper in the result page. For more information, seeParameters.

Substitute the value of a display property

The HTML below constructs a font tag containing the value of the parameter named title.bg from display.properties. This means you can use the same parameters that are used in the payment pages in your own templates. You can also add parameters of your own to display.properties and use these in your templates.

Copied!
<WPDISPLAY DISP="title.bg" DEFAULT="<font color=#000000>" PRE="<font color=" POST=">">

Embed the contents of a file

In the example below, the FILE tag is replaced with the contents of the named file footer.html, which should be in your uploaded area. The embedded file can contain any Worldpay tags except for another file embedding command.

Copied!
<WPDISPLAY FILE=footer.html DEFAULT="</body>">

Embed tags within tags

The strings given as the values of WPDISPLAY attributes can themselves contain WPDISPLAY tags, except for file embedding tags. For example, given a cartId of 123, the line:

Copied!
<WPDISPLAY FILE="blurb<WPDISPLAY ITEM=cartId>.html">

expands to:

Copied!
<WPDISPLAY FILE="blurb123.html">

which then results in the embedding of the file blurb123.txt.

Note: Do not use the same type of quotes in the inner tag: either omit them altogether as in the example above (only viable for single words) or use the other kind (single versus double quote), as shown below.

Copied!
<WPDISPLAY FILE="blurb<WPDISPLAY ITEM='cartId'>.html">

Substitute a custom parameter

Any "C" or "MC" custom parameters that you provide in the initial submission to us are also available for substitution.

For example, assume that you have assigned a custom parameter MC_mycustomvar with the value "Don't forget there is 10% off on all gift packs on Friday 10th Sept!". Then, in the following HTML line:

Copied!
<WPDISPLAY ITEM="MC_mycustomvar" DEFAULT="" PRE="<b>" POST="</b>">

The PRE bold tag and POST bold-off tag bracket the ITEM tag, so that the substitution is done as follows:

Copied!
<b>Don't forget there is 10% off on all gift packs on Friday 10th Sept!</b>

which displays as:

Don't forget there is 10% off on all gift packs on Friday 10th Sept!