npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-apple-wallet-ng

v1.3.1

Published

This plugin allows you to add passes and credit/debit cards to Apple Wallet

Downloads

95

Readme

cordova-apple-wallet-ng

This plugin provides support for adding your credit/debit cards to Apple Wallet

Changelog

  • v1.3.1: Added err handling for nil graph response
  • v1.3.0: Adds graphRequest
  • v1.2.0: Adds checkPairedDevicesBySuffix
  • v1.1.1: Update complete handler
  • v1.1.0: Changed wrapped to ephemeralPublicKey
  • v1.0.3: Chore: fix name.
  • v1.0.2: Chore: fix name.
  • v1.0.1: Feature: adds ECC_V2 encryption scheme.

Important

Adding payment passes requires a special entitlement issued by Apple. Your app must include this entitlement before you can use this class. For more information on requesting this entitlement, see the Card Issuers section at developer.apple.com/apple-pay/.

Installation

cordova plugin add cordova-apple-wallet-ng --save

Supported Platforms

  • iOS

Usage

Ionic 3 and above

In order to use it with Ionic 3, please follow this instructions

Cordova

In order to use it with normal cordova based project, please define a global variable, so that you can use it without lint errors

var AppleWallet;

Example

Availability

Simple call to check whether the app can add cards to Apple Pay.

    AppleWallet.available()
    .then((res) => {
      // Apple Wallet is enabled and a supported card is setup. Expect:
      // boolean value, true or false
    })
    .catch((message) => {
      console.error("ERROR AVAILBLE>> ", message);
    });

Start Adding card

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.

In order to get testing data check this Apple Sandbox

    let data = {
      cardholderName: 'Test User',
      primaryAccountNumberSuffix: '1234',
      localizedDescription: 'Description of payment card',
      paymentNetwork: 'VISA'
    }
    AppleWallet.startAddPaymentPass(data)
    .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

For more information, please check Apple docs from here

Complete adding card

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

  • activationData: The request’s activation data.
  • encryptedPassData : An encrypted JSON file containing the sensitive information needed to add a card to Apple Pay.
  • ephemeralPublicKey The ephemeral public key used by elliptic curve cryptography (ECC). or wrappedKey if you are using RSA
    let encryptedData = {
        activationData: "encoded Base64 activationData from your server",
        encryptedPassData: "encoded Base64 encryptedPassData from your server",
        wrappedKey: "encoded Base64 wrappedKey from your server"
    }
    AppleWallet.completeAddPaymentPass(encryptedData)
    .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
    });

Contribute

Please support us by giving advice on how to apply best practice to Objective-C native code.

License

MIT

Credits

Made with ❤️ by Hatem. Follow me on Twitter to get the latest news first! I will be happy to receive your feedback via Email ! We're always happy to hear your feedback. Enjoy!

░░░░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 
░░░░░░░░░░█░░░░░░▀█▄▀▄▀██████░░░▀█▄▀▄▀██████ 
░░░░░░░░ ░░░░░░░░░░▀█▄█▄███▀░░░░░░▀█▄█▄███▀░

All copyrights reserved © 2018 | TOmas™ Inc.