The Payment Customization API enables you to rename, reorder, and sort the payment methods available to buyers during checkout. ## Example use cases - Hide payment methods for carts with totals above or below a given value - Reorder payment methods according to user preference - Hide payment methods based on customer tag or country - Hide and disable gift cards based on cart contents, country and more ## Developer tools and resources
## Migrating from scripts to functions If you want to migrate an existing [payment script](https://help.shopify.com/manual/checkout-settings/script-editor/shopify-scripts) to Shopify Functions, then you can use the following mappings: | Shopify Scripts method | Description | Shopify Functions object | Additional context | | ------------ | ----------- | -------------- | -------------- | | `change_name` | Changes the name of a payment option | [RenameOperation](/docs/api/functions/reference/payment-customization/graphql/common-objects/renameoperation) | | | `sort` | Sorts the payment options based on some criteria, typically to place one payment option at the top or bottom of a list | [MoveOperation](/docs/api/functions/reference/payment-customization/graphql/common-objects/moveoperation) | Instead of sorting, you can move individual payment methods. | | `delete_if` | Removes a payment option from checkout | [HideOperation](/docs/api/functions/reference/payment-customization/graphql/common-objects/hideoperation) | | ## Limitations and considerations - 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](/docs/api/functions/reference/payment-customization/graphql/input) will still contain all payment methods, however [output](/docs/api/functions/reference/payment-customization/graphql/functionrunresult) [operations](/docs/api/functions/reference/payment-customization/graphql/common-objects/operation) that target restricted payment methods will not take effect on the 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 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 install a maximum of five payment customization functions on each store. ## Available Payment Methods When developing payment customization functions you can find the name of the currently available payment methods by querying the [paymentMethods](docs/api/functions/reference/payment-customization/graphql/common-objects/paymentcustomizationpaymentmethod) array in your function input. You can then look inside your function logs in partners, to see the formatting of each payment method. ``` json { "paymentMethods": [ { "id": "gid://shopify/PaymentCustomizationPaymentMethod/0", "name": "Deferred", "placements": [ "PAYMENT_METHOD" ] }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/1", "name": "Gift card", "placements": [ "PAYMENT_METHOD" ] }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/2", "name": "Shopify Payments", "placements": [ "PAYMENT_METHOD" ] }, { "id": "gid://shopify/PaymentCustomizationPaymentMethod/3", "name": "Apple Pay", "placements": [ "ACCELERATED_CHECKOUT" ] } ] } ``` ## Next steps - Learn how to use Shopify Functions by [building a payment customization](/docs/apps/build/checkout/payments).