### Install Dependencies Shell Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/CONTRIBUTING.md Installs the necessary project dependencies listed in the `package.json` file. This command should be run after cloning the repository to set up the development environment. ```shell npm install ``` -------------------------------- ### Install Capacitor Apple Pay Plugin - Bash Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Installs the Capacitor Apple Pay plugin using npm and synchronizes the changes with Capacitor. ```bash npm install @fresha/capacitor-plugin-applepay npx cap sync ``` -------------------------------- ### Install SwiftLint Shell Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/CONTRIBUTING.md Installs the SwiftLint tool using Homebrew. SwiftLint is a static analysis tool for enforcing Swift style and conventions. This step is required for macOS users who want to use the SwiftLint checks. ```shell brew install swiftlint ``` -------------------------------- ### Initiate Apple Pay Payment - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Initiates an Apple Pay payment based on a provided PaymentRequest object. Returns a promise resolving to an InitiatePaymentResponse object upon successful authorization. ```typescript initiatePayment(request: InitiatePaymentRequest) => Promise ``` -------------------------------- ### Publish Plugin to npm Shell Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/CONTRIBUTING.md Publishes the plugin package to the npm registry. A `prepublishOnly` hook is configured in `package.json` which automatically prepares the plugin assets before publishing. ```shell npm publish ``` -------------------------------- ### Build Plugin Assets Shell Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/CONTRIBUTING.md Executes the build script defined in `package.json`. This script compiles TypeScript source files into JavaScript modules and bundles them for distribution, and generates API documentation using `@capacitor/docgen`. ```shell npm run build ``` -------------------------------- ### Verify Plugin Builds Shell Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/CONTRIBUTING.md Runs the verification script to build and validate both the web and native projects of the plugin. This command is useful for ensuring the plugin builds correctly across all target platforms, often used in CI pipelines. ```shell npm run verify ``` -------------------------------- ### Check/Format Code Style Shell Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/CONTRIBUTING.md Executes scripts for checking (`lint`) and automatically formatting (`fmt`) code style and quality using tools like ESLint, Prettier, and SwiftLint. These commands help maintain consistent code style across the project. ```shell npm run lint ``` ```shell npm run fmt ``` -------------------------------- ### Check Apple Pay Support with Options - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Indicates whether the device supports Apple Pay and whether the user has an active card, allowing more granular control than the basic check. Takes options specifying supported networks and capabilities. ```typescript canMakePayments(options: CanMakePaymentsRequest) => Promise ``` -------------------------------- ### InitiatePaymentRequest Type Definition - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Defines the structure of the request payload required to initiate an Apple Pay payment. It specifies merchant details, supported networks and countries, required contact fields, capabilities, and summary items. ```TypeScript interface InitiatePaymentRequest { merchantIdentifier: string; countryCode: string; currencyCode: string; supportedCountries: string[]; supportedNetworks: PaymentNetwork[]; summaryItems: PaymentSummaryItem[]; requiredShippingContactFields: ContactField[]; requiredBillingContactFields: ContactField[]; merchantCapabilities: MerchantCapability[]; billingContact?: PaymentContact; shippingContact?: PaymentContact; } ``` -------------------------------- ### InitiatePaymentResponse Type Definition - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Defines the structure of the response received after initiating an Apple Pay payment. It includes the payment token, transaction identifier, and optional billing and shipping contact information. ```TypeScript interface InitiatePaymentResponse { 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; } ``` -------------------------------- ### CanMakePaymentsRequest Interface - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Defines the structure of the request object used in the canMakePayments method with options, specifying supported networks and capabilities. ```typescript interface CanMakePaymentsRequest { networks: PaymentNetwork[]; capabilities: MerchantCapability[]; } ``` -------------------------------- ### CanMakePaymentsResponse Interface - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Defines the structure of the response object returned by the canMakePayments methods, indicating whether payments can be made. ```typescript interface CanMakePaymentsResponse { canMakePayments: boolean; } ``` -------------------------------- ### PersonNameComponents Type Definition - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Defines the structure for breaking down a person's name into individual components like family name, given name, prefix, suffix, etc. ```TypeScript interface PersonNameComponents { familyName?: string; givenName?: string; namePrefix?: string; middleName?: string; nameSuffix?: string; nickname?: string; } ``` -------------------------------- ### Check Apple Pay Support - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Checks if the device supports Apple Pay without checking for active cards. Returns a promise resolving to a CanMakePaymentsResponse object. ```typescript canMakePayments() => Promise ``` -------------------------------- ### PaymentContact Type Definition - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Defines the structure for contact information, used for billing and shipping addresses in Apple Pay requests and responses. It includes email, phone, name components, and postal address details. ```TypeScript interface PaymentContact { emailAddress?: string; phoneNumber?: string; name?: PersonNameComponents; postalAddress?: { street?: string; city?: string; postalCode?: string; country?: string; isoCountryCode?: string; subAdministrativeArea?: string; subLocality?: string; }; } ``` -------------------------------- ### Complete Last Apple Pay Payment - TypeScript Source: https://github.com/fresha/capacitor-plugin-applepay/blob/main/README.md Completes the most recent Apple Pay payment with a given status provided in a CompletePaymentRequest object. This method does not return a value. ```typescript completeLastPayment(request: CompletePaymentRequest) => Promise ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.