Apple Payment Pass
This plugin provides support for adding credit/debit cards to Apple Wallet. It also can check if the credit/debit card exists in Wallet.
Important Note
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 https://developer.apple.com/apple-pay/.
#
Usage#
Angular#
ES2015+/Typescript#
Vanilla JS#
Card AdditionCall with the configuration data needed to instantiate a new PKAddPaymentPassViewController object and complete the HTTP request to do the handshake with your server.
This method provides the data needed to create a request to add your payment pass (credit/debit card).
#
Index#
Enumerations#
Classes#
Interfaces#
Type aliases#
Enumerations#
RequestTemplateRequestTemplate:
Constants used to define the shape of the body used during the request to the server
#
CERTIFICATE_0CERTIFICATE_0: = "$certificates.0"
Constant used in the body template that represents the first item in the certificates array returned by the PKAddPaymentPassViewController.
#
CERTIFICATE_1CERTIFICATE_1: = "$certificates.1"
Constant used in the body template that represents the second item in the certificates array returned by the PKAddPaymentPassViewController.
#
NONCENONCE: = "$nonceString"
Constant used in the body template that represents the nonce returned by the PKAddPaymentPassViewController.
#
NONCE_SIGNATURENONCE_SIGNATURE: = "$nonceSignature"
Constant used in the body template that represents the nonceSignature returned by the PKAddPaymentPassViewController.
#
Classes#
ApplePaymentPassApplePaymentPass:
This plugin provides support for adding credit/debit cards to Apple Wallet. It also can check if the credit/debit card exists in Wallet.
#
template● template: RequestTemplate = RequestTemplate
#
addPaymentPass▸ addPaymentPass(options: AddPassOptions): Promise
<AddPassResponse>
This function accepts both the card data and information required to make the http request to the server in order to use PKAddPaymentPassViewController object to add a payment pass to the apple wallet.
throws: * ServerError DelegateError
Parameters:
Name | Type | Description |
---|---|---|
options | AddPassOptions | The AddPassOptions object to configure the PKAddPaymentPassViewController and setup the call to the server. |
Returns: Promise
<AddPassResponse>
- An object with the pass information
#
available▸ available(): Promise
<boolean
>
A function to determine if the current device supports adding a payment pass
Returns: Promise
<boolean
>
whether or not a pay pass can be added
#
availableProvider▸ availableProvider(options: object
): Promise
<boolean
>
A function to determine if the card has already been provisioned for the device.
Parameters:
options: object
An object with the primary account identifier for the card.
Name | Type |
---|---|
primaryAccountIdentifier | string |
Returns: Promise
<boolean
>
whether or not a pay can be added, throws an error if the card is already added
#
Interfaces#
AddPassOptionsAddPassOptions:
The options interface to pass to the addPaymentPass function.
#
body● body: any
A templated request body to send to your server. include any additional fields and use the constansts CERTIFICATE_0, CERTIFICATE_1, NONCE, NONCE_SIGNATURE
usage:
#
card● card: CardData
The card data
#
headers● headers: Headers
An object with the headers required for the server request.
#
method● method: string
The HTTP method to use ex. POST
#
url● url: string
The url to hit ex. https://my.api.com/v1/add/applepay/card
#
AddPassResponseAddPassResponse:
The response from adding the pass with the pass data
#
activationState● activationState: ActivationState
The activation state of the card
#
deviceAccountIdentifier● deviceAccountIdentifier: string
The device account identifier.
#
deviceAccountNumberSuffix● deviceAccountNumberSuffix: string
The device account number suffix
#
deviceName● deviceName: string
The device name.
#
primaryAccountIdentifier● primaryAccountIdentifier: string
The primary account identifier
#
primaryAccountNumberSuffix● primaryAccountNumberSuffix: string
The primary account number suffix
#
CardDataCardData:
The card data for the PKAddPaymentPassViewController
<Optional>
cardholderName#
● cardholderName: undefined
| string
The cardholder name
<Optional>
localizedDescription#
● localizedDescription: undefined
| string
A short description of the card.
<Optional>
paymentNetwork#
● paymentNetwork: undefined
| string
Filters the networks shown in the introduction view to this single network. ex.VISA \| MASTERCARD
<Optional>
primaryAccountIdentifier#
● primaryAccountIdentifier: undefined
| string
Filters the device and attached devices that already have this card provisioned. No filter is applied if the parameter is omitted
<Optional>
primaryAccountSuffix#
● primaryAccountSuffix: undefined
| string
Last 4/5 digits of PAN. The last four or five digits of the PAN. Presented to the user with dots prepended to indicate that it is a suffix.
#
DelegateErrorDelegateError:
Error thrown by addPaymentPass when the PKAddPaymentPassViewController fails to add the card to the wallet
#
body● body: object
The error message
#
Type declaration message: string
#
statusCode● statusCode: number
The error code
#
type● type: "DelegateError"
The type of the error
#
HeadersHeaders:
An object with the headers required for the server request.
usage:
#
ServerErrorServerError:
Error thrown by addPaymentPass when server responds with a HTTP status code >= 400
#
body● body: any
The body return by the server
#
statusCode● statusCode: number
The status code returned from the server
#
type● type: "ServerError"
The type of the error
#
Type aliases#
ActivationStateƬ ActivationState: "activated" | "activating" | "suspended" | "deactivated" | "requires-activation" | "unknown"
The activation state of the provisioned card
#
Change Log#
[1.1.0] (2020-07-28)#
Features- support for Angular Ivy
#
[1.0.2] (2019-04-27)#
Bug Fixes- Fixed issue where cordova plugin id was being incorrectly set by release script.
#
[1.0.0] (2019-04-27)#
Bug Fixes- iOS: Fix issues where nonce string could be incorrectly replaced and errors from server weren't properly handled
#
Features- Added typed imports for Angular, ES2015+/Typescript, and Vanilla JS , closes [#es2015]
#
BREAKING CHANGES- Changed package name from
@ionic-enterprise/apple-wallet
to@ionic-enterprise/apple-payment-pass
and the main class fromAppleWallet
toApplePaymentPass
. See updated usage docs.