In addition to in-app push provisioning, you must also support pull provisioning 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.
If you are integrating pull provisioning from Apple Wallet, you must also integrate in-app push provisioning for Apple Pay.
Requirements
Before you begin, take into account the following requirements, limitations, and preparations.
| Requirement | Description |
|---|---|
| Integration type | You need an integration that supports Adyen Issuing. |
| API credentials | Your API credential must have the following role:
|
| Limitations | Your app must target iOS 13.4 or later. Your development environment must use Xcode 14 or later and Swift 5.7 or later. |
| Setup steps | Install the Adyen Apple Pay Provisioning SDK following the instructions in the repository's README file. |
Extension provisioning flow
The following sequence diagram shows the flow for pull provisioning from Apple Wallet.
As shown in the diagram, the provisioning flow is the following:
Add Apple extensions
Before you implement pull provisioning from Apple Wallet:
Add the Apple Wallet extension
To add the Apple Wallet extension:
-
Add a new target to your Xcode project with any Extension template. Then, change the values under the
NSExtensiondictionary in theInfo.plistas follows:Key Type Value NSExtensionString com.apple.PassKit.issuer-provisioning NSExtensionPrincipalClassString $(PRODUCT_MODULE_NAME).ExtensionHandler -
Create an
ExtensionHandlerclass that implements thePKIssuerProvisioningExtensionHandlerprotocol. This class manages the issuer-provided extension that is used during the card provisioning process.
Add the Authentication UI extension
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:
-
Add another target to your Xcode project with any Extension template. Change the values under the
NSExtensiondictionary in theInfo.plistas follows:Key Type Value NSExtensionString com.apple.PassKit.issuer-provisioning.authorization NSExtensionPrincipalClassString $(PRODUCT_MODULE_NAME).AuthorizationProvider -
Create an
AuthorizationProviderclass that is a subclass ofUIViewControllerand implements thePKIssuerProvisioningExtensionAuthorizationProvidingprotocol. Use thecompletionHandlerto communicate if the authentication was successful.
Initialize the Adyen Apple Pay Provisioning SDK
At 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.
As shown in the diagram, the initialization flow is the following:
- Make a GET
/paymentInstruments/{id}/networkTokenActivationDatarequest. - Receive an
sdkInputfrom Adyen. - Initialize the
ExtensionProvisioningServiceusing thesdkInput.
The following sections explain the steps for the provisioning flow, including the steps to initialize the SDK.
Show your app on Apple Wallet
When your user tries to add their Adyen-issued card from Apple Wallet, Apple Wallet must show your app as an option. To do this, Apple Wallet uses the Apple Wallet extension to check if your app supports pull provisioning from Apple Wallet. If your app has cards available to add, Apple Wallet shows it as an option.
You can provide your app's availability for pull provisioning from Apple Wallet by using the Adyen Apple Pay Provisioning SDK. Do this as follows:
-
From your server, make a GET
/paymentInstruments/{id}/networkTokenActivationDatarequest and specify theidof the payment instrument in the path.
If your user has multiple payment instruments, make a request for each payment instrument.The response contains the
sdkInputstring that you need to initialize the provisioning service in the next step. -
Initialize the
ExtensionProvisioningServiceclass, which manages the Apple Wallet extension. Pass thesdkInputto the class as a parameter.If you requested multiple
sdkInputstrings, pass them to the class in an array. -
From the Adyen Apple Pay Provisioning SDK, call
extensionStatusto implement thestatusmethod of thePKIssuerProvisioningExtensionHandlerprotocol. Consider including the following parameters:requiresAuthentication: A boolean that specifies whether you provide authentication through the UI extension.entriesUnavailableExtensionStatus: If theExtensionProvisioningServicecould not be initialized, return this parameter to indicate that the provisioning service is not available.
After 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.
The 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.
Show card passes
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 Adyen Apple Pay Provisioning SDK. With this information, the SDK generates a preview of the card passes to the user.
The SDK uses two different methods to generate the available card passes:
passEntries: This method shows card passes on the Wallet app on iPhone.remotePassEntries: This method shows card passes on:- The Watch app on iPhone.
- The Wallet app on Apple Watch.
To implement passEntries and remotePassEntries:
-
From your server, make a GET
/paymentInstruments/{id}/networkTokenActivationDatarequest and specify theidof the payment instrument in the path.The response contains the
sdkInputstring that you need to initialize the provisioning service in the next step. If the extension needs to show multiple payment instruments, request ansdkInputstring for each payment instrument. -
Initialize the
ExtensionProvisioningServiceclass, which manages the Apple Wallet extension. Pass thesdkInputto the class as a parameter.If you requested multiple
sdkInput, pass these to the class in an array. -
Implement
ExtensionProvisioningServiceDelegateto receive thecardArt(forBrand: String)callback from the Adyen Apple Pay Provisioning SDK. This callback returns the card art that corresponds to each available card pass. -
From the SDK, call
passEntriesandremotePassEntriesand pass the delegate that you created in the previous step.
Now, the Apple Wallet or Watch app shows the available card passes to your user.
The 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.
Start pull provisioning from Apple Wallet
After 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.
To generate a request for adding a card:
-
From your server, make a GET
/paymentInstruments/{id}/networkTokenActivationDatarequest and specify theidof the payment instrument in the path.
If your user has multiple payment instruments, make a request for each payment instrument.The response contains the
sdkInputstring that you need to initialize the provisioning service in the next step. -
Initialize the
ExtensionProvisioningServiceclass, which manages the Apple Wallet extension. Pass thesdkInputto the class as a parameter.If you requested multiple
sdkInputstrings, pass these to the class in an array. -
From the SDK, call the
generateAddPaymentPassRequestForPassEntryWithIdentifiermethod to obtain a pass request. In this call, include thedelegateparameter to handle card provisioning. -
Send the pass request to the extension.
Add the card to Apple Wallet
After 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.
To provision the card when the extension requests it:
- Implement
ExtensionProvisioningServiceDelegateto receive theprovision(paymentInstrumentId, sdkOutput)callback from the Adyen Apple Pay Provisioning SDK. -
In the callback, make a POST
paymentInstruments/{id}/networkTokenActivationDatarequest and specify the following parameters:Parameter Type Description idPath The paymentInstrumentIdof the card you want to provision.sdkOutputBody Data automatically generated and provided by the SDK. The extension must send this data to Adyen to validate the request. The response contains the
sdkInputstring that the SDK needs to provision the card. - Return the
sdkInputstring from the response back to the SDK.
The following example shows how to implement these steps.
After these steps are completed, the SDK returns the delegate to the Apple Wallet extension. Then, the extension provisions the card on Apple Wallet.