Overview
ThepaymentMethodId 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.
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 callgetPaymentsMethods(), each payment method object contains the following properties:
Common use cases
Filtering options
ThegetPaymentsMethods() method accepts optional filters:
Example usage:
Related resources
getPaymentsMethods()
View full API reference
createSession()
Create payment sessions