Apple Wallet


A Cordova plugin that enables users from Add Payment Cards to their Apple Wallet.

Ionic 苹果钱包 Apple Wallet插件的安装(Installation)

ionic cordova plugin add cordova-apple-wallet npm install @ionic-native/apple-wallet

Ionic 苹果钱包 Apple Wallet插件支持的平台(Supported Platforms)

  • iOS

Ionic 苹果钱包 Apple Wallet插件的用法(Usage)

import { AppleWallet } from '@ionic-native/apple-wallet';

constructor(private appleWallet: AppleWallet) { }


// Simple call to check whether the app can add cards to Apple Pay.
 .then((res) => {
   // Apple Wallet is enabled and a supported card is setup. Expect:
   // boolean value, true or false
 .catch((message) => {
   // Error message while trying to know if device is able to add to wallet


// Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.
// The encryption scheme, cardholder name, and primary account suffix are required for configuration.
// The configuration information is used for setup and display only. It should not contain any sensitive information.

let data: cardData = {
   cardholderName: 'Test User',
   primaryAccountNumberSuffix: '1234',
   localizedDescription: 'Description of payment card',
   paymentNetwork: 'VISA'

this.appleWallet.startAddPaymentPass(data: cardData)
 .then((res) => {
   // User proceed and successfully asked to add card to his wallet
   // Use the callback response JSON payload to complete addition process
 .catch((err) => {
   // Error or user cancelled.

// You should expect the callback success response to be as follow

 // {
 //  data: {
 //    "certificateSubCA": "Base64 string represents certificateSubCA",
 //    "certificateLeaf":" Base64 string represents certificateLeaf"
 //    "nonce": "Base64 string represents nonce",
 //    "nonceSignature": "Base64 string represents nonceSignature",
 //   }
 // }

// This method provides the data needed to create an add payment request.
// Pass the certificate chain to the issuer server. The server returns an encrypted JSON file containing the card data.
// After you receive the encrypted data, pass it to completeAddPaymentPass method


let data: encryptedCardData = {
   activationData: 'encoded Base64 activationData from your server',
   encryptedPassData: 'encoded Base64 encryptedPassData from your server',
   wrappedKey: 'encoded Base64 wrappedKey from your server',

this.appleWallet.encryptedCardData(data: encryptedCardData)
 .then((res) => {
   // callback success response means card has been added successfully,
   // PKAddPaymentPassViewController will be dismissed
 .catch((err) => {
   // Error and can not add the card, or something wrong happend
   // PKAddPaymentPassViewController will be dismissed