- Get a public key from Adyen.
- Generate an encrypted session key.
- Request the PIN block from Adyen.
- Decrypt the PIN block and reveal it in your user interface.
Requirements
Make sure that:- You have API credentials for the Configuration API.
- Your API credential has the Bank Issuing PIN Reveal Webservice role.
- Your application uses iOS version 13.0 or higher.
- You installed Adyen’s Card Reveal iOS SDK.
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:-
Make a GET /publicKey request, specifying the following query parameters:
Get a public key
curl
Java
PHP
C#
NodeJS (JavaScript)
Go
Python
Ruby
NodeJS (TypeScript)
The response contains:- The public key
- The expiry date of the public key
- 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 the Adyen’s Card Reveal iOS SDK. The steps are as follows:-
Initialize the
PinRevealServicemethod. Initialize the service -
Call the
generateEncryptedKeymethod, passing the publicKey as a parameter. Generate encrypted session key
encryptedKey contains the encrypted symmetric session key that you need to request the PIN block from Adyen.
Request the PIN block from Adyen
Request from Adyen the PIN block that contains the encrypted PIN data:-
Make a POST /pins/reveal request and specify the following parameters:
Request PIN block
curl
Java
PHP
C#
NodeJS (JavaScript)
Go
Python
Ruby
NodeJS (TypeScript)
The response contains:- An encryptedPinBlock: An ISO Format 4 encrypted PIN block
- A token that you need for decrypting the PIN block
- Pass encryptedPinBlock and token to your client.
Decrypt the PIN block and reveal the PIN
Use the Adyen’s Card Reveal iOS SDK to decrypt and reveal the PIN as follows:-
Call the
pinmethod to decrypt the encryptedPinBlock using the token. Decrypt PIN block -
Pass the
decryptedPinto your app. -
Reveal the
decryptedPinon your user interface.