Payment methods API overview

You can customize the payment methods that are offered to customers at checkout using the payment methods API.

The payment methods API is part of the Checkout domain. Scripts that use the payment methods API run right before the customer reaches the payment stage at checkout.

Script signature

A script's signature is specific to the API that it uses. Every signature has single entry point that accepts input and returns output that is specific to the script API.

Input

Payment methods scripts accept input from the following:

  • Input: Contains order details from the current checkout stage, along with the list of store's payment methods.
  • Configuration: The external configuration provided to a script.

Output

Payment methods scripts return a single result that contains up to three parts. Each part independently dictates how the payment methods are to be filtered, renamed, and reordered at checkout:

  • FilterResponse: Returns a list of payment methods to hide.
  • RenameResponse: Returns the payment methods to be renamed along with their new names.
  • SortResponse: Returns the payment methods in the order in which they are to appear.

Errors

If a runtime error occurs in a script or if it times out, then the script run is treated as non-operative. Any results from the script are ignored and the default payment methods are offered to customers.

Next steps