ispaymentmessages Element

Injects code to show payment-related messages such as callouts to the shopper about payment methods and available credit options for PayPal, and Afterpay. For example, β€œPay in 4 interest-free payments of $22.50 with afterpay.”

<ispaymentmessages> is used only with Salesforce Payments. An associated payments account must be successfully enabled and payment method configured for use on the storefront site where this element appears.

Syntax

<ispaymentmessages  payment-request = SalesforcePaymentRequest expression \\required
></ispaymentmessages>
payment-request = SalesforcePaymentRequest expression

Specify a dw.extensions.payments.SalesforcePaymentRequest as part of an expression for the tag. See SalesforcePaymentRequest.

Purpose

The <ispaymentmessages> tag injects <script> code tag injects <script> code that displays messages about the payment method. See dw.extensions.payments to configure the payment methods and to understand how they're rendered.

Rules of Use

This tag can appear multiple times on the same page with no limit to render payment messages for a product page or a cart page. Payment messages are only rendered when the site is configured to accept payment methods that support them. If a payment method doesn't support messages, they aren’t shown.

To use this element, you need access to the SalesforcePaymentRequest object.

This tag can't be used in a cached template because it's used to display the credit options for the payment method.

Example

In this example, <script> code is injected by <ispaymentmessages> to render messages associated with certain payment methods that are configured with Salesforce Payments on the site.

The ID of the component is β€œpaymentrequest-<UUID>-messages” and the CSS class name where the component is to be rendered is β€œsalesforce-payment-messages-element-<UUID>.” UUID is a randomly generated ID.

Note: The B2C Commerce script code that creates the SalesforcePaymentRequest object can be placed in a controller. <isscript> is used as an example.
<isscript>
var UUIDUtils = require('dw/util/UUIDUtils');
var name = UUIDUtils.createUUID();

var messagesPaymentRequestId = 'paymentrequest-' + name + '-messages';
var messagesElementClass = 'salesforce-payment-messages-element-' + name;

var SalesforcePaymentRequest = require('dw/extensions/payments/SalesforcePaymentRequest');
var messagesPaymentRequest = new SalesforcePaymentRequest(messagesPaymentRequestId, '.' + messagesElementClass);
</isscript>