Kustom Express Checkout

Last modified:

Introduction

Kustom Express Checkout (KEC) adds express buttons for Apple Pay, Google Pay and Klarna to your store. The customer clicks a button, chooses delivery and pays in a payment sheet from Kustom, without going through the checkout page.

The express buttons are part of Kustom Elements and are available in Kustom Checkout for WooCommerce 2.24.0 or later.

You can show the express buttons:

  • On the cart page – The buttons buy everything in the cart.
  • In the Cart and Checkout blocks – The buttons are shown in the express payment area at the top of the block.
  • On product pages – The buttons buy only that product, and leave the customer’s cart untouched.
  • Anywhere else – With the shortcode [kustom_express_element] or the block Kustom Express Element.
Product page with the Buy with Google Pay and Apple Pay express buttons below the Add to cart button

Requirements

  • Kustom Checkout for WooCommerce 2.24.0 or later, with Kustom Checkout enabled.
  • Kustom Shipping Assistant enabled and configured. The customer chooses delivery in the express payment sheet, and the shipping options come from your TMS.
  • A Kustom Elements public API key for your store. Your Kustom account needs to be activated for Kustom Elements and express buttons.

If one of these is missing, no express buttons are shown.

Configuration

Step 1 – Add the public API key

The public API key is not the same as the API username and password used for Kustom Checkout.

  1. Log in to the Kustom Portal.
  2. Navigate to Apps → On-site elements → Installation script and copy the value of data-public-api-key.
  3. In the WordPress Admin, navigate to WooCommerce → Settings → Payments → Kustom Checkout → Elements.
  4. Paste the key in Production public API key. If you use test mode, paste the key from your test account in Test public API key.
  5. Save the settings.
Elements settings with the Production public API key and Test public API key fields

When you save, the key is checked with Kustom, and the result is shown below the field:

  • Connected – The key works on your domain.
  • The public API key was not recognized by Kustom – Copy the key again from the Kustom Portal. Make sure you did not paste the API username or password.
  • The public API key is valid, but your domain is not an allowed domain – Add your store’s domain under Apps → On-site elements → My domains in the Kustom Portal.

Note

The production key is used when test mode is disabled, and the test key when test mode is enabled. A key from one environment does not work in the other.

Step 2 – Add the merchant URLs in the Kustom Portal

Kustom needs to know where to send the customer and the order notifications after an express purchase.

  1. In the Kustom Checkout settings, scroll to Express Buttons → Express merchant URLs. Here you find three URLs: Push URL, Validation URL and Confirmation URL.
  2. Click Copy next to each URL and paste it into the Kustom Portal under Apps → On-site elements → Express buttons.

Paste the URLs exactly as they are shown, including the {checkout.order.id} part. Kustom replaces it with the order ID.

Note

If you move the store to a new domain, for example from staging to production, copy the merchant URLs again and update them in the Kustom Portal.

Express Buttons settings with the Push, Validation and Confirmation URLs, each with a Copy button, and the Express buttons on product pages setting

Step 3 – Choose where to show the buttons

Cart page and Cart/Checkout blocks

When the requirements are met, the express buttons are shown automatically:

  • On the classic cart page, after the Proceed to checkout button.
  • In the express payment area of the Cart block and the Checkout block.
Checkout block with the Google Pay and Apple Pay express buttons above the Kustom Checkout

Product pages

Use the setting Express buttons on product pages to choose where the buttons are shown on the product page, for example Between Price and Excerpt. Choose Shortcode or block only if you want to place the buttons yourself with the shortcode or block, or Disabled to turn off express buttons for products.

Express buttons on product pages work for simple and variable products. On a variable product, the buttons are disabled until the customer has chosen a variation. The quantity in the Add to cart form is used.

Shortcode and block

Use the shortcode or block to show the express buttons on other pages, or in a custom product or cart template.

[kustom_express_element]
AttributeDescription
contextWhat the buttons buy. auto (default) buys the product on a product page and the cart everywhere else. cart always buys the cart. product buys the product, and shows nothing outside product pages.
localeThe language of the buttons, for example sv-SE. By default, the language of your site is used.

Example: [kustom_express_element context="cart" locale="en-GB"]

The block Kustom Express Element has the same context setting. In the block editor, the block shows a placeholder, since the buttons need the customer’s cart.

The shortcode and block only buy a product on product pages, and only when product express is enabled with the setting Express buttons on product pages. Otherwise they buy the cart. If the cart is empty, nothing is shown.

How it works

  1. The customer clicks an express button. The store creates an order in Kustom with the products, and Kustom opens the payment sheet.
  2. The customer enters or confirms their address, chooses a delivery option from your TMS and pays with Apple Pay, Google Pay or Klarna.
  3. Before the purchase is completed, Kustom calls the Validation URL. The store checks that the products and the total still match, and creates the WooCommerce order. If something has changed, for example if a product is out of stock, the purchase is stopped.
  4. Kustom completes the purchase and sends the customer to the Confirmation URL, which leads to the WooCommerce Order received page. Kustom also calls the Push URL, so the order is confirmed even if the customer closes the browser.

Product page purchases

A purchase made with the express buttons on a product page is kept separate from the customer’s cart. The products the customer has in the cart are still there after the purchase.

Orders in WooCommerce

An express order is a regular Kustom Checkout order. Order management works the same as for other Kustom orders, see Order management. The shipping option chosen in the payment sheet is saved to the order the same way as with Kustom Shipping Assistant.

Orders placed with an express button have the order meta field _kco_express, with the value cart or product.

If the order cannot be confirmed

If the order cannot be confirmed when the customer returns, the customer is sent to the cart with the notice We could not confirm your order. Please contact us if you were charged. Check the order and the Kustom developer logs. Log entries from express purchases start with [Express].

Hooks for developers

HookTypeDescription
kco_express_is_availableFilterWhether the express buttons can be shown. Return false to hide them everywhere.
kco_express_merchant_urlsFilterThe push, validation and confirmation URLs sent to Kustom and shown in the settings. Each URL must keep {checkout.order.id}. If you change them, update them in the Kustom Portal too.
kco_express_rate_limitFilterHow many express orders a customer can create per time window. Default: 5 per 60 seconds for logged-in customers and 30 per 60 seconds per IP address for guests.
kco_elements_localeFilterThe locale used for Kustom Elements, for example sv-SE.

Example: hide the express buttons for customers who are not logged in.

add_filter( 'kco_express_is_available', function ( $available ) {
	return $available && is_user_logged_in();
} );

Known limitations

  • Only simple and variable products can be bought with express buttons on product pages. Other product types can still be bought from the cart.
  • Kustom Shipping Assistant is required, so express buttons are not available for stores that use WooCommerce shipping methods in the checkout.
  • The express buttons are shown on the classic cart page as soon as the requirements are met. To hide them on specific pages, use the filter kco_express_is_available.