---
title: About functions in payments
description: >-
  Learn how to use Shopify Functions to customize the payment options that are
  available to buyers during checkout.
source_url:
  html: 'https://shopify.dev/docs/apps/build/checkout/payments'
  md: 'https://shopify.dev/docs/apps/build/checkout/payments.md'
api_type: functions
---

# About functions in payments

With Shopify Functions, you can build payment customizations that hide, reorder, rename, set payment terms, and add a review requirement for payment options available to buyers at checkout. In this tutorial series, you'll use [Shopify Functions](https://shopify.dev/docs/api/functions/current) to create a function that lets merchants hide a payment option offered to customers at checkout, based on the total value of their cart.

***

## What you'll learn

In this tutorial series, you'll learn how to do the following tasks:

* Set up your environment to use functions.
* Create a payment customization function.
* Add configuration to your payment customization using metafields.
* Build a payment customization user interface with App Bridge.
* Set payment terms for any checkout.
* Add a review requirement for any B2B checkout.

***

## Requirements

* You're a [user with app development permissions](https://shopify.dev/docs/apps/build/dev-dashboard/user-permissions).
* You've created a [dev store](https://shopify.dev/docs/apps/build/stores/development-stores#create-a-dev-store). You can create one by running `shopify store create dev`.
* You've [created an app](https://shopify.dev/docs/apps/build/scaffold-app) using Shopify CLI. If you previously installed Shopify CLI, then make sure that you're using the [latest version](https://shopify.dev/docs/api/shopify-cli#upgrade). If you plan to create a UI for your extension, then start with the [React Router app template](https://shopify.dev/docs/api#app-templates).
* You've installed [Node.js](https://nodejs.org/en/download) 16 or higher.
* You've [installed your app](https://shopify.dev/docs/apps/build/scaffold-app#step-4-install-your-app) on the development store.

### Rust-specific requirements

The following requirements are specific to Rust-based development with Shopify Functions.

* You've installed [Rust](https://www.rust-lang.org/tools/install).

  On Windows, Rust requires the [Microsoft C++ Build Tools](https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup). Make sure to select the **Desktop development with C++** workload when installing the tools.

* You've installed the [`wasm32-unknown-unknown` target](https://doc.rust-lang.org/rustc/platform-support/wasm32-unknown-unknown.html):

  ## Terminal

  ```terminal
  rustup target add wasm32-unknown-unknown
  ```

***

## Limitations

* Plan and geographical restrictions apply. [Learn more](https://help.shopify.com/en/manual/checkout-settings/checkout-customization#understanding-payment-method-customizations)

  * When the Payment Customization API usage is restricted, the function [input](https://shopify.dev/docs/api/functions/reference/payment-customization/graphql/input) will still contain all payment methods, however [output](https://shopify.dev/docs/api/functions/reference/payment-customization/graphql/functionrunresult) [operations](https://shopify.dev/docs/api/functions/reference/payment-customization/graphql/common-objects/operation) that target restricted payment methods will not take effect on the checkout.
  * Only [Shopify Plus](https://help.shopify.com/manual/intro-to-shopify/pricing-plans/plans-features/shopify-plus-plan) stores support [hiding specific placements](https://shopify.dev/docs/api/functions/latest/payment-customization#CartPaymentMethodsTransformRunResult.fields.operations.paymentMethodHide.placements). The `placements` field appears in the function input on all stores, but on non-Plus stores `HideOperation` ignores it and hides the entire payment method from checkout.

* You can't rename payment methods that have logos as a name, such as **Shop Pay**, **Apple Pay** and **Google Pay**. This also includes all wallets and the Shopify native gift card field.

* In Point of Sale, Payment Customization Functions don't currently run, and operations aren't applied.

* In Shop Pay, payment customization functions do not apply operations on any payment methods except the native gift card field.

* You can remove wallets from the **Express** or payment method section of checkout, but you can't reorder them.

* You can activate a maximum of twenty-five payment customization functions on each store.

* When setting payment terms on checkout, consider the following things:

  * Payment terms only apply to the specific order being processed and don't change the buyer's default payment terms.

  * Existing payment terms aren't provided in the function input and can't be referenced when setting new payment terms.

  * Payment terms can only be set if the shop is on a [Shopify Plus plan](https://help.shopify.com/manual/intro-to-shopify/pricing-plans/plans-features/shopify-plus-plan).

  * Payment terms can't be set on accelerated checkouts.

  * D2C checkouts with payment terms don't support pay now options—buyers only see deferred payment options. B2B checkouts have additional deferred payment options, including vaulted credit cards.

  * Event-based payment terms and automatic payment capture work differently for B2B and D2C:

    * **D2C checkouts**: When the store has the **Automatically when fulfilling** setting enabled, payments are captured automatically based on the event trigger (`FULFILLMENT_CREATED` captures per fulfillment, `ORDER_FULFILLED` captures when the entire order is fulfilled) set by the function.
    * **B2B checkouts**: Automatic payment capture isn't supported. Merchants must manually capture payments when the fulfillment event occurs.

* Adding a review requirement to checkout has the following limitations:

  * You can apply a review requirement only to B2B checkouts.
  * A review requirement cannot be applied to orders and draft order invoice checkouts.
  * A review requirement cannot be applied to [Draft order calculation](https://shopify.dev/docs/apps/build/b2b/draft-orders) flows in Shopify admin.

***

## Sample code

If you want to quickly get started, then you can get the sample code by completing the following steps. The [tutorial series](#tutorial-series) describes the sample code step by step.

1. Clone the payment customizations sample app:

   ## Terminal

   ```terminal
   shopify app init --template https://github.com/Shopify/function-examples/sample-apps/payment-customizations
   ```

   **Note:**

   You can [view the source code for the payment customizations sample app](https://github.com/Shopify/function-examples/tree/main/sample-apps/payment-customizations) in GitHub.

1) Enter a name for your app project.

2) Navigate to your app directory:

## Terminal

```terminal
cd <directory>
```

1. Link your app configuration:

## Terminal

```terminal
shopify app config link
```

1. Start a local server for your app:

## Terminal

```terminal
shopify app dev
```

1. With the server running, open the **Preview URL** in the terminal output.

   When you open the URL, you're prompted to install the app on your development store.

2. Click **Install app** to install the app on the store.

1) [Create and test your payment customization](https://shopify.dev/docs/apps/build/checkout/payments/build-ui#step-5-create-and-test-your-payment-customization).

***

## Tutorial series

Follow the tutorial series to go from "Hello World" to a functional payments customization experience.

[Tutorial 1: Getting started with building payment customizations\
\
](https://shopify.dev/docs/apps/build/checkout/payments/create-payments-function)

[Create a new payment customization function.](https://shopify.dev/docs/apps/build/checkout/payments/create-payments-function)

[Tutorial 2: Add configuration to your payment customization\
\
](https://shopify.dev/docs/apps/build/checkout/payments/add-configuration)

[Add configuration to your payment customization using metafields.](https://shopify.dev/docs/apps/build/checkout/payments/add-configuration)

[Tutorial 3: Build a payment customization user interface\
\
](https://shopify.dev/docs/apps/build/checkout/payments/build-ui)

[Build a new page in your app where merchants can view payment customizations.](https://shopify.dev/docs/apps/build/checkout/payments/build-ui)

[Tutorial 4: Set payment terms on a checkout\
\
](https://shopify.dev/docs/apps/build/checkout/payments/payment-terms)

[Set payment terms based on the buyer identity and cart total.](https://shopify.dev/docs/apps/build/checkout/payments/payment-terms)

[Tutorial 5: Add a review requirement on a checkout\
\
](https://shopify.dev/docs/apps/build/checkout/payments/review-requirements)

[Add a review requirement based on the cart total.](https://shopify.dev/docs/apps/build/checkout/payments/review-requirements)

***

## Developer tools and resources

Explore the following developer tools and resources to get familiar with building payment customizations.

[Payment Customization API reference\
\
](https://shopify.dev/docs/api/functions/reference/payment-customization)

[Consult the GraphQL reference for the Payment Customization API.](https://shopify.dev/docs/api/functions/reference/payment-customization)

[Language support\
\
](https://shopify.dev/docs/apps/build/functions/programming-languages)

[Learn about the language support and tooling available in Shopify Functions.](https://shopify.dev/docs/apps/build/functions/programming-languages)

[UX guidelines for payment customizations\
\
](https://shopify.dev/docs/apps/build/checkout/payments/ux-for-payments)

[Learn how to implement payment customizations in user interfaces.](https://shopify.dev/docs/apps/build/checkout/payments/ux-for-payments)

***

## Next steps

* [Get started](https://shopify.dev/docs/apps/build/checkout/payments/create-payments-function) with building payment customizations.

***
