网易云

Apple Wallet

Contents

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

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

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

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

ionic cordova plugin add cordova-apple-wallet npm install @ionic-native/apple-wallet
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/apple-wallet

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

  • iOS

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

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


constructor(private appleWallet: AppleWallet) { }


...


// Simple call to determine if the current device supports Apple Pay and has a supported card installed.
this.appleWallet.isAvailable()
 .then((res: boolean) => {
   // Expect res to be boolean
  })
 .catch((err) => {
   // Catch {{err}} here
 });


...


// Simple call to check existence and ellibagility to add a card
this.appleWallet.isCardExistInWalletOrWatch(data: CardPrimarySuffixData)
 .then((res: EligibilityData) => {
   // object contains boolean values that ensure that card is already exists in wallet or paired-watch
  })
 .catch((err) => {
   // Catch {{err}} here
 });


...


// Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button
this.appleWallet.isPairedWatchExist()
 .then((res: WatchExistData) => {
   // object contains boolean value that ensure that there is already a paired Watch
  })
 .catch((err) => {
   // Catch {{err}} here
 });


...


// Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.
// This method provides the data needed to create a request to add your payment pass (credit/debit card). After a successful callback, pass the certificate chain to your issuer server-side using our callback delegate method `AppleWallet.completeAddPaymentPass`. The issuer server-side should returns an encrypted JSON payload containing the encrypted card data, which is required to be get the final response

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


...


this.appleWallet.completeAddPaymentPass(data: encryptedCardData)
 .then((res: string) => {
   // Expect res to be string either 'success' or 'error'
  })
 .catch((err) => {
   // Catch {{err}} here
   // Error and can not add the card, or something wrong happend
   // PKAddPaymentPassViewController will be dismissed
 });