ispayment Element
Inject code to render payment methods or express checkout buttons that let a shopper pay for their current basket.
To render express checkout buttons that lets a shopper buy a specific product, see <isbuynow>.
<ispayment>
is only used with B2C Commerce
Payments. An associated payments account must be successfully enabled and configured for
use on the storefront site where this element appears.
Syntax
<ispayments payment-request = SalesforcePaymentRequest expression \\required
></ispayments>
- payment-request = SalesforcePaymentRequest expression
-
Specify a
dw.extensions.payments.SalesforcePaymentRequest
as part of an expression for the tag. See SalesforcePaymentRequest.
Purpose
The <ispayment>
tag injects <script>
code in the page to render payment methods or express checkout buttons that let a
shopper pay for their current basket. See dw.extensions.payments to configure the payment methods and
express checkout buttons, as well as understand how they're rendered.
Rules of Use
This tag appears multiple times on the same page with no limit. When used to render payment methods for the payment step of a checkout page, it only appears once. The tag must be placed where <script> tags are valid, after the closing </head> tag in the HTML page.
This tag can't be used in a cached template because it's used for the shopper to pay for their current basket. However, you can use it in a remote included template referenced by a cached template, similar to a minicart.
Payment methods are only rendered when applicable for the basket. If a potentially available payment method doesn't support the basket currency, it isn't presented.
Express checkout buttons are only rendered when applicable for the shopper. If the shopper isn't using a supported device or operating system, or hasn't configured them to use the available express checkout buttons, then no button is presented.
Example
In this example, <script> code is injected by <ispayment> to render all payment methods and express checkout buttons that are configured with Commerce Cloud Payments on the site. The ID of the component is βpaymentβ and the CSS class name where the component is to be rendered is βpayment-elementβ.
SalesforcePaymentRequest
object can be placed in a controller.
<isscript> is used here as an example.
<isscript>
var SalesforcePaymentRequest = require('dw/extensions/payments/SalesforcePaymentRequest');
var paymentRequest = new SalesforcePaymentRequest('payment', '.payment-element');
</isscript>
<ispayment payment-request="${paymentRequest}"></ispayment>