Ionic Framework 4 is almost here. Preview the beta docs and try it out now! Try Ionic 4 Beta

Apple Wallet

Improve this doc

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

Repo: https://github.com/tomavic/cordova-apple-wallet

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-apple-wallet
    $ npm install --save @ionic-native/apple-wallet
    
  2. Add this plugin to your app's module

Supported platforms

Usage

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


constructor(private appleWallet: AppleWallet) { }

...


this.appleWallet.available()
 .then((res) => {
   // res is a boolean value, either true or false
   console.log("Is Apple Wallet available? ", res);
  })
 .catch((message) => {
   console.error("ERROR AVAILBLE>> ", message);
 });

...

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

this.appleWallet.startAddPaymentPass(data: cardData)
 .then((res) => {
   console.log("startAddPaymentPass success response ", res);
  })
 .catch((err) => {
   console.error("startAddPaymentPass ERROR response", err);
 });

...

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) => {
   console.log("completeAddCardToAppleWallet success response ", res);
  })
 .catch((err) => {
   console.error("completeAddCardToAppleWallet ERROR response", err);
 });

Instance Members

available()

Detects if the current device supports Apple Wallet

Returns: Promise<boolean> Returns a promise

startAddPaymentPass(data)

Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.

Param Type Details
data cardData

Returns: Promise<any> Returns a promise

completeAddPaymentPass(data)

Simple call contains the card data needed to add a card to Apple Pay.

Param Type Details
data encryptedCardData

Returns: Promise<any> Returns a promise

API

Native

General