Receiving payment method data
To receive payment method data to display to the user in the payment UI, you can use either ready-to-use components, or SDK methods.
Use components
- Add the
psdk-payment-methods
component to the HTML markup of the payment UI to display the list of available payment methods.
Copy
- html
<psdk-payment-methods country="US"></psdk-payment-methods>
- Add the handling of the
selectionChange
event sent when the user selects a particular payment method.
Copy
- typescript
const paymentMethods = document.querySelector('psdk-payment-methods');
paymentMethods?.addEventListener('selectionChange', (event) => {
console.log(event.detail);
});
Use SDK methods
SDK method name | Description |
---|---|
getRegularMethods | Returns a list of available payment methods. |
getQuickMethods | Returns a list of available quick payment methods, e.g., Apple Pay and Google Pay. |
getSavedMethods | Returns a list of saved payment methods for a particular user. |
Copy
- typescript
const methods = await headlessCheckout.getRegularMethods();
Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Found a typo or other text error? Select the text and press Ctrl+Enter.