API RecipesCheckout
Checkout Session Setup Flow
This recipe was an interactive walkthrough in the previous portal. Each step below names the API call it makes; open it in the API Reference to try it.
Overview
Card Brand Detection → Checkout Session Setup
This recipe walks you through a smart, card-aware checkout setup flow. Instead of blindly creating a checkout session, you first inspect the card to understand what you're dealing with — then confirm available payment methods — and finally create a session that's correctly configured for that card.
Flow Overview
- Detect Card Brand — Submit the card's BIN (first 6–8 digits) to identify the card network(s) and whether your merchant supports them. Critical for co-badged cards (e.g., Visa + Maestro) where EU regulations require letting the shopper choose.
- Get Available Payment Methods — Fetch the payment methods available for your merchant and the shopper's country to confirm card payments are supported.
- Create a Checkout Session — Spin up a payment session pre-configured with the correct payment method type, ready for Drop-in or Components to pick up on the frontend.
API Endpoints Involved
POST /cardDetailsPOST /paymentMethodsPOST /sessions
Prerequisites
- A Merchant Account name — found in your Adyen Customer Area.
- A test card number — use Adyen's test card numbers for sandbox testing.
- An API key with the Checkout Webservice role.
Tip: The detected card brand from Step 1 is automatically surfaced in Steps 2 and 3 to guide your configuration.
Step 1: Detect Card Brand
Identify the Card Brand from the BIN\n\n
API call: getCardDetails
Example arguments:
{
body: {
cardNumber: "4111112014267661",
countryCode: "FR",
merchantAccount: "APIMatic683ECOM",
}
}Step 2: Get Available Payment Methods
Confirm Available Payment Methods\n\n
API call: getPaymentMethods
Step 3: Create Checkout Session
Create the Checkout Session\n\n
API call: createCheckoutSession
Example arguments:
{
allowedPaymentMethods: ["scheme"],
}