> ## Documentation Index
> Fetch the complete documentation index at: https://adyen-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Card Component v4.x.x Integration

> Add card payments to your existing Components integration.

This page explains how to add cards to your existing Android Components integration.

Our [Card Component](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md) renders the available cards in your payment form, and securely collects sensitive card information, so it doesn't touch your server.

## Requirements

| Requirement | Description |
| - | - |
| **Integration type** | Make sure that you have built an Advanced flow [Android Components integration](https://adyen-preview.mintlify.site/online-payments/build-your-integration/advanced-flow.md). |
| **Setup steps** | Before you begin: [Aadd the cards that you want to accept in your Customer Area](https://adyen-preview.mintlify.site/payment-methods/add-payment-methods). [Get your client key](#get-client-key). |

### Get your client key

1. Log in to your [Customer Area](https://ca-test.adyen.com/).
2. Go to **Developers** > **API credentials**, and select the credential username for your integration, for example **ws\@Company.\[YourCompanyAccount]**.
3. Under **Client settings** > **Authentication** select the **Client key** tab.
4. Select **Generate client key**.
5. Select the copy icon \*\*and store your client key securely in your system.
6. Under **Add allowed origins**, enter your [domains](https://adyen-preview.mintlify.site/development-resources/client-side-authentication#allowed-origins) and select **Add**.
7. Select **Save changes**.

## Show the available cards in your payment form

For information about the supported locations and currencies for each card, refer to [Payment methods](https://www.adyen.com/payment-methods).

To show the Card Component in your payment form, you need to:

1. Specify in your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request a combination of [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) and [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount). This is used to determine which cards are available to the shopper.

2. Deserialize the [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) response, and get the object with `type`: **scheme**.\
   For showing stored cards, get the object with `type`: **storedPaymentMethods**.

3. Add the Card Component:

   a. Import the Card Component to your `build.gradle` file.

   ```groovy theme={null}
     implementation "com.adyen.checkout:card:<latest-version>"
   ```

   For the latest version, refer to our [GitHub](https://github.com/Adyen/adyen-android).

   b. []()Create a `cardConfiguration` object, and pass your client key. You can also include [optional configuration](#optional-configuration), for example to make the cardholder name required.

   ```kotlin theme={null}
    val cardConfiguration = CardConfiguration.Builder(context, "YOUR_CLIENT_KEY")
         // Makes the cardholder name required
         .setHolderNameRequired(true)
         // When you are ready to accept live payments, change the value to one of our live environments.
         .setEnvironment(Environment.TEST)
         .build()
   ```

   c. []()Initialize the Card Component. Pass the object from the [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) response and the `cardConfiguration` object.

   ```kotlin theme={null}
      val cardComponent = CardComponent.PROVIDER.get(this@YourActivity, paymentMethod, cardConfiguration)
   ```

   d. Add the Card Component view to your layout.

   ```xml theme={null}
      <com.adyen.checkout.Card.CardView
             android:id="@+id/cardView"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"/>
   ```

   e. Attach the Component to the view to start getting your shopper's payment details.

   ```kotlin theme={null}
      cardView.attach(cardComponent, this@YourActivity)
   ```

   f. When shoppers enter their payment details, you start receiving updates. If `isValid` is true and the shopper proceeds to pay, pass the `paymentComponentState.data` to your server and [make a payment request](#make-a-payment).

   ```kotlin theme={null}
    cardComponent.observe(this) { paymentComponentState ->
       if (paymentComponentState?.isValid == true) {
          // When the shopper proceeds to pay, pass the `paymentComponentState.data` to your server to send a /payments request
          sendPayment(paymentComponentState.data)
       }
    }
   ```

### Optional configuration

When you create the [`CardConfiguration` ](https://adyen.github.io/adyen-android/card/com.adyen.checkout.card/-card-configuration/index.html)object, you can optionally add configuration parameters.

#### Address field configuration

Configure the postal code field in `AddressConfiguration.PostalCode`.

Include the following parameter:

| Parameter | Description | Default value |
| - | - | - |
| `addressFieldPolicy` | Set if shoppers are required to fill in the fields. Possible values: - **Required** - **Optional** - **OptionalForCardTypes**: include the `brand` parameter, which is a list of values of type `String` to specify which brands input is optional for. | **Required** |

**Address field settings**

```kotlin theme={null}
// Create a configuration object for the postal code field.
val addressConfiguration = AddressConfiguration.PostalCode(
    // Set it as optional for specific brands.
    addressFieldPolicy = AddressConfiguration.AddressFieldPolicy.OptionalForCardTypes(
       // Provide a list of strings to specify the brands.
       brands = listOf("jcb", "cup")))

// Set address configuration in card configuration object
val cardConfiguration = CardConfiguration.Builder(context, "YOUR_CLIENT_KEY")
    .setAddressConfiguration(addressConfiguration)
```

## Make a payment

When the shopper proceeds to pay, the Component returns the `paymentComponentState.data.paymentMethod`.

1. Pass the `paymentComponentState.data` to your server.

2. From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying:

   * `paymentMethod`: The `paymentComponentState.data.paymentMethod` from your client app.

```bash curl theme={null}
curl https://checkout-test.adyen.com/v72/payments \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
 "amount": {
   "currency": "USD",
   "value": 1000
 },
 "reference": "YOUR_ORDER_NUMBER",
 "{hint:paymentComponentState.data.paymentMethod from app}paymentMethod{/hint}": {
   "type": "scheme",
   "encryptedCardNumber": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
   "encryptedExpiryMonth": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
   "encryptedExpiryYear": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
   "encryptedSecurityCode": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
   "holderName": "S. Hopper"
 },
 "returnUrl": "adyencheckout://your.package.name",
 "merchantAccount": "ADYEN_MERCHANT_ACCOUNT"
}'
```

```java Java theme={null}
// Adyen Java API Library v27.0.0
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.model.checkout.*;
import java.time.OffsetDateTime;
import java.util.*;
import com.adyen.model.RequestOptions;
import com.adyen.service.checkout.*;

// For the live environment, additionally include your liveEndpointUrlPrefix.
Client client = new Client("ADYEN_API_KEY", Environment.TEST);

// Create the request object(s)
Amount amount = new Amount()
  .currency("USD")
  .value(1000L);

CardDetails cardDetails = new CardDetails()
  .encryptedCardNumber("adyenjs_0_1_18$MT6ppy0FAMVMLH...")
  .holderName("S. Hopper")
  .encryptedSecurityCode("adyenjs_0_1_18$MT6ppy0FAMVMLH...")
  .encryptedExpiryYear("adyenjs_0_1_18$MT6ppy0FAMVMLH...")
  .encryptedExpiryMonth("adyenjs_0_1_18$MT6ppy0FAMVMLH...")
  .type(CardDetails.TypeEnum.SCHEME);

PaymentRequest paymentRequest = new PaymentRequest()
  .reference("YOUR_ORDER_NUMBER")
  .amount(amount)
  .merchantAccount("ADYEN_MERCHANT_ACCOUNT")
  .paymentMethod(new CheckoutPaymentMethod(cardDetails))
  .returnUrl("adyencheckout://your.package.name");

// Send the request
PaymentsApi service = new PaymentsApi(client);
PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
```

```php PHP theme={null}
// Adyen PHP API Library v19.0.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\CheckoutPaymentMethod;
use Adyen\Model\Checkout\PaymentRequest;
use Adyen\Service\Checkout\PaymentsApi;

$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
// For the live environment, additionally include your liveEndpointUrlPrefix.
$client->setEnvironment(Environment::TEST);


// Create the request object(s)
$amount = new Amount();
$amount
  ->setCurrency("USD")
  ->setValue(1000);

$checkoutPaymentMethod = new CheckoutPaymentMethod();
$checkoutPaymentMethod
  ->setEncryptedCardNumber("adyenjs_0_1_18\$MT6ppy0FAMVMLH...")
  ->setHolderName("S. Hopper")
  ->setEncryptedSecurityCode("adyenjs_0_1_18\$MT6ppy0FAMVMLH...")
  ->setEncryptedExpiryYear("adyenjs_0_1_18\$MT6ppy0FAMVMLH...")
  ->setEncryptedExpiryMonth("adyenjs_0_1_18\$MT6ppy0FAMVMLH...")
  ->setType("scheme");

$paymentRequest = new PaymentRequest();
$paymentRequest
  ->setReference("YOUR_ORDER_NUMBER")
  ->setAmount($amount)
  ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT")
  ->setPaymentMethod($checkoutPaymentMethod)
  ->setReturnUrl("adyencheckout://your.package.name");

$requestOptions['idempotencyKey'] = 'UUID';

// Send the request
$service = new PaymentsApi($client);
$response = $service->payments($paymentRequest, $requestOptions);
```

```cs C# theme={null}
// Adyen .net API Library v17.0.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;

// For the live environment, additionally include your liveEndpointUrlPrefix.
var config = new Config()
{
    XApiKey = "ADYEN_API_KEY",
    Environment = Environment.Test
};
var client = new Client(config);

// Create the request object(s)
Amount amount = new Amount
{
  Currency = "USD",
  Value = 1000
};

CardDetails cardDetails = new CardDetails
{
  EncryptedCardNumber = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  HolderName = "S. Hopper",
  EncryptedSecurityCode = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  EncryptedExpiryYear = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  EncryptedExpiryMonth = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  Type = CardDetails.TypeEnum.Scheme
};

PaymentRequest paymentRequest = new PaymentRequest
{
  Reference = "YOUR_ORDER_NUMBER",
  Amount = amount,
  MerchantAccount = "ADYEN_MERCHANT_ACCOUNT",
  PaymentMethod = new CheckoutPaymentMethod(cardDetails),
  ReturnUrl = "adyencheckout://your.package.name"
};

// Send the request
var service = new PaymentsService(client);
var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
```

```js NodeJS (JavaScript) theme={null}
// Adyen Node API Library v18.0.0
// Require the parts of the module you want to use
const { Client, CheckoutAPI } = require('@adyen/api-library');
// Initialize the client object
// For the live environment, additionally include your liveEndpointUrlPrefix.
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

// Create the request object(s)
const paymentRequest = {
  amount: {
    currency: "USD",
    value: 1000
  },
  reference: "YOUR_ORDER_NUMBER",
  paymentMethod: {
    type: "scheme",
    encryptedCardNumber: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    encryptedExpiryMonth: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    encryptedExpiryYear: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    encryptedSecurityCode: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    holderName: "S. Hopper"
  },
  returnUrl: "adyencheckout://your.package.name",
  merchantAccount: "ADYEN_MERCHANT_ACCOUNT"
}

// Send the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
```

```go Go theme={null}
// Adyen Go API Library v10.4.0
import (
  "context"
  "github.com/adyen/adyen-go-api-library/v9/src/common"
  "github.com/adyen/adyen-go-api-library/v9/src/adyen"
  "github.com/adyen/adyen-go-api-library/v9/src/checkout"
)
// For the live environment, additionally include your liveEndpointUrlPrefix.
client := adyen.NewClient(&common.Config{
  ApiKey:      "ADYEN_API_KEY",
  Environment: common.TestEnv,
})

// Create the request object(s)
amount := checkout.Amount{
  Currency: "USD",
  Value: 1000,
}

cardDetails := checkout.CardDetails{
  EncryptedCardNumber: common.PtrString("adyenjs_0_1_18$MT6ppy0FAMVMLH..."),
  HolderName: common.PtrString("S. Hopper"),
  EncryptedSecurityCode: common.PtrString("adyenjs_0_1_18$MT6ppy0FAMVMLH..."),
  EncryptedExpiryYear: common.PtrString("adyenjs_0_1_18$MT6ppy0FAMVMLH..."),
  EncryptedExpiryMonth: common.PtrString("adyenjs_0_1_18$MT6ppy0FAMVMLH..."),
  Type: common.PtrString("scheme"),
}

paymentRequest := checkout.PaymentRequest{
  Reference: "YOUR_ORDER_NUMBER",
  Amount: amount,
  MerchantAccount: "ADYEN_MERCHANT_ACCOUNT",
  PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&cardDetails),
  ReturnUrl: "adyencheckout://your.package.name",
}

// Send the request
service := client.Checkout()
req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
```

```py Python theme={null}
# Adyen Python API Library v12.5.1
import Adyen

adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
# For the live environment, additionally include your liveEndpointUrlPrefix.
adyen.client.platform = "test" # The environment to use library in.

# Create the request object(s)
json_request = {
  "amount": {
    "currency": "USD",
    "value": 1000
  },
  "reference": "YOUR_ORDER_NUMBER",
  "paymentMethod": {
    "type": "scheme",
    "encryptedCardNumber": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    "encryptedExpiryMonth": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    "encryptedExpiryYear": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    "encryptedSecurityCode": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
    "holderName": "S. Hopper"
  },
  "returnUrl": "adyencheckout://your.package.name",
  "merchantAccount": "ADYEN_MERCHANT_ACCOUNT"
}

# Send the request
result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
```

```rb Ruby theme={null}
# Adyen Ruby API Library v9.5.1
require "adyen-ruby-api-library"

adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
# For the live environment, additionally include your liveEndpointUrlPrefix.
adyen.env = :test # Set to "live" for live environment

# Create the request object(s)
request_body = {
  :amount => {
    :currency => 'USD',
    :value => 1000
  },
  :reference => 'YOUR_ORDER_NUMBER',
  :paymentMethod => {
    :type => 'scheme',
    :encryptedCardNumber => 'adyenjs_0_1_18$MT6ppy0FAMVMLH...',
    :encryptedExpiryMonth => 'adyenjs_0_1_18$MT6ppy0FAMVMLH...',
    :encryptedExpiryYear => 'adyenjs_0_1_18$MT6ppy0FAMVMLH...',
    :encryptedSecurityCode => 'adyenjs_0_1_18$MT6ppy0FAMVMLH...',
    :holderName => 'S. Hopper'
  },
  :returnUrl => 'adyencheckout://your.package.name',
  :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT'
}

# Send the request
result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
```

```ts NodeJS (TypeScript) theme={null}
// Adyen Node API Library v18.0.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
// For the live environment, additionally include your liveEndpointUrlPrefix.
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

// Create the request object(s)
const amount: Types.checkout.Amount = {
  currency: "USD",
  value: 1000
};

const cardDetails: Types.checkout.CardDetails = {
  encryptedCardNumber: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  holderName: "S. Hopper",
  encryptedSecurityCode: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  encryptedExpiryYear: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  encryptedExpiryMonth: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
  type: Types.checkout.CardDetails.TypeEnum.Scheme
};

const paymentRequest: Types.checkout.PaymentRequest = {
  reference: "YOUR_ORDER_NUMBER",
  amount: amount,
  merchantAccount: "ADYEN_MERCHANT_ACCOUNT",
  paymentMethod: cardDetails,
  returnUrl: "adyencheckout://your.package.name"
};

// Send the request
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
```

The [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response contains:

* [pspReference](https://docs.adyen.com/api-explorer/Checkout/latest/payments#responses-200-pspReference): Our unique identifier for the transaction.
* `resultCode`: Use this to [present the payment result to your shopper](#present-the-payment-result).
* `merchantReference`: The `reference` from the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request.
* `additionalData`: Additional information about the transaction.\
  To specify the fields that you want to receive in `additionalData`, log in to your [Customer Area](https://ca-test.adyen.com/), and go to **Developers** > **Additional data**.

**/payments response**

```json theme={null}
{
  "additionalData": {
    "cardSummary": "1111"
  },
  "pspReference": "851572424333194G",
  "resultCode": "Authorised",
  "merchantReference": "YOUR_ORDER_NUMBER"
}
```

## Present the payment result

Use the  [resultCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#responses-200-resultCode) from the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response to present the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a [webhook](https://adyen-preview.mintlify.site/development-resources/webhooks.md).

For card payments, you can receive the following `resultCode` values:

| resultCode | Description | Action to take |
| - | - | - |
| **Authorised** | The payment was successful. | Inform the shopper that the payment has been successful. If you are using [manual capture](https://adyen-preview.mintlify.site/online-payments/capture#manual-capture), you also need to [capture](https://adyen-preview.mintlify.site/online-payments/capture) the payment. |
| **Cancelled** | The shopper cancelled the payment. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. |
| **Error** | There was an error when the payment was being processed. For more information, check the [`refusalReason` ](https://adyen-preview.mintlify.site/development-resources/refusal-reasons)field. | Inform the shopper that there was an error processing their payment. |
| **Refused** | The payment was refused. For more information, check the [`refusalReason` ](https://adyen-preview.mintlify.site/development-resources/refusal-reasons)field. | Ask the shopper to try the payment again using a different payment method. |

Additional `resultCode` values are possible in case of the 3D Secure authentication flow. For more information, refer to [Result codes](https://adyen-preview.mintlify.site/online-payments/build-your-integration/payment-result-codes.md#3d-secure-authentication).

## Recurring payments

Adyen's [tokenization service](https://adyen-preview.mintlify.site/online-payments/tokenization) 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

When a shopper chooses to pay with card, the Card Component renders a switch for saving the card details for future payments. If a shopper selects this option, the `paymentComponentState` from the Component will include `data.storePaymentMethod`. Pass this to your server.

To create a token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request:

* `storePaymentMethod`: The `paymentComponentState.data.storePaymentMethod` from your client app.
* [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference): Your unique identifier for the shopper.

If you do not want to show the switch for saving card details, set `showStoredPaymentMethods` to **false** when [creating the `cardConfiguration` object](#create-card-configuration):

```kotlin theme={null}
     val cardConfiguration = CardConfiguration.Builder(context, "YOUR_CLIENT_KEY")
          // hides the switch for saving card details
          .setShowStorePaymentField(false)
          .build()
```

### Show a stored card in your payment form

When the shopper proceeds to pay, the Component returns the `paymentComponentState.data.paymentMethod`.

1. Pass the `paymentComponentState.data.paymentMethod` to your server.

2. From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying:

   * `paymentMethod`: The `paymentComponentState.data.paymentMethod` from your client app.

   **Make a payment with a token**

   #### curl

   ```bash theme={null}
   curl https://checkout-test.adyen.com/checkout/v72/payments \
   -H 'x-api-key: ADYEN_API_KEY' \
   -H 'content-type: application/json' \
   -d '{
      "amount":{
         "value":2000,
         "currency":"USD"
      },
      "paymentMethod":{
         "type":"scheme",
         "{hint:Previously known as recurringDetailReference}storedPaymentMethodId{/hint}":"M5N7TQ4TG5PFWR50"
      },
      "reference":"YOUR_ORDER_REFERENCE",
      "shopperInteraction": "ContAuth",
      "recurringProcessingModel": "UnscheduledCardOnFile",
      "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
      "shopperReference":"YOUR_SHOPPER_REFERENCE"
   }'
   ```

   #### Java

   ```java theme={null}
   // Adyen Java API Library v26.3.0
   import com.adyen.Client;
   import com.adyen.enums.Environment;
   import com.adyen.model.checkout.*;
   import java.time.OffsetDateTime;
   import java.util.*;
   import com.adyen.model.RequestOptions;
   import com.adyen.service.checkout.*;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   Client client = new Client("ADYEN_API_KEY", Environment.TEST);

   // Create the request object(s)
   Amount amount = new Amount()
     .currency("USD")
     .value(2000L);

   CardDetails cardDetails = new CardDetails()
     .storedPaymentMethodId("M5N7TQ4TG5PFWR50")
     .type(CardDetails.TypeEnum.SCHEME);

   PaymentRequest paymentRequest = new PaymentRequest()
     .reference("YOUR_ORDER_REFERENCE")
     .amount(amount)
     .merchantAccount("YOUR_MERCHANT_ACCOUNT")
     .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.UNSCHEDULEDCARDONFILE)
     .paymentMethod(new CheckoutPaymentMethod(cardDetails))
     .shopperInteraction(PaymentRequest.ShopperInteractionEnum.CONTAUTH)
     .shopperReference("YOUR_SHOPPER_REFERENCE");

   // Send the request
   PaymentsApi service = new PaymentsApi(client);
   PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
   ```

   #### PHP

   ```php theme={null}
   // Adyen PHP API Library v18.2.1
   use Adyen\Client;
   use Adyen\Environment;
   use Adyen\Model\Checkout\Amount;
   use Adyen\Model\Checkout\CheckoutPaymentMethod;
   use Adyen\Model\Checkout\PaymentRequest;
   use Adyen\Service\Checkout\PaymentsApi;

   $client = new Client();
   $client->setXApiKey("ADYEN_API_KEY");
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   $client->setEnvironment(Environment::TEST);


   // Create the request object(s)
   $amount = new Amount();
   $amount
     ->setCurrency("USD")
     ->setValue(2000);

   $checkoutPaymentMethod = new CheckoutPaymentMethod();
   $checkoutPaymentMethod
     ->setStoredPaymentMethodId("M5N7TQ4TG5PFWR50")
     ->setType("scheme");

   $paymentRequest = new PaymentRequest();
   $paymentRequest
     ->setReference("YOUR_ORDER_REFERENCE")
     ->setAmount($amount)
     ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
     ->setRecurringProcessingModel("UnscheduledCardOnFile")
     ->setPaymentMethod($checkoutPaymentMethod)
     ->setShopperInteraction("ContAuth")
     ->setShopperReference("YOUR_SHOPPER_REFERENCE");

   $requestOptions['idempotencyKey'] = 'UUID';

   // Send the request
   $service = new PaymentsApi($client);
   $response = $service->payments($paymentRequest, $requestOptions);
   ```

   #### C\#

   ```cs theme={null}
   // Adyen .net API Library v17.0.0
   using Adyen;
   using Environment = Adyen.Model.Environment;
   using Adyen.Model;
   using Adyen.Model.Checkout;
   using Adyen.Service.Checkout;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   var config = new Config()
   {
       XApiKey = "ADYEN_API_KEY",
       Environment = Environment.Test
   };
   var client = new Client(config);

   // Create the request object(s)
   Amount amount = new Amount
   {
     Currency = "USD",
     Value = 2000
   };

   CardDetails cardDetails = new CardDetails
   {
     StoredPaymentMethodId = "M5N7TQ4TG5PFWR50",
     Type = CardDetails.TypeEnum.Scheme
   };

   PaymentRequest paymentRequest = new PaymentRequest
   {
     Reference = "YOUR_ORDER_REFERENCE",
     Amount = amount,
     MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
     RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.UnscheduledCardOnFile,
     PaymentMethod = new CheckoutPaymentMethod(cardDetails),
     ShopperInteraction = PaymentRequest.ShopperInteractionEnum.ContAuth,
     ShopperReference = "YOUR_SHOPPER_REFERENCE"
   };

   // Send the request
   var service = new PaymentsService(client);
   var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
   ```

   #### Go

   ```go theme={null}
   // Adyen Go API Library v10.4.0
   import (
     "context"
     "github.com/adyen/adyen-go-api-library/v9/src/common"
     "github.com/adyen/adyen-go-api-library/v9/src/adyen"
     "github.com/adyen/adyen-go-api-library/v9/src/checkout"
   )
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   client := adyen.NewClient(&common.Config{
     ApiKey:      "ADYEN_API_KEY",
     Environment: common.TestEnv,
   })

   // Create the request object(s)
   amount := checkout.Amount{
     Currency: "USD",
     Value: 2000,
   }

   cardDetails := checkout.CardDetails{
     StoredPaymentMethodId: common.PtrString("M5N7TQ4TG5PFWR50"),
     Type: common.PtrString("scheme"),
   }

   paymentRequest := checkout.PaymentRequest{
     Reference: "YOUR_ORDER_REFERENCE",
     Amount: amount,
     MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
     RecurringProcessingModel: common.PtrString("UnscheduledCardOnFile"),
     PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&cardDetails),
     ShopperInteraction: common.PtrString("ContAuth"),
     ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"),
   }

   // Send the request
   service := client.Checkout()
   req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
   res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
   ```

   #### Python

   ```py theme={null}
   # Adyen Python API Library v12.5.1
   import Adyen

   adyen = Adyen.Adyen()
   adyen.client.xapikey = "ADYEN_API_KEY"
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.client.platform = "test" # The environment to use library in.

   # Create the request object(s)
   json_request = {
     "amount": {
       "value": 2000,
       "currency": "USD"
     },
     "paymentMethod": {
       "type": "scheme",
       "storedPaymentMethodId": "M5N7TQ4TG5PFWR50"
     },
     "reference": "YOUR_ORDER_REFERENCE",
     "shopperInteraction": "ContAuth",
     "recurringProcessingModel": "UnscheduledCardOnFile",
     "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
     "shopperReference": "YOUR_SHOPPER_REFERENCE"
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
   ```

   #### Ruby

   ```rb theme={null}
   # Adyen Ruby API Library v9.5.1
   require "adyen-ruby-api-library"

   adyen = Adyen::Client.new
   adyen.api_key = 'ADYEN_API_KEY'
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.env = :test # Set to "live" for live environment

   # Create the request object(s)
   request_body = {
     :amount => {
       :value => 2000,
       :currency => 'USD'
     },
     :paymentMethod => {
       :type => 'scheme',
       :storedPaymentMethodId => 'M5N7TQ4TG5PFWR50'
     },
     :reference => 'YOUR_ORDER_REFERENCE',
     :shopperInteraction => 'ContAuth',
     :recurringProcessingModel => 'UnscheduledCardOnFile',
     :merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
     :shopperReference => 'YOUR_SHOPPER_REFERENCE'
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
   ```

   #### NodeJS (TypeScript)

   ```ts theme={null}
   // Adyen Node API Library v17.3.0
   // Require the parts of the module you want to use
   import { Client, CheckoutAPI, Types } from "@adyen/api-library";
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const amount: Types.checkout.Amount = {
     currency: "USD",
     value: 2000
   };

   const cardDetails: Types.checkout.CardDetails = {
     storedPaymentMethodId: "M5N7TQ4TG5PFWR50",
     type: Types.checkout.CardDetails.TypeEnum.Scheme
   };

   const paymentRequest: Types.checkout.PaymentRequest = {
     reference: "YOUR_ORDER_REFERENCE",
     amount: amount,
     merchantAccount: "YOUR_MERCHANT_ACCOUNT",
     recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.UnscheduledCardOnFile,
     paymentMethod: cardDetails,
     shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.ContAuth,
     shopperReference: "YOUR_SHOPPER_REFERENCE"
   };

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

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](https://adyen-preview.mintlify.site/online-payments/tokenization/make-token-payments.md#make-a-subscription-or-unscheduled-card-on-file-payment).

## Test and go live

If your client-side integration isn't ready, you can [test API requests with encrypted card details](https://adyen-preview.mintlify.site/development-resources/test-cards-and-credentials/test-card-numbers.md#test-encrypted-card-details) by adding a `test_` prefix to the test card details.

Before making live card payments:

1. Test your integration using our [test card numbers](https://adyen-preview.mintlify.site/development-resources/test-cards-and-credentials/test-card-numbers.md). You can check the status of test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**.

2. [Add the cards that you want to accept](https://adyen-preview.mintlify.site/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/).

3. Configure the Component using the [client key](https://adyen-preview.mintlify.site/development-resources/client-side-authentication) from your [live Customer Area](https://ca-live.adyen.com/).

4. 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](https://adyen-preview.mintlify.site/development-resources/pci-dss-compliance-guide#mobile-in-app-online-payments-integration).

## See also

* [Android Components integration guide](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md)
* [Tokenization](https://adyen-preview.mintlify.site/online-payments/tokenization)
* [Webhooks](https://adyen-preview.mintlify.site/development-resources/webhooks.md)
* [API Explorer](https://docs.adyen.com/api-explorer/Checkout/latest/overview)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.