Pesquisar

Are you looking for test card numbers?

Would you like to contact support?

Atenção, esta página não se encontra disponível em Português
Payment-method icon

Cards Drop-in integration

Add cards to an existing Drop-in integration.

On this page, you can find additional configuration for adding cards to your Drop-in integration.

Before you begin

This page assumes you've already:

API reference

You don't need to send additional fields for cards. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:

You can also send additional fields for specific use cases, for example if you want to present debit and credit cards separately.

Presenting debit and credit cards separately

Select which endpoint you're integrating:

This is the default with Drop-in v5.0.0 or later.

To split debit and credit cards in your payment form, include in your POST /sessions request splitCardFundingSources: true.

If you implemented an advanced use case, or integrated Drop-in before v5.0.0.

To split debit and credit cards in your payment form, include in your POST /paymentMethods request splitCardFundingSources: true.

Drop-in then automatically renders separate payment forms for Credit card and Debit card. If you sent a request with countryCode of SE, Drop-in automatically presents Debit Card before Credit Card, in order to comply with Swedish legislations.

Drop-in configuration

Optional configuration

You can include the following optional configuration for cards:

Field Description Default
name String that is used to display the payment method name to the shopper. Depends on the shopperLocale specified in /paymentMethods request.
showStoredPaymentMethods Set to false if you don't want Drop-in to show previously stored payment methods in the payment method list. true
brands Array of card brands that will be recognized. For a list of possible values, refer to Supported card types. ['mc','visa','amex']
brandsConfiguration v 4.5.0 Object where you can customize the icons for different brands. For example, to customize the icon for Visa, include inside the brandsConfiguration:
visa: { icon: 'https://...' }

showBrandIcon Set to false to have Drop-in not show the brand logo when the card brand has been recognized. true
enableStoreDetails Set to true to show the check box for saving the card details for recurring payments. false
hasHolderName Set to true to show the input field for the card holder name. false
holderNameRequired Set to true to make the card holder name a required field. To show the field, you additionally need to set hasHolderName to true. false
positionHolderNameOnTop v 4.2.0 Renders the cardholder name field at the top of the payment form. false
hideCVC Set to true to hide the CVC field. false
socialSecurityNumberMode v 4.2.0 Renders a social security number field. For example, this is required for certain card payments in Brazil. Possible values are:
- show: Always renders the field.
- hide: Never renders the field.
- auto: Renders the field based on the card's BIN.
auto
styles Set a style object to customize the card input fields.
For a list of supported properties, refer to Styling card input fields.
Refer to
Default styles and labels.

billingAddressRequired v 3.5.0 Set to true to collect the shopper's billing address. false
billingAddressAllowedCountries Specify allowed country codes for the billing address. For example, ['US', 'CA', 'BR']. The Country field dropdown menu shows a list of all countries.
data Object that contains placeholder information that you can use to prefill fields.
For example:
- holderName: Placeholder for the card holder name field.
- billingAddress: Object that contains placeholder information for the billing address such as street, postalCode, city, country, and stateOrProvince.
Empty
installmentOptions If you want to offer credit card installments, specify here the numbers of monthly installments that the shopper can choose from.
For example, to have 2, and 3, and 4 as the default installment options for all cards:
{ "card": { "values": [2, 3, 4] }}.

v 3.15.0 You can also configure plans for Japanese installments: regular, revolving, or both.
Refer to Show installment payment options for a code sample.
v 3.15.0
plans: regular

minimumExpiryDate v 4.3.0 If a shopper enters a date that is earlier than specified here, they will see the following error:
"Your card expires before check out date."
Format: mm/yy

showInstallmentAmounts v 3.15.0 If you want to offer credit card installments, set to true to show the payment amount per installment.
Refer to Show installment payment options for a code sample.
false

Events

You can also customize your shopper's experience when specific events occur.

Event Description
onChange Called when the shopper enters data in the card input fields.
onLoad Called once all the card input fields have been created but are not yet ready to use.
onConfigSuccess Called once the card input fields are ready to use.
onFieldValid Called when a field becomes valid and also if a valid field changes and becomes invalid. For the card number field, it returns the last 4 digits of the card number.
onBrand Called once we detect the card brand.
onError Called in case of an invalid card number, invalid expiry date, or incomplete field. Called again when errors are cleared.
onFocus Called when a field gains or loses focus.
onBinLookup v 3.21.0 Provides the type of the card, and the brands, supportedBrands, and detectedBrands arrays. Called as the user inputs the PAN.
onBinValue v 3.10.1 Provides the BIN Number of the card (up to 6 digits), called as the user types in the PAN. Requires the client key for client-side authentication.

If you want to add optional configuration, include this in a configuration object. The following example shows how to configure Drop-in to collect the card holder name and billing address as required, and show a check box for saving card details for later payments:

const cardConfiguration = {
   hasHolderName: true,
   holderNameRequired: true,
   billingAddressRequired: true, // Set to true to show the billing address input fields.
   enableStoreDetails: true
};

If you created a cardConfiguration object, include this when creating a configuration object:

AdyenCheckout configuration
const configuration = {
  // ...  other required configuration
  paymentMethodsConfiguration: {
    card: cardConfiguration
  }
};

Card brand recognition

When the shopper is entering their card details, Drop-in tries to recognize the card brand. When successful, Drop-in renders the brand icon and the corresponding input field for the card security code (CVC, CVV, or CID).

Co-branded cards

Co-branded cards issued in Europe are rendered by Drop-in according to the European regulatory guidelines (EU IFR Regulation 2015/751 article 8). This means that Drop-in renders all supported brands, and allows the cardholder to choose their preferred brand. This functionality is supported in version 3.18.2 and later.

Recurring payments

Adyen's tokenization service allows you to securely store shopper's card details for recurring payments. To make recurring payments, you first need to create a shopper token, and then use the token to make future payments for the shopper.

Create a token

To store shopper's card details, set enableStoreDetails to true when creating an instance of Drop-in. This will show a check box to your shopper for saving their card details for future payments.

If the shopper chooses to save their card details when making a payment, the onSubmit method from Drop-in will include state.data.storePaymentMethod. Pass this to your server.

To create a token, include in your /payments request:

  • storePaymentMethod: The state.data.storePaymentMethod from your front end.
  • shopperReference: Your unique identifier for the shopper.

Show a stored card in your payment form

To show a stored card in your payment form, include in your /paymentMethods request:

  • shopperReference: The unique shopper identifier that you specified when creating the token.

If you don't want to show previously stored payment methods in the Drop-in payment method list, set showStoredPaymentMethods to false when creating an instance of Drop-in.

Make a payment with a token

When the shopper selects to pay, Drop-in calls the onSubmit event, which contains a state.data.

  1. Pass the state.data to your server.
  2. From your server, make a /payments request, specifying:
    • paymentMethod: The state.data.paymentMethod from the onSubmit event.
    • shopperReference: The unique shopper identifier that you specified when creating the token.
    • shopperInteractionContAuth.
    • recurringProcessingModel: CardOnFile.
    Payment request with a token
    curl https://checkout-test.adyen.com/v67/payments \
    -H "X-API-key: [Your API Key here]" \
    -H "Content-Type: application/json" \
    -d '{
     "amount":{
       "value":2000,
       "currency":"USD"
     },
     "paymentMethod":{
       "type":"scheme",
       "storedPaymentMethodId":"8415718415172204",
       "encryptedSecurityCode":"adyenjs_0_1_18$MT6ppy0FAMVMLH..."
     },
     "reference":"YOUR_ORDER_NUMBER",
     "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
     "returnUrl":"...",
     "shopperReference":"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
     "shopperInteraction":"ContAuth",
     "recurringProcessingModel":"CardOnFile"
    }'

The /payments response contains:

Response
{
   "pspReference": "8815329842815468",
   "resultCode": "Authorised"
}

You can also use tokens to make shopper-not-present payments for subscriptions or contracts. For more information, refer to Making a payment for a subscription or contract.

Test and go live

Before making live card payments:

  1. Test your integration using our test card numbers. You can check the status of test payments in your Customer Area > Transactions > Payments.
    If you want to test API calls but your client-side integration is not yet ready, add a test_ prefix to the test card credentials. Refer to test with encrypted card details.
  2. Add the cards that you want to accept in your live Customer Area.
  1. Before you can start accepting card payments in the live environment, you need to assess your PCI DSS compliance and submit the required Self-Assessment Questionnaire A document. For more information, refer to PCI DSS compliance guide.

See also