---
schema_version: "1"
id: 5942f3fd721404e8da5091361dbe1fe4125548ef697a4d8a8afaf81536b15d9f
title: ispaymentmessages Element
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/b2c-commerce/guides/isml/b2c-ispaymentmessages.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/b2c-ispaymentmessages.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b620a8232c4cc47d23697a915a5f7975a1f455a2f84ec3b3b1ea6afb92fc0b7d
products:
  - Composable Storefront
  - Salesforce APIs
---
# ispaymentmessages Element

Injects code to show payment-related messages such as callouts to the shopper about payment methods and available credit options for PayPal, Afterpay, and Klarna. 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](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/api/class_dw_extensions_payments_SalesforcePaymentRequest.html).

## Purpose

The `<ispaymentmessages>` tag injects `<script>` code tag injects `<script>` code that displays messages about the payment method. See [dw.extensions.payments](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/api/package_dw_extensions_payments.html) 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>

```
