Skip to main content

Payment Methods

This endpoint tells you which payment methods are available for a particular site. You'll use it in the Advanced flow when you want to control what's shown to the customer, or when you're using individual Adyen Components instead of the Drop-in.

If you're using the Sessions flow, you don't need this -- the Drop-in gets payment methods on its own.

This mirrors Adyen's /paymentMethods endpoint.

Request

POST /v1/ecom/{siteId}/payment-methods

Path:

ParameterTypeWhat it is
siteIdstringYour ecommerce site ID

Headers:

HeaderNeeded?What to send
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json
Idempotency-KeyNoA unique key to stop duplicates. See Best Practices.

Body:

FieldTypeNeeded?What it is
amountobjectYesThe payment amount. This helps filter methods by what's available for that amount.
amount.valueintegerYesAmount in minor units (so 1000 for 10.00).
amount.currencystringYesThree-letter currency code, like GBP.
blockedPaymentMethodsstring[]NoAny extra payment methods you want to leave out.
shopperLocalestringNoLocale for localised method names, like en-GB. Defaults to en-GB if you leave it out.

Things we handle for you

  • Blocked methods: sepadirectdebit, bacs, and directdebit_GB are always left out. Anything you add to blockedPaymentMethods gets added to that list.
  • Channel: Automatically set to Web.
  • Country: Set to your merchant's registered country.
  • Filtering: Results only include methods that are available for your specific site.

Response

You'll get back an Adyen PaymentMethodsResponse with a list of what's available. Pass this to Adyen Components on the frontend.

FieldTypeWhat it is
paymentMethodsobject[]The payment methods your customer can use.
storedPaymentMethodsobject[]Any saved (tokenised) payment methods, if there are any.

The full shape follows Adyen's paymentMethods response.

Example

Making the request:

curl -X POST https://api.yeti.host/v1/ecom/YOUR_SITE_ID/payment-methods \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": {
"value": 5000,
"currency": "GBP"
},
"shopperLocale": "en-GB"
}'

Using it on the frontend:

const paymentMethodsResponse = await fetchPaymentMethods(); // your server call

const checkout = await AdyenCheckout({
environment: "live",
clientKey: clientToken,
paymentMethodsResponse,
onSubmit: async (state, component) => {
// Send state.data.paymentMethod to POST /payments on your server
const result = await makePayment(state.data);
// Then handle the result
},
onAdditionalDetails: async (state, component) => {
// Send state.data to POST /payments/details on your server
const result = await submitDetails(state.data);
// Then handle the result
},
});

checkout.create("card").mount("#card-container");

For the full frontend setup, check out the Adyen Web Components guide.

What could go wrong

StatusCodeWhat it means
400yp_2002Something's wrong with the request
403yp_1002Your API key isn't allowed to call this endpoint
404yp_3004We can't find that site, or it's not an ecommerce site
404yp_3005We can't find the merchant
409yp_3004This site type can't be used for this
422yp_5003Your merchant account isn't set up for ECOM yet
500yp_4002Something went wrong fetching payment methods