---
schema_version: "1"
id: 2b78190b88a0198c88ff5d3f758a9cfe99faee6c0f9ed26f21fc09afd89812d6
title: isbuynow 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-isbuynow.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/b2c-isbuynow.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b1fba834e930f0792bf4a15bbb87aabf33640d770a99a4a739ad5c3c12383bdc
products:
  - Composable Storefront
  - Salesforce APIs
---
# isbuynow Element

Inject code to render express checkout buttons that lets a shopper buy a specific product.

To render express checkout buttons for a shopper to pay for their current basket, see [\<ispayment>](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/b2c-ispayment.md).

`<isbuynow>` 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

```
<isbuynow
  payment-request = SalesforcePaymentRequest expression \\required
></isbuynow>
```

- 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 `<isbuynow>` tag injects \<script> code in the page to render express checkout buttons that lets a shopper buy a specific product. See [dw.extensions.payments](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/api/package_dw_extensions_payments.html) to configure the express checkout buttons and understand how they're rendered.

## Rules of Use

This tag can appear multiple times on the same page, with no limit. 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. The options in the `SalesforcePaymentRequest` include line items with amounts that depend on variables such as, currency, prices, promotions, and applicable shipping methods. Consider these when using this tag in a cached template.

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 an Apple Pay button configured with Salesforce Payments on the site. The ID of the component is “applepay” and the CSS class name where the component is to be rendered is “apple-pay-button-container”.

A helper function, `COHelpers.calculateBuyNowData`, creates the basket data and payment request options. See [dw.extensions.payments](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/api/package_dw_extensions_payments.html) for details on how the data prepares a basket when a shopper taps an express checkout button and how the options create line items for the payment request, and then display the browser payment app, such as Apple Pay.

**note:** The script code that creates the `SalesforcePaymentRequest` object can be placed in a controller. `<isscript>` is used here as an example.

```
<isscript>
var SalesforcePaymentRequest = require('dw/extensions/payments/SalesforcePaymentRequest');
var COHelpers = require('*/cartridge/scripts/checkout/checkoutHelpers');

var buyNowData = COHelpers.calculateBuyNowData(pdict.product, pdict.quantity, pdict.price);

var paymentRequest = new SalesforcePaymentRequest('applepay', '.apple-pay-button-container');
 paymentRequest.addInclude(SalesforcePaymentRequest.ELEMENT_TYPE_APPLEPAY);
paymentRequest.setBasketData(buyNowData.basketData);
paymentRequest.setOptions(buyNowData.options);
</isscript>

<ispayment payment-request="${paymentRequest}"></ispayment>
```
