
Apple Pay
@capacitor-community/apple-pay
Capacitor Plugin used to enable Apple Pay in an Application
Maintainers
Documentation
Installation
npm install @capacitor-community/apple-pay
npx cap sync
Demo
A working example can be found in the example-app directory.
API
setLogLevel(...)
setLogLevel(level: LogLevel) => void
Set the verbosity of event logging.
canMakePayments(...)
canMakePayments(options: ApplePayAvailabilityOptions) => Promise<ApplePayCanMakePaymentsResponse>
Checks if the device supports Apple Pay and can make payments, based on the supplied options.
Returns: Promise<ApplePayCanMakePaymentsResponse>
makePaymentRequest(...)
makePaymentRequest(request: ApplePayRequest) => Promise<ApplePayPaymentRequestResponse>
Attempts to make request payment by presenting the payment sheet over the app.
Returns: Promise<ApplePayPaymentRequestResponse>
Interfaces
ApplePayCanMakePaymentsResponse
The response object from {@link ApplePay.canMakePayments}
canMakePayments | boolean | - Type: boolean Whether or not the device can make payments. |
ApplePayAvailabilityOptions
A config object for {@link ApplePay.canMakePayments}
merchantIdentifier | string | - Type: string The merchant identifier you registered with Apple for use with Apple Pay. |
supportedNetworks | ApplePaySupportedNetwork[] | - Type: {@link ApplePaySupportedNetwork} An array of supported networks that will be supported. |
ApplePayPaymentRequestResponse
The response object from {@link ApplePay.makePaymentRequest}
success | boolean | - Type: boolean Whether or not the payment request was successful. |
data | any | - Type: any The data response from the merchant validation server. |
ApplePayRequest
ApplePayMerchantValidation
An object containing settings for connecting with your merchant validation server.
ApplePayMerchantValidationParams
An object containing request parameters for server-side merchant validation.
merchantIdentifier | string | - Type: string The merchant identifier you registered with Apple for use with Apple Pay. |
displayName | string | - Type: string The display name of your store, UTF-8, unlocalized, with a max length of 64 characters. |
initiative | 'web' | 'native' | - Type: web The type of the app making the request. This value should be set to web. It is ignored when run natively. |
initiativeContext | string | - Type: string This value should be your fully qualified domain name associated with your Apple Pay Merchant Identity Certificate. |
ApplePayPaymentAuthorization
An object containing settings for connecting with your merchant payment authorization server.
url | string | - Type: string The url to your merchant payment authorization server. |
ApplePayPaymentRequest
An object describing the payment request, including information about payment processing capabilities, payment amounts and more.
countryCode | string | - Type: string The merchant’s two-letter ISO 3166 country code. |
currencyCode | string | - Type: string The three-letter ISO 4217 currency code for the payment. |
merchantCapabilities | ApplePayMerchantCapability[] | - Type: {@link ApplePayMerchantCapability} The payment capabilities supported by the merchant. |
supportedNetworks | ApplePaySupportedNetwork[] | - Type: {@link ApplePaySupportedNetwork} The payment networks the merchant supports. |
lineItems | ApplePaySummaryItem[] | - Type: {@link ApplePaySummaryItem} A set of line items that explain recurring payments and additional charges and discounts. |
total | ApplePaySummaryItem | - Type: {@link ApplePaySummaryItem} A line item representing the total for the payment. |
ApplePaySummaryItem
An object that defines a line item in a payment request.
label | string | - Type: string The name of the line item (ex.: product name). | |
amount | string | - Type: string The line item amount. | |
type | 'pending' | 'final' | - Type: pending | final Whether or not the line item represents a known final cost or an estimated or unknown cost. | undefined |
Enums
LogLevel
DEBUG | Log events that may be useful during development. |
ERROR | Only log errors. |
ApplePaySupportedNetwork
AMEX | 'amex' | American Express |
CARTESBANCAIRES | 'cartesBancaires' | Cartes Bancaires |
CHINAUNIONPAY | 'chinaUnionPay' | China Union Pay |
DISCOVER | 'discover' | Discover Card |
EFTPOS | 'eftpos' | Electronic funds transfer at point of sale |
ELECTRON | 'electron' | Visa Electron |
ELO | 'elo' | Elo |
INTERAC | 'interac' | Interac |
JCB | 'jcb' | Japan Credit Bureau |
MADA | 'mada' | Saudi Payments Network |
MAESTRO | 'maestro' | Maestro Debit Card |
MASTERCARD | 'masterCard' | Mastercard |
PRIVATELABEL | 'privateLabel' | Store credit and debit cards |
VISA | 'visa' | Visa |
VPAY | 'vPay' | Visa vPay |
ApplePayMerchantCapability
THREEDS | 'supports3DS' | Support the 3D Secure protocol |
DEBIT | 'supportsDebit' | Support for debit cards |
CREDIT | 'supportsCredit' | Support for credit cards |
EMV | 'supportsEMV' | Support for the EMV protocol |