{"title":"Apple Pay in-app provisioning","category":"default","creationDate":1679910960,"content":"<div class=\"notices green\">\n<p>This page is a work in progress. Some of the APIs, documentation, and processes may change. If you have any feedback, reach out to your Adyen contact.<\/p>\n<\/div>\n<p>Apple Pay in-app provisioning enables cardholders to add their payment cards to Apple Wallet directly from within your app. With this feature, cardholders can quickly and securely add their payment information to their Apple Wallet, without having to manually enter their card details.<\/p>\n<p>This page explains how to integrate Apple Pay in-app provisioning using the <strong>Adyen Apple Pay Provisioning SDK<\/strong>.<\/p>\n<h2>Get the Adyen Apple Pay Provisioning SDK<\/h2>\n<p>Download the Adyen Apple Pay Provisioning SDK from <a href=\"https:\/\/github.com\/Adyen\/adyen-apple-pay-provisioning-ios\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Adyen's GitHub repository<\/a>.<\/p>\n<p>The repository also includes a <a href=\"https:\/\/github.com\/Adyen\/adyen-apple-pay-provisioning-ios\/blob\/main\/README.md\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">README<\/a> with the instructions for installing the SDK.<\/p>\n<h3>System requirements<\/h3>\n<p>Before you install and start using the <strong>Adyen Apple Pay Provisioning SDK<\/strong>, ensure that your system follows the requirements:<\/p>\n<ul>\n<li>Your application targets iOS 13.4 or later.<\/li>\n<li>Your developer environment runs Xcode 14 or later.<\/li>\n<li>Your developer environment runs Swift 5.7 or later (pre-installed with Xcode 13.2).<\/li>\n<\/ul>\n<h2>In-app provisioning<\/h2>\n<div class=\"notices yellow\">\n<p>If you have an iOS app for your business, you <strong>must<\/strong> use the in-app provisioning flow described in this section.<\/p>\n<\/div>\n<p>With Apple Pay in-app provisioning, your cardholders can tap <span translate=\"no\"><strong>Add to Apple Wallet<\/strong><\/span> directly within your iOS app. That tap starts an in-app provisioning flow. When the process is complete, they have their card data stored within their Apple Wallet, allowing them to make charges on that card from their Apple device.<\/p>\n<p>The following diagram walks you through the in-app provisioning flow. Green labels correspond to the steps described further on the page:<\/p>\n<ol>\n<li><a href=\"#app-get-activation-data\">Get activation data<\/a><\/li>\n<li><a href=\"#app-check-card\">Check for a card to add to Wallet<\/a><\/li>\n<li><a href=\"#app-initiate-provisioning\">Initiate card provisioning<\/a><\/li>\n<li><a href=\"#app-provision-card\">Provision the card<\/a><\/li>\n<li><a href=\"#app-finalize-provisioning\">Finalize card provisioning<\/a><\/li>\n<\/ol>\n<p><img alt=\"\" src=\"\/user\/pages\/docs\/07.issuing\/18.tokens-digital-wallet\/02.apple-pay-provisioning\/in-app-flow.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/p>\n<h3 id=\"app-get-activation-data\">Get activation data<\/h3>\n<p>Before you start card provisioning, you must get activation data for the specified payment instrument.<\/p>\n<ol>\n<li>\n<p>From your server, make a GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request and specify the <code>id<\/code> of the payment instrument in the path. To make this request, your <a href=\"\/pt\/issuing\/manage-access\/api-credentials-web-service\">API credential<\/a> needs the following role:<\/p>\n<ul>\n<li><strong>Bank Issuing PaymentInstrument Network Token Activation Data role<\/strong><\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get activation data'\" :id=\"'get-activation-data'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/balanceplatform-api-test.adyen.com\\\/bcl\\\/v2\\\/paymentInstruments\\\/PI00000000000000000000001\\\/networkTokenActivationData \\\\\\n-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-X GET&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains the <code>sdkInput<\/code> object that you need to initialize the provisioning service in the next step.<\/p>\n<\/li>\n<li>\n<p>Pass the <code>sdkInput<\/code> to your app.<\/p>\n<\/li>\n<\/ol>\n<h3 id=\"app-check-card\">Check for a card to add to Wallet<\/h3>\n<p>Initialize the <code>ProvisioningService<\/code> class that is used to check if the cardholder can add a payment card to their Apple Wallet.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Check card eligibility'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayProvisioning\\n\\nlet provisioningService = ProvisioningService(sdkInput: sdkInput)\\nlet canAddCard = await provisioningService.canAddCard()\\n\\\/\\\/ Show or hide the Add card to Apple Wallet button\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>Use the value returned by the <code>canAddCard<\/code> method to show or hide the <span translate=\"no\"><strong>Add card to Apple Wallet<\/strong><\/span> button.<\/p>\n<div class=\"notices blue\">\n<p>If available, you can add a payment card to both iPhone and Apple Watch. To determine the compatibility of the card with a particular device, use the <code>canAddCardDetails()<\/code> function.<\/p>\n<\/div>\n<h3 id=\"app-initiate-provisioning\">Initiate card provisioning<\/h3>\n<p>When the cardholder selects <span translate=\"no\"><strong>Add card to Apple Wallet<\/strong><\/span>, use the <span translate=\"no\"><strong>Adyen Apple Pay Provisioning SDK<\/strong><\/span> to initiate provisioning by calling the <code>start()<\/code> function with two parameters: <code>delegate<\/code> and <code>presentingViewController<\/code>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Initiate card provisioning'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"try provisioningService.start(\\n    delegate: self,\\n    presentingViewController: viewController\\n)\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h3 id=\"app-provision-card\">Provision the card<\/h3>\n<p>Implement <code>ProvisioningServiceDelegate<\/code> to receive the <code>provision(sdkOutput)<\/code> callback from the <strong>Adyen Apple Pay Provisioning SDK<\/strong>. In the callback:<\/p>\n<ol>\n<li>From your back end, make a POST <code>paymentInstruments\/{id}\/networkTokenActivationData<\/code> request and pass <code>sdkOutput<\/code> to provision the payment instrument. The response contains the <code>sdkInput<\/code> object.<\/li>\n<li>Return <code>sdkInput<\/code> from the <code>provision<\/code> method.<\/li>\n<\/ol>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Provision the card'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"func provision(sdkOutput: Data) async -&gt; Data? {\\n    let sdkInput = \\\/\\\/ POST `sdkOutput` to server\\n    return sdkInput\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h3 id=\"app-finalize-provisioning\">Finalize card provisioning<\/h3>\n<p>After the provisioning is complete, the Adyen Apple Pay Provisioning SDK calls the delegate method <code>didFinishProvisioning<\/code>. This callback can be used to update your UI and show <span translate=\"no\"><strong>Added to Apple Wallet<\/strong><\/span> or <span translate=\"no\"><strong>Available in Apple Wallet<\/strong><\/span>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Finalize card provisioning'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"func didFinishProvisioning(with pass: PKPaymentPass?, error: Error?) {\\n    \\\/\\\/ Update your UI\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2>Wallet provisioning<\/h2>\n<p>You must also support card provisioning directly from Apple Wallet. After implementing the Apple Wallet extension, your app's name and icon appears in the <span translate=\"no\"><strong>From Apps on Your iPhone<\/strong><\/span> list of cards available to add to the Wallet.<\/p>\n<p>In addition to <a href=\"#in-app-provisioning\">in-app provisioning<\/a>, you must also support card provisioning directly from Apple Wallet.<\/p>\n<h3>Requirements<\/h3>\n<p>Before you start implementing the Wallet provisioning flow:<\/p>\n<ol>\n<li><a href=\"#add-wallet-extension\">Add the Apple Wallet extension<\/a>.<\/li>\n<li><a href=\"#add-auth-extension\">Add Authentication UI extension<\/a>.<\/li>\n<\/ol>\n<h4 id=\"add-wallet-extension\">Add the Apple Wallet extension<\/h4>\n<p>To add the Apple Wallet extension:<\/p>\n<ol>\n<li>\n<p>Add a new target to your Xcode project with any Extension template. Then, change the values under the <code>NSExtension<\/code> dictionary in the <code>Info.plist<\/code> as follows:<\/p>\n<table>\n<thead>\n<tr>\n<th>Key<\/th>\n<th>Type<\/th>\n<th>Value<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>NSExtension<\/code><\/td>\n<td>String<\/td>\n<td><span translate=\"no\"><strong>com.apple.PassKit.issuer-provisioning<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><code>NSExtensionPrincipalClass<\/code><\/td>\n<td>String<\/td>\n<td><span translate=\"no\"><strong>$(PRODUCT_MODULE_NAME).ExtensionHandler<\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>\n<p>Create an <code>ExtensionHandler<\/code> class that implements the <code>PKIssuerProvisioningExtensionHandler<\/code> protocol. This class manages the issuer-provided extension that is used during the card provisioning process.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Add Wallet extension'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import PassKit\\n\\nclass ExtensionHandler: PKIssuerProvisioningExtensionHandler {\\n\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h4 id=\"add-auth-extension\">Add the Authentication UI extension<\/h4>\n<p>The Apple Wallet authenticates cardholders before allowing them to provision cards. You can implement this authentication process in your UI by adding the Authentication UI extension. To add this extension:<\/p>\n<ol>\n<li>\n<p>Add another target to your Xcode project with any Extension template. Change the values under the <code>NSExtension<\/code> dictionary in the <code>Info.plist<\/code> as follows:<\/p>\n<table>\n<thead>\n<tr>\n<th>Key<\/th>\n<th>Type<\/th>\n<th>Value<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>NSExtension<\/code><\/td>\n<td>String<\/td>\n<td><span translate=\"no\"><strong>com.apple.PassKit.issuer-provisioning.authorization<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><code>NSExtensionPrincipalClass<\/code><\/td>\n<td>String<\/td>\n<td><span translate=\"no\"><strong>$(PRODUCT_MODULE_NAME).AuthorizationProvider<\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>\n<p>Create an <code>AuthorizationProvider<\/code> class that is a subclass of <code>UIViewController<\/code> and implements the <code>PKIssuerProvisioningExtensionAuthorizationProviding<\/code> protocol. Use the <code>completionHandler<\/code> to communicate if the authentication was successful.<\/p>\n<\/li>\n<\/ol>\n<h3>Extension provisioning flow<\/h3>\n<p>The following sequence diagram shows the flow to provision a card in an Apple Wallet.<\/p>\n<p><img alt=\"\" src=\"\/user\/pages\/docs\/07.issuing\/18.tokens-digital-wallet\/02.apple-pay-provisioning\/extension-flow.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/p>\n<p>As shown in the diagram, the provisioning flow is the following:<\/p>\n<ol>\n<li><a href=\"#show-your-app-on-wallet\">Show your app on Apple Wallet<\/a><\/li>\n<li><a href=\"#show-card-passes\">Show card passes<\/a><\/li>\n<li><a href=\"#ext-generate-request\">Generate a request to add a card<\/a><\/li>\n<li><a href=\"#ext-provision-card\">Provision the card<\/a><\/li>\n<\/ol>\n<h4>Initialize the Adyen Apple Pay Provisioning SDK<\/h4>\n<p>At the beginning of each step of the provisioning flow, you must initialize the <strong>Adyen Apple Pay Provisioning SDK<\/strong>, so you can call the SDK's methods. The following sequence diagram shows the flow to initialize the SDK.<\/p>\n<p><img alt=\"\" src=\"\/user\/pages\/docs\/07.issuing\/18.tokens-digital-wallet\/02.apple-pay-provisioning\/initialize-sdk.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/p>\n<p>As shown in the diagram, the initialization flow is the following:<\/p>\n<ol>\n<li>Make a GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request.<\/li>\n<li>Receive an <code>sdkInput<\/code> from Adyen.<\/li>\n<li>Initialize the <code>ExtensionProvisioningService<\/code> using the <code>sdkInput<\/code>.<\/li>\n<\/ol>\n<p>The following sections explain the steps for the provisioning flow, including the steps to initialize the SDK.<\/p>\n<h3 id=\"show-your-app-on-wallet\">Show your app on Apple Wallet<\/h3>\n<p>When your user tries to add their Adyen-issued card to Apple Wallet, Apple Wallet must show your app as an option for provisioning. To do this, Apple Wallet uses the <a href=\"#add-wallet-extension\">Apple Wallet extension<\/a> to check if your app can provision card data. If your app is available for provisioning, then Apple Wallet shows it as an option.<\/p>\n<p>You can provide the provisioning status of your app by using the <strong>Adyen Apple Pay Provisioning SDK<\/strong>. Do this as follows:<\/p>\n<ol>\n<li>\n<p>From your server, make a GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request and specify the <code>id<\/code> of the payment instrument in the path.<br \/>\nIf your user has multiple payment instruments, make a request for each payment instrument.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get activation data'\" :id=\"'get-activation-data'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/balanceplatform-api-test.adyen.com\\\/bcl\\\/v2\\\/paymentInstruments\\\/PI00000000000000000000001\\\/networkTokenActivationData \\\\\\n-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-X GET&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains the <code>sdkInput<\/code> string that you need to initialize the provisioning service in the next step.<\/p>\n<\/li>\n<li>\n<p>Initialize the <code>ExtensionProvisioningService<\/code> class, which manages the <a href=\"#add-wallet-extension\">Apple Wallet extension<\/a>. Pass the <code>sdkInput<\/code> to the class as a parameter.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initiate card provisioning for one payment instrument'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayExtensionProvisioning\\n\\nlet provisioningService = ExtensionProvisioningService(sdkInput: sdkInput)\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>If you requested multiple <code>sdkInput<\/code> strings, pass them to the class in an array.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initiate card provisioning for multiple payment instruments'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayExtensionProvisioning\\n\\nlet provisioningService = ExtensionProvisioningService(sdkInputs: [sdkInput1, sdkInput2, ...])\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>From the <strong>Adyen Apple Pay Provisioning SDK<\/strong>, call <code>extensionStatus<\/code> to implement the <code>status<\/code> method of the <code>PKIssuerProvisioningExtensionHandler<\/code> protocol. Consider including the following parameters:<\/p>\n<ul>\n<li><code>requiresAuthentication<\/code>: A boolean that specifies whether you provide <a href=\"#add-auth-extension\">authentication through the UI extension<\/a>.<\/li>\n<li><code>entriesUnavailableExtensionStatus<\/code>: If the <code>ExtensionProvisioningService<\/code> could not be initialized, return this parameter to indicate that the provisioning service is not available.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get current status'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"func status() async -&gt; PKIssuerProvisioningExtensionStatus {\\n    \\\/\\\/ Initialize the service\\n    return provisioningService.extensionStatus(requiresAuthentication: true)\\n\\n    \\\/\\\/ If service could not be initialized\\n    return ExtensionProvisioningService.entriesUnavailableExtensionStatus\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<p>After completing these steps, the <strong>Adyen Apple Pay Provisioning SDK<\/strong> sends the status to the Apple Wallet extension. If your provisioning service is available, the <code>status<\/code> object contains information about the available <a href=\"#show-card-passes\">card passes<\/a> in your app.<\/p>\n<div class=\"notices yellow\">\n<p>The time limit for your app to complete these steps is 100 milliseconds. If your app exceeds this limit, make a new GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request to refresh the <code>sdkInput<\/code>.<\/p>\n<\/div>\n<h3 id=\"show-card-passes\">Show card passes<\/h3>\n<p>To enable your user to add their card to their Apple Wallet, you must show the cards as available card passes. You can do this by providing the card data and card art to <strong>Adyen Apple Pay Provisioning SDK<\/strong>. With this information, the SDK generates a preview of the card passes to the user.<\/p>\n<p>The SDK uses two different methods to generate the available card passes:<\/p>\n<ul>\n<li><code>passEntries<\/code>: This method shows card passes on the Wallet app on iPhone.<\/li>\n<li><code>remotePassEntries<\/code>: This method shows card passes on:\n<ul>\n<li>The Watch app on iPhone.<\/li>\n<li>The Wallet app on Apple Watch.<\/li>\n<\/ul><\/li>\n<\/ul>\n<p>To implement <code>passEntries<\/code> and <code>remotePassEntries<\/code>:<\/p>\n<ol>\n<li>\n<p>From your server, make a GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request and specify the <code>id<\/code> of the payment instrument in the path.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get activation data'\" :id=\"'get-activation-data'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/balanceplatform-api-test.adyen.com\\\/bcl\\\/v2\\\/paymentInstruments\\\/PI00000000000000000000001\\\/networkTokenActivationData \\\\\\n-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-X GET&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains the <code>sdkInput<\/code> string that you need to initialize the provisioning service in the next step.  If the extension needs to show multiple payment instruments, request an <code>sdkInput<\/code> string for each payment instrument.<\/p>\n<\/li>\n<li>\n<p>Initialize the <code>ExtensionProvisioningService<\/code> class, which manages the <a href=\"#add-wallet-extension\">Apple Wallet extension<\/a>. Pass the <code>sdkInput<\/code> to the class as a parameter.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initiate card provisioning for one payment instrument'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayExtensionProvisioning\\n\\nlet provisioningService = ExtensionProvisioningService(sdkInput: sdkInput)\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>If you requested multiple <code>sdkInput<\/code>, pass these to the class in an array.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initiate card provisioning for multiple payment instruments'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayExtensionProvisioning\\n\\nlet provisioningService = ExtensionProvisioningService(sdkInputs: [sdkInput1, sdkInput2, ...])\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Implement <code>ExtensionProvisioningServiceDelegate<\/code> to receive the <code>cardArt(forBrand: String)<\/code> callback from the <strong>Adyen Apple Pay Provisioning SDK<\/strong>. This callback returns the card art that corresponds to each available card pass.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Provide card art'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"extension ExtensionHandler: ExtensionProvisioningServiceDelegate {\\n    func cardArt(forBrand brand: String) -&gt; CGImage {\\n        return UIImage(named: \\\"card_art\\\")!.cgImage!\\n    }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>From the SDK, call <code>passEntries<\/code> and <code>remotePassEntries<\/code> and pass the delegate that you created in the previous step.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get pass entries'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"func passEntries() async -&gt; [PKIssuerProvisioningExtensionPassEntry] {\\n    return provisioningService.passEntries(withDelegate: self)\\n}\\n\\nfunc remotePassEntries() async -&gt; [PKIssuerProvisioningExtensionPassEntry] {\\n    return provisioningService.remotePassEntries(withDelegate: self)\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<p>Now, the Apple Wallet or Watch app shows the available card passes to your user.<\/p>\n<div class=\"notices yellow\">\n<p>The time limit for your app to complete these steps is 20 seconds. If your app exceeds this limit, make a new GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request to refresh the <code>sdkInput<\/code>.<\/p>\n<\/div>\n<h3 id=\"ext-generate-request\">Generate a request to provision a card<\/h3>\n<p>After your user selects to add a card to Apple Wallet, the Apple Wallet extension calls <strong>Adyen Apple Pay Provisioning SDK<\/strong> to generate a request to provision the card pass.<\/p>\n<p>To generate a request for adding a card:<\/p>\n<ol>\n<li>\n<p>From your server, make a GET <code>\/paymentInstruments\/{id}\/networkTokenActivationData<\/code> request and specify the <code>id<\/code> of the payment instrument in the path.<br \/>\nIf your user has multiple payment instruments, make a request for each payment instrument.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get activation data'\" :id=\"'get-activation-data'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/balanceplatform-api-test.adyen.com\\\/bcl\\\/v2\\\/paymentInstruments\\\/PI00000000000000000000001\\\/networkTokenActivationData \\\\\\n-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-X GET&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains the <code>sdkInput<\/code> string that you need to initialize the provisioning service in the next step.<\/p>\n<\/li>\n<li>\n<p>Initialize the <code>ExtensionProvisioningService<\/code> class, which manages the <a href=\"#add-wallet-extension\">Apple Wallet extension<\/a>. Pass the <code>sdkInput<\/code> to the class as a parameter.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initiate card provisioning for one payment instrument'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayExtensionProvisioning\\n\\nlet provisioningService = ExtensionProvisioningService(sdkInput: sdkInput)\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>If you requested multiple <code>sdkInput<\/code> strings, pass these to the class in an array.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Initiate card provisioning for multiple payment instruments'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"import AdyenApplePayExtensionProvisioning\\n\\nlet provisioningService = ExtensionProvisioningService(sdkInputs: [sdkInput1, sdkInput2, ...])\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>From the SDK, call the <code>generateAddPaymentPassRequestForPassEntryWithIdentifier<\/code> method to obtain a pass request. In this call, include the <code>delegate<\/code> parameter to handle <a href=\"#ext-provision-card\">card provisioning<\/a>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Generate a request for adding a card pass'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"func generateAddPaymentPassRequestForPassEntryWithIdentifier(\\n    _ identifier: String,\\n    configuration: PKAddPaymentPassRequestConfiguration,\\n    certificateChain certificates: [Data],\\n    nonce: Data,\\n    nonceSignature: Data\\n) async -&gt; PKAddPaymentPassRequest? {\\n    try? await provisioningService.generateAddPaymentPassRequestForPassEntryWithIdentifier(\\n        identifier,\\n        configuration: configuration,\\n        certificateChain: certificates,\\n        nonce: nonce,\\n        nonceSignature: nonceSignature,\\n        delegate: self\\n    )\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Send the pass request to the extension.<\/p>\n<\/li>\n<\/ol>\n<h3 id=\"ext-provision-card\">Provision the card<\/h3>\n<p>After the SDK sends the pass request to the Apple Wallet extension, the extension requests from Adyen the <a href=\"\/pt\/issuing\/manage-network-tokens\">network token<\/a> data of the card. The extension uses this data to provision the card in Apple Wallet.<\/p>\n<p>To provision the card when the extension requests it:<\/p>\n<ol>\n<li>Implement <code>ExtensionProvisioningServiceDelegate<\/code> to receive the <code>provision(paymentInstrumentId, sdkOutput)<\/code> callback from the <strong>Adyen Apple Pay Provisioning SDK<\/strong>.<\/li>\n<li>\n<p>In the callback, make a POST <code>paymentInstruments\/{id}\/networkTokenActivationData<\/code> request and specify the following parameters:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>id<\/code><\/td>\n<td>Path<\/td>\n<td>The <code>paymentInstrumentId<\/code> of the card you want to provision.<\/td>\n<\/tr>\n<tr>\n<td><code>sdkOutput<\/code><\/td>\n<td>Body<\/td>\n<td>Data automatically generated and provided by the SDK. The extension must send this data to Adyen to validate the request.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The response contains the <code>sdkInput<\/code> string that the SDK needs to provision the card.<\/p>\n<\/li>\n<li>Return the <code>sdkInput<\/code> string from the response back to the SDK.<\/li>\n<\/ol>\n<p>The following example shows how to implement these steps.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Provision the card'\" :id=\"''\" :code-data='[{\"language\":\"swift\",\"tabTitle\":\"\",\"content\":\"extension ExtensionHandler: ExtensionProvisioningServiceDelegate {\\n    func provision(paymentInstrumentId: String, sdkOutput: Data) async -&gt; Data? {\\n        let sdkInput = \\\/\\\/ POST `sdkOutput` to server\\n        return sdkInput\\n    }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>After these steps are completed, the SDK returns the delegate to the Apple Wallet extension. Then, the extension provisions the card on Apple Wallet.<\/p>","url":"https:\/\/docs.adyen.com\/pt\/issuing\/tokens-digital-wallet\/apple-pay-provisioning","articleFields":{"description":"Learn how to integrate Apple Pay in-app provisioning.","robots":"noindex,nofollow","feedback_component":true,"filters_component":false,"last_edit_on":"28-03-2023 14:00","next_steps":[{"title":"Manage network tokens","description":"Learn how to manage network tokens for cards added to digital wallets.","url":"\/issuing\/manage-network-tokens","required":true}],"parameters":{"directoryPath":"\/issuing"},"page_id":"58a615ab-414f-4e89-a3a1-fcc9266c1c13","decision_tree":"[]"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/issuing\/tokens-digital-wallet\/apple-pay-provisioning","title":"Apple Pay in-app provisioning","content":"\nThis page is a work in progress. Some of the APIs, documentation, and processes may change. If you have any feedback, reach out to your Adyen contact.\n\nApple Pay in-app provisioning enables cardholders to add their payment cards to Apple Wallet directly from within your app. With this feature, cardholders can quickly and securely add their payment information to their Apple Wallet, without having to manually enter their card details.\nThis page explains how to integrate Apple Pay in-app provisioning using the Adyen Apple Pay Provisioning SDK.\nGet the Adyen Apple Pay Provisioning SDK\nDownload the Adyen Apple Pay Provisioning SDK from Adyen's GitHub repository.\nThe repository also includes a README with the instructions for installing the SDK.\nSystem requirements\nBefore you install and start using the Adyen Apple Pay Provisioning SDK, ensure that your system follows the requirements:\n\nYour application targets iOS 13.4 or later.\nYour developer environment runs Xcode 14 or later.\nYour developer environment runs Swift 5.7 or later (pre-installed with Xcode 13.2).\n\nIn-app provisioning\n\nIf you have an iOS app for your business, you must use the in-app provisioning flow described in this section.\n\nWith Apple Pay in-app provisioning, your cardholders can tap Add to Apple Wallet directly within your iOS app. That tap starts an in-app provisioning flow. When the process is complete, they have their card data stored within their Apple Wallet, allowing them to make charges on that card from their Apple device.\nThe following diagram walks you through the in-app provisioning flow. Green labels correspond to the steps described further on the page:\n\nGet activation data\nCheck for a card to add to Wallet\nInitiate card provisioning\nProvision the card\nFinalize card provisioning\n\n\nGet activation data\nBefore you start card provisioning, you must get activation data for the specified payment instrument.\n\n\nFrom your server, make a GET \/paymentInstruments\/{id}\/networkTokenActivationData request and specify the id of the payment instrument in the path. To make this request, your API credential needs the following role:\n\nBank Issuing PaymentInstrument Network Token Activation Data role\n\n\n\n\nThe response contains the sdkInput object that you need to initialize the provisioning service in the next step.\n\n\nPass the sdkInput to your app.\n\n\nCheck for a card to add to Wallet\nInitialize the ProvisioningService class that is used to check if the cardholder can add a payment card to their Apple Wallet.\n\n    \n\nUse the value returned by the canAddCard method to show or hide the Add card to Apple Wallet button.\n\nIf available, you can add a payment card to both iPhone and Apple Watch. To determine the compatibility of the card with a particular device, use the canAddCardDetails() function.\n\nInitiate card provisioning\nWhen the cardholder selects Add card to Apple Wallet, use the Adyen Apple Pay Provisioning SDK to initiate provisioning by calling the start() function with two parameters: delegate and presentingViewController.\n\n    \n\nProvision the card\nImplement ProvisioningServiceDelegate to receive the provision(sdkOutput) callback from the Adyen Apple Pay Provisioning SDK. In the callback:\n\nFrom your back end, make a POST paymentInstruments\/{id}\/networkTokenActivationData request and pass sdkOutput to provision the payment instrument. The response contains the sdkInput object.\nReturn sdkInput from the provision method.\n\n\n    \n\nFinalize card provisioning\nAfter the provisioning is complete, the Adyen Apple Pay Provisioning SDK calls the delegate method didFinishProvisioning. This callback can be used to update your UI and show Added to Apple Wallet or Available in Apple Wallet.\n\n    \n\nWallet provisioning\nYou must also support card provisioning directly from Apple Wallet. After implementing the Apple Wallet extension, your app's name and icon appears in the From Apps on Your iPhone list of cards available to add to the Wallet.\nIn addition to in-app provisioning, you must also support card provisioning directly from Apple Wallet.\nRequirements\nBefore you start implementing the Wallet provisioning flow:\n\nAdd the Apple Wallet extension.\nAdd Authentication UI extension.\n\nAdd the Apple Wallet extension\nTo add the Apple Wallet extension:\n\n\nAdd a new target to your Xcode project with any Extension template. Then, change the values under the NSExtension dictionary in the Info.plist as follows:\n\n\n\nKey\nType\nValue\n\n\n\n\nNSExtension\nString\ncom.apple.PassKit.issuer-provisioning\n\n\nNSExtensionPrincipalClass\nString\n$(PRODUCT_MODULE_NAME).ExtensionHandler\n\n\n\n\n\nCreate an ExtensionHandler class that implements the PKIssuerProvisioningExtensionHandler protocol. This class manages the issuer-provided extension that is used during the card provisioning process.\n\n\n\n\n\nAdd the Authentication UI extension\nThe Apple Wallet authenticates cardholders before allowing them to provision cards. You can implement this authentication process in your UI by adding the Authentication UI extension. To add this extension:\n\n\nAdd another target to your Xcode project with any Extension template. Change the values under the NSExtension dictionary in the Info.plist as follows:\n\n\n\nKey\nType\nValue\n\n\n\n\nNSExtension\nString\ncom.apple.PassKit.issuer-provisioning.authorization\n\n\nNSExtensionPrincipalClass\nString\n$(PRODUCT_MODULE_NAME).AuthorizationProvider\n\n\n\n\n\nCreate an AuthorizationProvider class that is a subclass of UIViewController and implements the PKIssuerProvisioningExtensionAuthorizationProviding protocol. Use the completionHandler to communicate if the authentication was successful.\n\n\nExtension provisioning flow\nThe following sequence diagram shows the flow to provision a card in an Apple Wallet.\n\nAs shown in the diagram, the provisioning flow is the following:\n\nShow your app on Apple Wallet\nShow card passes\nGenerate a request to add a card\nProvision the card\n\nInitialize the Adyen Apple Pay Provisioning SDK\nAt the beginning of each step of the provisioning flow, you must initialize the Adyen Apple Pay Provisioning SDK, so you can call the SDK's methods. The following sequence diagram shows the flow to initialize the SDK.\n\nAs shown in the diagram, the initialization flow is the following:\n\nMake a GET \/paymentInstruments\/{id}\/networkTokenActivationData request.\nReceive an sdkInput from Adyen.\nInitialize the ExtensionProvisioningService using the sdkInput.\n\nThe following sections explain the steps for the provisioning flow, including the steps to initialize the SDK.\nShow your app on Apple Wallet\nWhen your user tries to add their Adyen-issued card to Apple Wallet, Apple Wallet must show your app as an option for provisioning. To do this, Apple Wallet uses the Apple Wallet extension to check if your app can provision card data. If your app is available for provisioning, then Apple Wallet shows it as an option.\nYou can provide the provisioning status of your app by using the Adyen Apple Pay Provisioning SDK. Do this as follows:\n\n\nFrom your server, make a GET \/paymentInstruments\/{id}\/networkTokenActivationData request and specify the id of the payment instrument in the path.\nIf your user has multiple payment instruments, make a request for each payment instrument.\n\n\n\nThe response contains the sdkInput string that you need to initialize the provisioning service in the next step.\n\n\nInitialize the ExtensionProvisioningService class, which manages the Apple Wallet extension. Pass the sdkInput to the class as a parameter.\n\n\n\nIf you requested multiple sdkInput strings, pass them to the class in an array.\n\n\n\n\n\nFrom the Adyen Apple Pay Provisioning SDK, call extensionStatus to implement the status method of the PKIssuerProvisioningExtensionHandler protocol. Consider including the following parameters:\n\nrequiresAuthentication: A boolean that specifies whether you provide authentication through the UI extension.\nentriesUnavailableExtensionStatus: If the ExtensionProvisioningService could not be initialized, return this parameter to indicate that the provisioning service is not available.\n\n\n\n\n\n\nAfter completing these steps, the Adyen Apple Pay Provisioning SDK sends the status to the Apple Wallet extension. If your provisioning service is available, the status object contains information about the available card passes in your app.\n\nThe time limit for your app to complete these steps is 100 milliseconds. If your app exceeds this limit, make a new GET \/paymentInstruments\/{id}\/networkTokenActivationData request to refresh the sdkInput.\n\nShow card passes\nTo enable your user to add their card to their Apple Wallet, you must show the cards as available card passes. You can do this by providing the card data and card art to Adyen Apple Pay Provisioning SDK. With this information, the SDK generates a preview of the card passes to the user.\nThe SDK uses two different methods to generate the available card passes:\n\npassEntries: This method shows card passes on the Wallet app on iPhone.\nremotePassEntries: This method shows card passes on:\n\nThe Watch app on iPhone.\nThe Wallet app on Apple Watch.\n\n\nTo implement passEntries and remotePassEntries:\n\n\nFrom your server, make a GET \/paymentInstruments\/{id}\/networkTokenActivationData request and specify the id of the payment instrument in the path.\n\n\n\nThe response contains the sdkInput string that you need to initialize the provisioning service in the next step.  If the extension needs to show multiple payment instruments, request an sdkInput string for each payment instrument.\n\n\nInitialize the ExtensionProvisioningService class, which manages the Apple Wallet extension. Pass the sdkInput to the class as a parameter.\n\n\n\nIf you requested multiple sdkInput, pass these to the class in an array.\n\n\n\n\n\nImplement ExtensionProvisioningServiceDelegate to receive the cardArt(forBrand: String) callback from the Adyen Apple Pay Provisioning SDK. This callback returns the card art that corresponds to each available card pass.\n\n\n\n\n\nFrom the SDK, call passEntries and remotePassEntries and pass the delegate that you created in the previous step.\n\n\n\n\n\nNow, the Apple Wallet or Watch app shows the available card passes to your user.\n\nThe time limit for your app to complete these steps is 20 seconds. If your app exceeds this limit, make a new GET \/paymentInstruments\/{id}\/networkTokenActivationData request to refresh the sdkInput.\n\nGenerate a request to provision a card\nAfter your user selects to add a card to Apple Wallet, the Apple Wallet extension calls Adyen Apple Pay Provisioning SDK to generate a request to provision the card pass.\nTo generate a request for adding a card:\n\n\nFrom your server, make a GET \/paymentInstruments\/{id}\/networkTokenActivationData request and specify the id of the payment instrument in the path.\nIf your user has multiple payment instruments, make a request for each payment instrument.\n\n\n\nThe response contains the sdkInput string that you need to initialize the provisioning service in the next step.\n\n\nInitialize the ExtensionProvisioningService class, which manages the Apple Wallet extension. Pass the sdkInput to the class as a parameter.\n\n\n\nIf you requested multiple sdkInput strings, pass these to the class in an array.\n\n\n\n\n\nFrom the SDK, call the generateAddPaymentPassRequestForPassEntryWithIdentifier method to obtain a pass request. In this call, include the delegate parameter to handle card provisioning.\n\n\n\n\n\nSend the pass request to the extension.\n\n\nProvision the card\nAfter the SDK sends the pass request to the Apple Wallet extension, the extension requests from Adyen the network token data of the card. The extension uses this data to provision the card in Apple Wallet.\nTo provision the card when the extension requests it:\n\nImplement ExtensionProvisioningServiceDelegate to receive the provision(paymentInstrumentId, sdkOutput) callback from the Adyen Apple Pay Provisioning SDK.\n\nIn the callback, make a POST paymentInstruments\/{id}\/networkTokenActivationData request and specify the following parameters:\n\n\n\nParameter\nType\nDescription\n\n\n\n\nid\nPath\nThe paymentInstrumentId of the card you want to provision.\n\n\nsdkOutput\nBody\nData automatically generated and provided by the SDK. The extension must send this data to Adyen to validate the request.\n\n\n\nThe response contains the sdkInput string that the SDK needs to provision the card.\n\nReturn the sdkInput string from the response back to the SDK.\n\nThe following example shows how to implement these steps.\n\n    \n\nAfter these steps are completed, the SDK returns the delegate to the Apple Wallet extension. Then, the extension provisions the card on Apple Wallet.","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Adyen Issuing","lvl2":"Network tokens for digital wallets","lvl3":"Apple Pay in-app provisioning"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/issuing","lvl2":"https:\/\/docs.adyen.com\/pt\/issuing\/tokens-digital-wallet","lvl3":"\/pt\/issuing\/tokens-digital-wallet\/apple-pay-provisioning"},"levels":4,"category":"Issuing","category_color":"green","tags":["Apple","in-app","provisioning"]},"articleFiles":{"extension-flow.svg":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/07.issuing\/18.tokens-digital-wallet\/02.apple-pay-provisioning\/extension-flow.svg?decoding=auto&amp;fetchpriority=auto\" \/>","in-app-flow.svg":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/07.issuing\/18.tokens-digital-wallet\/02.apple-pay-provisioning\/in-app-flow.svg?decoding=auto&amp;fetchpriority=auto\" \/>","initialize-sdk.svg":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/07.issuing\/18.tokens-digital-wallet\/02.apple-pay-provisioning\/initialize-sdk.svg?decoding=auto&amp;fetchpriority=auto\" \/>"}}
