{"title":"Reveal PIN using Adyen's iOS SDK","category":"default","creationDate":1776961628,"content":"<p>You can allow your cardholders to access the PIN of their Adyen-issued card within your app. This page explains how to use <strong>Adyen's Card Reveal iOS SDK<\/strong> to securely reveal PINs in your user interface.<\/p>\n<p>To reveal a PIN in your user interface, you must first get the PIN data from Adyen. To securely request the data, you use a base64-encoded <a href=\"https:\/\/en.wikipedia.org\/wiki\/RSA_(cryptosystem)\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">RSA<\/a> public key and <a href=\"https:\/\/github.com\/Adyen\/adyen-card-reveal-ios\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Adyen's Card Reveal iOS SDK<\/a> to generate an encrypted session key.<\/p>\n<p>Use the session key to request a <a href=\"https:\/\/www.pcisecuritystandards.org\/glossary\/pin-block\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">PIN block<\/a> from Adyen. This PIN block contains the encrypted PIN data assigned to the Adyen-issued card. You can decrypt the PIN block using Adyen's Card Reveal iOS SDK, and then reveal the PIN to the cardholder on your interface.<\/p>\n<p>The following sequence diagram illustrates the workflow.<\/p>\n<p><img alt=\"\" src=\"\/user\/pages\/docs\/07.issuing\/17.manage-card-data\/04.reveal-pin-ios-sdk\/pin-reveal-sdk.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/p>\n<p>As shown in the diagram, the steps for revealing a PIN are:<\/p>\n<ol>\n<li><a href=\"#get-a-public-key\">Get a public key from Adyen<\/a>.<\/li>\n<li><a href=\"#generate-session-key\">Generate an encrypted session key<\/a>.<\/li>\n<li><a href=\"#request-pin-block\">Request the PIN block from Adyen<\/a>.<\/li>\n<li><a href=\"#decrypt-pin-block\">Decrypt the PIN block and reveal it in your user interface<\/a>.<\/li>\n<\/ol>\n<h2>Requirements<\/h2>\n<p>Make sure that:<\/p>\n<ul>\n<li>\n<p>You have <a href=\"\/pt\/issuing\/manage-access\/api-credentials-web-service\">API credentials<\/a> for the <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/overview\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Configuration API<\/a>.<\/p>\n<\/li>\n<li>\n<p>Your API credential has the <strong>Bank Issuing PIN Reveal Webservice role<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Your application uses iOS version 13.0 or higher.<\/p>\n<\/li>\n<li>\n<p>You installed <a href=\"https:\/\/github.com\/Adyen\/adyen-card-reveal-ios\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Adyen's Card Reveal iOS SDK<\/a>.<\/p>\n<\/li>\n<\/ul>\n<h2 id=\"get-a-public-key\">Get a public key from Adyen<\/h2>\n<p>You need a base64-encoded <a href=\"https:\/\/en.wikipedia.org\/wiki\/RSA_(cryptosystem)\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">RSA<\/a> public key to <a href=\"#encrypt-aes-key\">generate an encrypted session key<\/a>. Use the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/overview\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Configuration API<\/a> to get the public key from Adyen.<\/p>\n<p>To get a public key:<\/p>\n<ol>\n<li>\n<p>Make a GET  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/get\/publicKey\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/publicKey<\/a> request, specifying the following query parameters:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/get\/publicKey#query-purpose\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">purpose<\/a>&#58; <strong>pinReveal<\/strong><\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/get\/publicKey#query-format\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">format<\/a>&#58; <strong>pem<\/strong><\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get a public key'\" :id=\"'get-public-key-ios'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/balanceplatform-api-test.adyen.com\\\/bcl\\\/v2\\\/publicKey?purpose=pinReveal&amp;format=pem \\\\\\n-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-X GET \\\\\\n-d ''&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v33.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.balanceplatform.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.service.balancePlatform.*;\\n\\nClient client = new Client(\\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;, Environment.TEST);\\n\\\/\\\/ Send the request\\nManageCardPinApi service = new ManageCardPinApi(client);\\nPublicKeyResponse response = service.publicKey(\\&quot;String\\&quot;, \\&quot;String\\&quot;, null);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;&lt;?php\\n\\\/\\\/ Adyen PHP API Library v24.0.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Service\\\\BalancePlatform\\\\ManageCardPINApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;);\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n$requestOptions['queryParams'] = array('purpose' =&gt; 'string', 'format' =&gt; 'string');\\n\\n\\\/\\\/ Send the request\\n$service = new ManageCardPINApi($client);\\n$response = $service-&gt;publicKey($requestOptions);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v28.0.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.BalancePlatform;\\nusing Adyen.Service.BalancePlatform;\\n\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Send the request\\nvar service = new ManageCardPINService(client);\\nvar response = service.PublicKey(purpose: \\&quot;string\\&quot;, format: \\&quot;string\\&quot;);&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v23.3.0\\nconst { Client, BalancePlatformAPI } = require('@adyen\\\/api-library');\\n\\nconst client = new Client({ apiKey: \\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot; });\\n\\n\\\/\\\/ Send the request\\nconst balancePlatformAPI = new BalancePlatformAPI(client);\\nconst response = balancePlatformAPI.ManageCardPINApi.publicKey(\\&quot;string\\&quot;, \\&quot;string\\&quot;);&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v17.0.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v17\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v17\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v17\\\/src\\\/balancePlatform\\&quot;\\n)\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Send the request\\nservice := client.BalancePlatform()\\nreq := service.ManageCardPINApi.PublicKeyInput()\\nreq = req.Purpose(\\&quot;string\\&quot;).Format(\\&quot;string\\&quot;)\\nres, httpRes, err := service.ManageCardPINApi.PublicKey(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v13.3.0\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\nquery_parameters = {\\n  \\&quot;purpose\\&quot; : \\&quot;string\\&quot;,\\n  \\&quot;format\\&quot; : \\&quot;string\\&quot;\\n}\\n\\n# Send the request\\nresult = adyen.balancePlatform.manage_card_pin_api.public_key(query_parameters=query_parameters)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v10.1.1\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_BALANCE_PLATFORM_API_KEY'\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nquery_params = {\\n  :purpose =&gt; 'string',\\n  :format =&gt; 'string'\\n}\\n\\n# Send the request\\nresult = adyen.balancePlatform.manage_card_pin_api.public_key(query_params: query_params)&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v23.3.0\\nimport { Client, BalancePlatformAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\nconst client = new Client({ apiKey: \\&quot;ADYEN_BALANCE_PLATFORM_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot; });\\n\\n\\\/\\\/ Send the request\\nconst balancePlatformAPI = new BalancePlatformAPI(client);\\nconst response = balancePlatformAPI.ManageCardPINApi.publicKey(\\&quot;string\\&quot;, \\&quot;string\\&quot;);&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains:<\/p>\n<ul>\n<li>The public key<\/li>\n<li>The expiry date of the public key<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"publicKey\\\": \\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMII...\\\",\\n    \\\"publicKeyExpiryDate\\\": \\\"2023-12-12\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Pass the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/get\/publicKey#responses-200-publicKey\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">publicKey<\/a> to your client.<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"generate-session-key\">Generate an encrypted session key<\/h2>\n<p>You need an encrypted symmetric session key to securely request the card details from Adyen. Generate the encrypted session key using the <a href=\"#get-a-public-key\">public key<\/a> and the Adyen's Card Reveal iOS SDK. The steps are as follows:<\/p>\n<ol>\n<li>\n<p>Initialize the <code>PinRevealService<\/code> method.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initialize the service'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"let revealService = PinRevealService()\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Call the <code>generateEncryptedKey<\/code> method, passing the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/get\/publicKey#responses-200-publicKey\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">publicKey<\/a> as a parameter.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Generate encrypted session key'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"let encryptedKey = try revealService.generateEncryptedKey(withPem: publicKey)\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<p>Now, <code>encryptedKey<\/code> contains the encrypted symmetric session key that you need to request the PIN block from Adyen.<\/p>\n<h2 id=\"request-pin-block\">Request the PIN block from Adyen<\/h2>\n<p>Request from Adyen the <a href=\"https:\/\/www.pcisecuritystandards.org\/glossary\/pin-block\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">PIN block<\/a> that contains the encrypted PIN data:<\/p>\n<ol>\n<li>\n<p>Make a POST&nbsp; <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/pins\/reveal<\/a> request and specify the following parameters:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#request-paymentInstrumentId\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">paymentInstrumentId<\/a><\/td>\n<td>The unique identifier of the card for which you are revealing the PIN.<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#request-encryptedKey\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">encryptedKey<\/a><\/td>\n<td>The <a href=\"#generate-session-key\">encrypted symmetric session key<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Request PIN block'\" :id=\"'request-pin-block'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/balanceplatform-api-test.adyen.com\\\/bcl\\\/v2\\\/pins\\\/reveal \\\\\\n-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-X POST \\\\\\n-d '{\\n    \\&quot;paymentInstrumentId\\&quot;: \\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;,\\n    \\&quot;encryptedKey\\&quot;: \\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v25.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.balancePlatform.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.service.balancePlatform.*;\\n\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\n\\\/\\\/ Create the request object(s)\\nRevealPinRequest revealPinRequest = new RevealPinRequest()\\n  .encryptedKey(\\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;)\\n  .paymentInstrumentId(\\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;);\\n\\n\\\/\\\/ Make the API call\\nManageCardPinApi service = new ManageCardPinApi(client);\\nRevealPinResponse response = service.revealCardPin(revealPinRequest, null);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v17.4.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\BalancePlatform\\\\RevealPinRequest;\\nuse Adyen\\\\Service\\\\BalancePlatform\\\\ManageCardPINApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n\\n\\\/\\\/ Create the request object(s)\\n$revealPinRequest = new RevealPinRequest();\\n$revealPinRequest\\n  -&gt;setEncryptedKey(\\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;)\\n  -&gt;setPaymentInstrumentId(\\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;);\\n\\n\\\/\\\/ Make the API call\\n$service = new ManageCardPINApi($client);\\n$response = $service-&gt;revealCardPin($revealPinRequest);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v14.4.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.BalancePlatform;\\nusing Adyen.Service.BalancePlatform;\\n\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Create the request object(s)\\nRevealPinRequest revealPinRequest = new RevealPinRequest\\n{\\n  EncryptedKey = \\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;,\\n  PaymentInstrumentId = \\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;\\n};\\n\\n\\\/\\\/ Make the API call\\nvar service = new ManageCardPINService(client);\\nvar response = service.RevealCardPin(revealPinRequest);&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, BalancePlatformAPI } = require('@adyen\\\/api-library');\\n\\\/\\\/ Initialize the client object\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst revealPinRequest = {\\n  paymentInstrumentId: \\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;,\\n  encryptedKey: \\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;\\n}\\n\\n\\\/\\\/ Make the API call\\nconst balancePlatformAPI = new BalancePlatformAPI(client);\\nconst response = balancePlatformAPI.ManageCardPINApi.revealCardPin(revealPinRequest);&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v9.3.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/balancePlatform\\&quot;\\n)\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\nrevealPinRequest := balancePlatform.RevealPinRequest{\\n  EncryptedKey: \\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;,\\n  PaymentInstrumentId: \\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;,\\n}\\n\\n\\\/\\\/ Make the API call\\nservice := client.BalancePlatform()\\nreq := service.ManageCardPINApi.RevealCardPinInput().RevealPinRequest(revealPinRequest)\\nres, httpRes, err := service.ManageCardPINApi.RevealCardPin(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v12.2.0\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;paymentInstrumentId\\&quot;: \\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;,\\n  \\&quot;encryptedKey\\&quot;: \\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;\\n}\\n\\n# Make the API call\\nresult = adyen.balancePlatform.manage_card_pin_api.reveal_card_pin(request=json_request)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.3.0\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nrequest_body = {\\n  :paymentInstrumentId =&gt; 'PI3227C223222B5BPCMFXD2XG',\\n  :encryptedKey =&gt; '75989E8881284D10153ABACF022EEA09F5...'\\n}\\n\\n# Make the API call\\nresult = adyen.balancePlatform.manage_card_pin_api.reveal_card_pin(request_body)&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, BalancePlatformAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\\/\\\/ Initialize the client object\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst revealPinRequest: Types.balancePlatform.RevealPinRequest = {\\n  encryptedKey: \\&quot;75989E8881284D10153ABACF022EEA09F5...\\&quot;,\\n  paymentInstrumentId: \\&quot;PI3227C223222B5BPCMFXD2XG\\&quot;\\n};\\n\\n\\\/\\\/ Make the API call\\nconst balancePlatformAPI = new BalancePlatformAPI(client);\\nconst response = balancePlatformAPI.ManageCardPINApi.revealCardPin(revealPinRequest);&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains: <\/p>\n<ul>\n<li>An  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#responses-200-encryptedPinBlock\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">encryptedPinBlock<\/a>: An <a href=\"https:\/\/listings.pcisecuritystandards.org\/documents\/Implementing_ISO_Format_4_PIN_Blocks_Information_Supplement.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">ISO Format 4 encrypted PIN block<\/a><\/li>\n<li>A  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#responses-200-token\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">token<\/a> that you need for decrypting the PIN block<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"encryptedPinBlock\\\": \\\"63E5060591EF65F48DD1D4FECD0FECD5\\\",\\n    \\\"token\\\": \\\"5555341244441115\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Pass  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#responses-200-encryptedPinBlock\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">encryptedPinBlock<\/a> and  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#responses-200-token\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">token<\/a> to your client.<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"decrypt-pin-block\">Decrypt the PIN block and reveal the PIN<\/h2>\n<p>Use the Adyen's Card Reveal iOS SDK to decrypt and reveal the PIN as follows:<\/p>\n<ol>\n<li>\n<p>Call the <code>pin<\/code> method to decrypt the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#responses-200-encryptedPinBlock\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">encryptedPinBlock<\/a> using the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/balanceplatform\/latest\/post\/pins\/reveal#responses-200-token\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">token<\/a>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Decrypt PIN block'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"let decryptedPin = revealService.pin(from: encryptedPinBlock, token: token)\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Pass the <code>decryptedPin<\/code> to your app.<\/p>\n<\/li>\n<li>\n<p>Reveal the <code>decryptedPin<\/code> on your user interface.<\/p>\n<\/li>\n<\/ol>","url":"https:\/\/docs.adyen.com\/pt\/issuing\/manage-card-data\/reveal-pin-ios-sdk","articleFields":{"description":"Allow your cardholders see their personal identification number (PIN).","parameters":{"directoryPath":"\/issuing"}},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/issuing\/manage-card-data\/reveal-pin-ios-sdk","title":"Reveal PIN using Adyen's iOS SDK","content":"You can allow your cardholders to access the PIN of their Adyen-issued card within your app. This page explains how to use Adyen's Card Reveal iOS SDK to securely reveal PINs in your user interface.\nTo reveal a PIN in your user interface, you must first get the PIN 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.\nUse the session key to request a PIN block from Adyen. This PIN block contains the encrypted PIN data assigned to the Adyen-issued card. You can decrypt the PIN block using Adyen's Card Reveal iOS SDK, and then reveal the PIN to the cardholder on your interface.\nThe following sequence diagram illustrates the workflow.\n\nAs shown in the diagram, the steps for revealing a PIN are:\n\nGet a public key from Adyen.\nGenerate an encrypted session key.\nRequest the PIN block from Adyen.\nDecrypt the PIN block and reveal it in your user interface.\n\nRequirements\nMake sure that:\n\n\nYou have API credentials for the Configuration API.\n\n\nYour API credential has the Bank Issuing PIN Reveal Webservice role.\n\n\nYour application uses iOS version 13.0 or higher.\n\n\nYou installed Adyen's Card Reveal iOS SDK.\n\n\nGet a public key from Adyen\nYou need a base64-encoded RSA public key to generate an encrypted session key. Use the  Configuration API to get the public key from Adyen.\nTo get a public key:\n\n\nMake a GET  \/publicKey request, specifying the following query parameters:\n\n purpose&#58; pinReveal\n format&#58; pem\n\n\n\n\nThe response contains:\n\nThe public key\nThe expiry date of the public key\n\n\n\n\n\n\nPass the  publicKey to your client.\n\n\nGenerate an encrypted session key\nYou 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:\n\n\nInitialize the PinRevealService method.\n\n\n\n\n\nCall the generateEncryptedKey method, passing the  publicKey as a parameter.\n\n\n\n\n\nNow, encryptedKey contains the encrypted symmetric session key that you need to request the PIN block from Adyen.\nRequest the PIN block from Adyen\nRequest from Adyen the PIN block that contains the encrypted PIN data:\n\n\nMake a POST&nbsp; \/pins\/reveal request and specify the following parameters:\n\n\n\nParameter\nDescription\n\n\n\n\n paymentInstrumentId\nThe unique identifier of the card for which you are revealing the PIN.\n\n\n encryptedKey\nThe encrypted symmetric session key.\n\n\n\n\n\n\nThe response contains: \n\nAn  encryptedPinBlock: An ISO Format 4 encrypted PIN block\nA  token that you need for decrypting the PIN block\n\n\n\n\n\n\nPass  encryptedPinBlock and  token to your client.\n\n\nDecrypt the PIN block and reveal the PIN\nUse the Adyen's Card Reveal iOS SDK to decrypt and reveal the PIN as follows:\n\n\nCall the pin method to decrypt the  encryptedPinBlock using the  token.\n\n\n\n\n\nPass the decryptedPin to your app.\n\n\nReveal the decryptedPin on your user interface.\n\n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Adyen Issuing","lvl2":"Manage card data","lvl3":"Reveal PIN using Adyen's iOS SDK"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/issuing","lvl2":"https:\/\/docs.adyen.com\/pt\/issuing\/manage-card-data","lvl3":"\/pt\/issuing\/manage-card-data\/reveal-pin-ios-sdk"},"levels":4,"category":"Issuing","category_color":"green","tags":["Reveal","using","Adyen's"]},"articleFiles":{"pin-reveal-sdk.svg":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/07.issuing\/17.manage-card-data\/04.reveal-pin-ios-sdk\/pin-reveal-sdk.svg?decoding=auto&amp;fetchpriority=auto\" \/>","request-pin-block.js":"<p alt=\"\">request-pin-block.js<\/p>"}}
