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.
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>
Infocenter Retirement: On June 30, 2023, the Infocenter was retired, and documentation currently hosted on the Infocenter will be published to Salesforce Help, Commerce Cloud Developer Center, and Salesforce B2C Commerce Developer Documentation Resources. For more information, see the release note.