Issuin icon

Reveal card details using Adyen's iOS SDK

Allow your cardholders to see their card verification code (CVC), primary account number (PAN), and expiration date.

You can allow your cardholders to access the details of their Adyen-issued card within your app. This page explains how to use Adyen's Card Reveal iOS SDK to securely reveal card details in your user interface, such as:

  • Card verification code (CVC)
  • Primary account number (PAN)
  • Expiration date

To reveal the card details in your user interface, you must first get the card details data from Adyen. To securely request the data, you use a base64-encoded RSA public key and Adyen's Card Reveal iOS SDK to generate an encrypted session key.

Use the session key to request from Adyen the encrypted card details assigned to an Adyen-issued card. You can decrypt this card data using Adyen's Card Reveal iOS SDK, and then reveal them to the cardholder.

The following sequence diagram illustrates the workflow.

As shown in the diagram, the steps for revealing the card details are:

  1. Get a public key from Adyen.
  2. Generate an encrypted session key.
  3. Request card details from Adyen.
  4. Decrypt and reveal the card details in your user interface.

Requirements

Ensure that:

Get a public key from Adyen

You need a base64-encoded RSA public key to generate an encrypted session key. Use the Configuration API to get the public key from Adyen.

To get a public key:

  1. Make a GET /publicKey request, specifying the following query parameters:

    The response contains:

    • The public key
    • The expiry date of the public key
  2. Pass the publicKey to your client.

Generate an encrypted session key

You need an encrypted symmetric session key to securely request the card details from Adyen. Generate the encrypted session key using the public key and Adyen's Card Reveal iOS SDK. The steps are as follows:

  1. Initialize the CardRevealService method.

  2. Call the generateEncryptedKey method, passing the publicKey as a parameter.

Now, encryptedKey contains the encrypted symmetric session key that you need to request the card details from Adyen.

Request card details from Adyen

Request from Adyen the encrypted card details as follows:

  1. Make a POST /paymentInstruments/reveal request and specify the following parameters:

    Parameter Description
    paymentInstrumentId The unique identifier of the card for which you are revealing the details.
    encryptedKey The encrypted symmetric session key.

    The response contains the encryptedData.

  2. Pass the encryptedData to your client.

Decrypt and reveal card details

Use Adyen's Card Reveal iOS SDK to decrypt and reveal the card data as follows:

  1. Call the cardDetails method to decrypt the encryptedData.

  2. Pass the decryptedCardDetails to your app.

  3. Reveal the decryptedCardDetails in your user interface.