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

@fresha/capacitor-plugin-applepay

v4.0.0

Published

Apple Pay plugin for Capacitor

Downloads

721

Readme

@fresha/capacitor-plugin-applepay

npm version

This Apple Pay plugin provides interfaces that allow you to initiate an Apple Pay payment sheet based on provided PaymentRequest. When transaction is authorized, Payment response is returned along with payment details and more importantly- a payment token that you should pass to your backend.

For Capacitor 4 please use version 4.0.0+ For Capacitor 3 please use lower versions.

Install

npm install @fresha/capacitor-plugin-applepay
npx cap sync

Configuration

Before using this plugin, make sure that your project is correctly configured. Usually your Payment Services Processor will provide detailed instructions, so please read their docs first.

Apple Developer Portal:

  • Add your Merchant identifier
  • Contact with your PSP who will generate CSR that you should pass into Apple Pay Payment Processing Certificate
  • Send the generated certificate to your PSP
  • Edit your App Identifier, add Apple Pay Payment Processing capability, select previously created merchant ID.
  • Renew your provisioning profiles

Xcode

  • Add Apple Pay capability
  • Select previously created merchant identifier
  • Make sure you are using renewed provisioning profiles

API

canMakePayments()

canMakePayments() => Promise<CanMakePaymentsResponse>

Indicates whether the device supports Apple Pay.

Returns: Promise<CanMakePaymentsResponse>


canMakePayments(...)

canMakePayments(options: CanMakePaymentsRequest) => Promise<CanMakePaymentsResponse>

Indicates whether the device supports Apple Pay and whether the user has an active card. This allows more granular control than regular canMakePayments()

| Param | Type | Description | | ------------- | ------------------------------------------------------------------------- | ------------------------------------- | | options | CanMakePaymentsRequest | - Supported networks and capabilities |

Returns: Promise<CanMakePaymentsResponse>


initiatePayment(...)

initiatePayment(request: InitiatePaymentRequest) => Promise<InitiatePaymentResponse>

Initiates a payment base on PaymentRequest object.

| Param | Type | Description | | ------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------- | | request | InitiatePaymentRequest | - PaymentRequest object that will be used for the payment. |

Returns: Promise<InitiatePaymentResponse>


completeLastPayment(...)

completeLastPayment(request: CompletePaymentRequest) => Promise<void>

Completes current payment

| Param | Type | Description | | ------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | request | CompletePaymentRequest | - CompletePaymentRequest object containing status |


Interfaces

CanMakePaymentsResponse

| Prop | Type | | --------------------- | -------------------- | | canMakePayments | boolean |

CanMakePaymentsRequest

| Prop | Type | | ------------------ | --------------------------------- | | networks | PaymentNetwork[] | | capabilities | MerchantCapability[] |

InitiatePaymentResponse

| Prop | Type | | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | token | { paymentData?: string; transactionIdentifier: string; paymentMethod: { displayName?: string; secureElementPass?: { deviceAccountNumberSuffix: string; deviceAccountIdentifier: string; primaryAccountIdentifier: string; primaryAccountNumberSuffix: string; devicePassIdentifier?: string; pairedTerminalIdentifier?: string; }; }; } | | billingContact | PaymentContact | | shippingContact | PaymentContact |

PaymentContact

| Prop | Type | | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | emailAddress | string | | phoneNumber | string | | name | PersonNameComponents | | postalAddress | { street?: string; city?: string; postalCode?: string; country?: string; isoCountryCode?: string; subAdministrativeArea?: string; subLocality?: string; } |

PersonNameComponents

| Prop | Type | | ---------------- | ------------------- | | familyName | string | | givenName | string | | namePrefix | string | | middleName | string | | nameSuffix | string | | nickname | string |

InitiatePaymentRequest

| Prop | Type | | ----------------------------------- | --------------------------------------------------------- | | merchantIdentifier | string | | countryCode | string | | currencyCode | string | | supportedCountries | string[] | | supportedNetworks | PaymentNetwork[] | | summaryItems | PaymentSummaryItem[] | | requiredShippingContactFields | ContactField[] | | requiredBillingContactFields | ContactField[] | | merchantCapabilities | MerchantCapability[] | | billingContact | PaymentContact | | shippingContact | PaymentContact |

PaymentSummaryItem

| Prop | Type | | ------------ | ------------------------------------------------------------------------- | | label | string | | amount | string | | type | PaymentSummaryItemType |

CompletePaymentRequest

| Prop | Type | | ------------ | --------------------------------------------------------------------------- | | status | PaymentCompletionStatus |

Type Aliases

PaymentNetwork

'amex' | 'chinaUnionPay' | 'cartesBancaires' | 'discover' | 'eftpos' | 'electron' | 'idCredit' | 'interac' | 'JCB' | 'maestro' | 'masterCard' | 'privateLabel' | 'quicPay' | 'suica' | 'visa' | 'vPay'

MerchantCapability

'capability3DS' | 'capabilityCredit' | 'capabilityDebit' | 'capabilityEMV'

PaymentSummaryItemType

'pending' | 'final'

ContactField

'emailAddress' | 'name' | 'phoneNumber' | 'phoneticName' | 'postalAddress'

PaymentCompletionStatus

'success' | 'failure'