Skip to main content

Overview

The paymentMethodId parameter allows you to specify which payment method should be used for a transaction. This gives you control over the payment experience and enables features like forcing specific payment methods, building custom selectors, or pre-selecting based on user preferences.
paymentMethodId is optional when creating a payment session — omit it and the customer picks from every method available for their country and currency on the payment page. Use getPaymentsMethods() to retrieve available payment method IDs.

How it works

1

Retrieve available payment methods

Use getPaymentsMethods() to fetch all available payment methods for your account.
2

Select a payment method

Choose the appropriate payment method based on your business logic (currency, country, user preference, etc.).
3

Use the payment method ID

Pass the id property of the selected payment method as the paymentMethodId parameter in createSession().
4

Payment is processed

The customer will be directed to pay using the specified payment method.

Implementation

Example with payment method selection

Payment method object structure

When you call getPaymentsMethods(), each payment method object contains the following properties:

Common use cases

Filtering options

The getPaymentsMethods() method accepts optional filters: Example usage:

getPaymentsMethods()

View full API reference

createSession()

Create payment sessions