@capgo/capacitor-pay 8.1.0 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +355 -69
- package/android/build.gradle +1 -1
- package/android/src/main/java/app/capgo/pay/PayPlugin.java +217 -57
- package/dist/docs.json +1288 -144
- package/dist/esm/definitions.d.ts +555 -26
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js +1 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -0
- package/dist/plugin.js.map +1 -1
- package/docs/google-pay-setup.md +33 -7
- package/ios/Sources/PayPlugin/PayPlugin.swift +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type PayPlatform = 'ios' | 'android' | 'web';\n\nexport type ApplePayNetwork =\n | 'AmEx'\n | 'amex'\n | 'Bancomat'\n | 'Bancontact'\n | 'PagoBancomat'\n | 'CarteBancaire'\n | 'CarteBancaires'\n | 'CartesBancaires'\n | 'ChinaUnionPay'\n | 'Dankort'\n | 'Discover'\n | 'discover'\n | 'Eftpos'\n | 'Electron'\n | 'Elo'\n | 'girocard'\n | 'Himyan'\n | 'Interac'\n | 'iD'\n | 'Jaywan'\n | 'JCB'\n | 'jcb'\n | 'mada'\n | 'Maestro'\n | 'maestro'\n | 'MasterCard'\n | 'masterCard'\n | 'Meeza'\n | 'Mir'\n | 'MyDebit'\n | 'NAPAS'\n | 'BankAxept'\n | 'PostFinanceAG'\n | 'PrivateLabel'\n | 'QUICPay'\n | 'Suica'\n | 'Visa'\n | 'visa'\n | 'VPay'\n | 'vPay';\n\nexport type ApplePayMerchantCapability = '3DS' | 'credit' | 'debit' | 'emv';\n\nexport type ApplePaySummaryItemType = 'final' | 'pending';\n\nexport type ApplePayContactField = 'emailAddress' | 'name' | 'phoneNumber' | 'postalAddress';\n\nexport type ApplePayShippingType = 'shipping' | 'delivery' | 'servicePickup' | 'storePickup';\n\nexport interface ApplePaySummaryItem {\n label: string;\n amount: string;\n type?: ApplePaySummaryItemType;\n}\n\nexport type ApplePayRecurringPaymentIntervalUnit = 'day' | 'week' | 'month' | 'year';\n\nexport interface ApplePayRecurringPaymentSummaryItem extends ApplePaySummaryItem {\n /**\n * Unit of time between recurring payments.\n */\n intervalUnit: ApplePayRecurringPaymentIntervalUnit;\n /**\n * Number of `intervalUnit` units between recurring payments (for example `1` month, `2` weeks).\n */\n intervalCount: number;\n /**\n * Start date of the recurring period.\n *\n * On supported platforms this may be either:\n * - a `number` representing milliseconds since Unix epoch, or\n * - a `string` in a date format accepted by the native implementation\n * (for example an ISO 8601 date-time string or a `yyyy-MM-dd` date string).\n */\n startDate?: number | string;\n /**\n * End date of the recurring period.\n *\n * On supported platforms this may be either:\n * - a `number` representing milliseconds since Unix epoch, or\n * - a `string` in a date format accepted by the native implementation\n * (for example an ISO 8601 date-time string or a `yyyy-MM-dd` date string).\n */\n endDate?: number | string;\n}\n\nexport interface ApplePayRecurringPaymentRequest {\n /**\n * A description for the recurring payment shown in the Apple Pay sheet.\n */\n paymentDescription: string;\n /**\n * The recurring billing item (for example your subscription).\n */\n regularBilling: ApplePayRecurringPaymentSummaryItem;\n /**\n * URL where the user can manage the recurring payment (cancel, update, etc).\n */\n managementURL: string;\n /**\n * Optional billing agreement text shown to the user.\n */\n billingAgreement?: string;\n /**\n * Optional URL where Apple can send token update notifications.\n */\n tokenNotificationURL?: string;\n /**\n * Optional trial billing item (for example a free trial period).\n */\n trialBilling?: ApplePayRecurringPaymentSummaryItem;\n}\n\nexport interface ApplePayAvailabilityOptions {\n /**\n * Optional list of payment networks you intend to use.\n * Passing networks determines the return value of `canMakePaymentsUsingNetworks`.\n */\n supportedNetworks?: ApplePayNetwork[];\n}\n\nexport interface ApplePayAvailabilityResult {\n /**\n * Indicates whether the device can make Apple Pay payments in general.\n */\n canMakePayments: boolean;\n /**\n * Indicates whether the device can make Apple Pay payments with the supplied networks.\n */\n canMakePaymentsUsingNetworks: boolean;\n}\n\nexport interface ApplePayPaymentOptions {\n /**\n * Merchant identifier created in the Apple Developer portal.\n */\n merchantIdentifier: string;\n /**\n * Two-letter ISO 3166 country code.\n */\n countryCode: string;\n /**\n * Three-letter ISO 4217 currency code.\n */\n currencyCode: string;\n /**\n * Payment summary items displayed in the Apple Pay sheet.\n */\n paymentSummaryItems: ApplePaySummaryItem[];\n /**\n * Card networks to support.\n */\n supportedNetworks: ApplePayNetwork[];\n /**\n * Merchant payment capabilities. Defaults to ['3DS'] when omitted.\n */\n merchantCapabilities?: ApplePayMerchantCapability[];\n /**\n * Contact fields that must be supplied for shipping.\n */\n requiredShippingContactFields?: ApplePayContactField[];\n /**\n * Contact fields that must be supplied for billing.\n */\n requiredBillingContactFields?: ApplePayContactField[];\n /**\n * Controls the shipping flow presented to the user.\n */\n shippingType?: ApplePayShippingType;\n /**\n * Optional ISO 3166 country codes where the merchant is supported.\n */\n supportedCountries?: string[];\n /**\n * Optional opaque application data passed back in the payment token.\n */\n applicationData?: string;\n\n /**\n * Recurring payment configuration (iOS 16+).\n */\n recurringPaymentRequest?: ApplePayRecurringPaymentRequest;\n}\n\nexport interface ApplePayContact {\n name?: {\n givenName?: string;\n familyName?: string;\n middleName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n nickname?: string;\n };\n emailAddress?: string;\n phoneNumber?: string;\n postalAddress?: {\n street?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n isoCountryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n };\n}\n\nexport interface ApplePayPaymentResult {\n /**\n * Raw payment token encoded as base64 string.\n */\n paymentData: string;\n /**\n * Raw payment token JSON string, useful for debugging.\n */\n paymentString: string;\n /**\n * Payment transaction identifier.\n */\n transactionIdentifier: string;\n paymentMethod: {\n displayName?: string;\n network?: ApplePayNetwork;\n type: 'debit' | 'credit' | 'prepaid' | 'store';\n };\n shippingContact?: ApplePayContact;\n billingContact?: ApplePayContact;\n}\n\nexport type GooglePayEnvironment = 'test' | 'production';\n\nexport type GooglePayCardNetwork =\n | 'AMEX'\n | 'DISCOVER'\n | 'JCB'\n | 'MASTERCARD'\n | 'VISA'\n // Keep this open-ended so users can pass new/region-specific networks without waiting for a release.\n | (string & Record<never, never>);\n\nexport type GooglePayAuthMethod =\n | 'PAN_ONLY'\n | 'CRYPTOGRAM_3DS'\n // Keep this open-ended for forward compatibility.\n | (string & Record<never, never>);\n\nexport type GooglePayTotalPriceStatus = 'NOT_CURRENTLY_KNOWN' | 'ESTIMATED' | 'FINAL' | (string & Record<never, never>);\n\nexport interface GooglePayBillingAddressParameters {\n format?: 'MIN' | 'FULL' | (string & Record<never, never>);\n phoneNumberRequired?: boolean;\n}\n\nexport interface GooglePayCardPaymentMethodParameters {\n allowedAuthMethods?: GooglePayAuthMethod[];\n allowedCardNetworks?: GooglePayCardNetwork[];\n billingAddressRequired?: boolean;\n billingAddressParameters?: GooglePayBillingAddressParameters;\n}\n\nexport interface GooglePayTokenizationSpecification {\n type?: 'PAYMENT_GATEWAY' | 'DIRECT' | (string & Record<never, never>);\n parameters?: Record<string, string>;\n}\n\nexport interface GooglePayAllowedPaymentMethod {\n type?: 'CARD' | (string & Record<never, never>);\n parameters?: GooglePayCardPaymentMethodParameters;\n tokenizationSpecification?: GooglePayTokenizationSpecification;\n}\n\nexport interface GooglePayMerchantInfo {\n merchantId?: string;\n merchantName?: string;\n}\n\nexport interface GooglePayTransactionInfo {\n totalPriceStatus?: GooglePayTotalPriceStatus;\n totalPrice?: string;\n currencyCode?: string;\n countryCode?: string;\n}\n\n/**\n * Typed helper for the Google Pay `IsReadyToPayRequest` JSON.\n * The native Android implementation still accepts arbitrary JSON (forward compatible).\n */\nexport interface GooglePayIsReadyToPayRequest {\n /**\n * The list of payment methods you want to check for readiness.\n */\n allowedPaymentMethods?: GooglePayAllowedPaymentMethod[];\n /**\n * Forward-compatible escape hatch for additional fields supported by Google Pay.\n */\n [key: string]: unknown;\n}\n\n/**\n * Typed helper for the Google Pay `PaymentDataRequest` JSON.\n * The native Android implementation still accepts arbitrary JSON (forward compatible).\n */\nexport interface GooglePayPaymentDataRequest {\n /**\n * Google Pay API version, typically `2`.\n */\n apiVersion?: number;\n /**\n * Google Pay API minor version, typically `0`.\n */\n apiVersionMinor?: number;\n /**\n * Allowed payment method configurations.\n */\n allowedPaymentMethods?: GooglePayAllowedPaymentMethod[];\n /**\n * Merchant information displayed in the Google Pay sheet.\n */\n merchantInfo?: GooglePayMerchantInfo;\n /**\n * Transaction details (amount, currency, etc).\n */\n transactionInfo?: GooglePayTransactionInfo;\n /**\n * Forward-compatible escape hatch for additional fields supported by Google Pay.\n */\n [key: string]: unknown;\n}\n\nexport interface GooglePayAvailabilityOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `IsReadyToPayRequest` JSON as defined by the Google Pay API.\n * Supply the card networks and auth methods you intend to support at runtime.\n */\n isReadyToPayRequest?: GooglePayIsReadyToPayRequest;\n}\n\nexport interface GooglePayAvailabilityResult {\n /**\n * Indicates whether the Google Pay API is available for the supplied parameters.\n */\n isReady: boolean;\n}\n\nexport interface GooglePayPaymentOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `PaymentDataRequest` JSON as defined by the Google Pay API.\n * Provide transaction details, merchant info, and tokenization parameters.\n */\n paymentDataRequest: GooglePayPaymentDataRequest;\n}\n\nexport interface GooglePayPaymentResult {\n /**\n * Payment data returned by Google Pay.\n */\n paymentData: Record<string, unknown>;\n}\n\nexport interface PayAvailabilityOptions {\n apple?: ApplePayAvailabilityOptions;\n google?: GooglePayAvailabilityOptions;\n}\n\nexport interface PayAvailabilityResult {\n available: boolean;\n platform: PayPlatform;\n apple?: ApplePayAvailabilityResult;\n google?: GooglePayAvailabilityResult;\n}\n\nexport interface PayPaymentOptions {\n apple?: ApplePayPaymentOptions;\n google?: GooglePayPaymentOptions;\n}\n\nexport interface PayPaymentResult {\n platform: Exclude<PayPlatform, 'web'>;\n apple?: ApplePayPaymentResult;\n google?: GooglePayPaymentResult;\n}\n\nexport interface PayPlugin {\n /**\n * Checks whether native pay is available on the current platform.\n * On iOS this evaluates Apple Pay, on Android it evaluates Google Pay.\n */\n isPayAvailable(options?: PayAvailabilityOptions): Promise<PayAvailabilityResult>;\n /**\n * Presents the native pay sheet for the current platform.\n * Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.\n */\n requestPayment(options: PayPaymentOptions): Promise<PayPaymentResult>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type PayPlatform = 'ios' | 'android' | 'web';\n\nexport type ApplePayNetwork =\n | 'AmEx'\n | 'amex'\n | 'Bancomat'\n | 'Bancontact'\n | 'PagoBancomat'\n | 'CarteBancaire'\n | 'CarteBancaires'\n | 'CartesBancaires'\n | 'ChinaUnionPay'\n | 'Dankort'\n | 'Discover'\n | 'discover'\n | 'Eftpos'\n | 'Electron'\n | 'Elo'\n | 'girocard'\n | 'Himyan'\n | 'Interac'\n | 'iD'\n | 'Jaywan'\n | 'JCB'\n | 'jcb'\n | 'mada'\n | 'Maestro'\n | 'maestro'\n | 'MasterCard'\n | 'masterCard'\n | 'Meeza'\n | 'Mir'\n | 'MyDebit'\n | 'NAPAS'\n | 'BankAxept'\n | 'PostFinanceAG'\n | 'PrivateLabel'\n | 'QUICPay'\n | 'Suica'\n | 'Visa'\n | 'visa'\n | 'VPay'\n | 'vPay';\n\nexport type ApplePayMerchantCapability = '3DS' | 'credit' | 'debit' | 'emv';\n\nexport type ApplePaySummaryItemType = 'final' | 'pending';\n\nexport type ApplePayContactField = 'emailAddress' | 'name' | 'phoneNumber' | 'postalAddress';\n\nexport type ApplePayShippingType = 'shipping' | 'delivery' | 'servicePickup' | 'storePickup';\n\nexport interface ApplePaySummaryItem {\n label: string;\n amount: string;\n type?: ApplePaySummaryItemType;\n}\n\nexport type ApplePayRecurringPaymentIntervalUnit = 'day' | 'week' | 'month' | 'year';\n\nexport interface ApplePayRecurringPaymentSummaryItem extends ApplePaySummaryItem {\n /**\n * Unit of time between recurring payments.\n */\n intervalUnit: ApplePayRecurringPaymentIntervalUnit;\n /**\n * Number of `intervalUnit` units between recurring payments (for example `1` month, `2` weeks).\n */\n intervalCount: number;\n /**\n * Start date of the recurring period.\n *\n * On supported platforms this may be either:\n * - a `number` representing milliseconds since Unix epoch, or\n * - a `string` in a date format accepted by the native implementation\n * (for example an ISO 8601 date-time string or a `yyyy-MM-dd` date string).\n */\n startDate?: number | string;\n /**\n * End date of the recurring period.\n *\n * On supported platforms this may be either:\n * - a `number` representing milliseconds since Unix epoch, or\n * - a `string` in a date format accepted by the native implementation\n * (for example an ISO 8601 date-time string or a `yyyy-MM-dd` date string).\n */\n endDate?: number | string;\n}\n\nexport interface ApplePayRecurringPaymentRequest {\n /**\n * A description for the recurring payment shown in the Apple Pay sheet.\n */\n paymentDescription: string;\n /**\n * The recurring billing item (for example your subscription).\n */\n regularBilling: ApplePayRecurringPaymentSummaryItem;\n /**\n * URL where the user can manage the recurring payment (cancel, update, etc).\n */\n managementURL: string;\n /**\n * Optional billing agreement text shown to the user.\n */\n billingAgreement?: string;\n /**\n * Optional URL where Apple can send token update notifications.\n */\n tokenNotificationURL?: string;\n /**\n * Optional trial billing item (for example a free trial period).\n */\n trialBilling?: ApplePayRecurringPaymentSummaryItem;\n}\n\nexport interface ApplePayAvailabilityOptions {\n /**\n * Optional list of payment networks you intend to use.\n * Passing networks determines the return value of `canMakePaymentsUsingNetworks`.\n */\n supportedNetworks?: ApplePayNetwork[];\n}\n\nexport interface ApplePayAvailabilityResult {\n /**\n * Indicates whether the device can make Apple Pay payments in general.\n */\n canMakePayments: boolean;\n /**\n * Indicates whether the device can make Apple Pay payments with the supplied networks.\n */\n canMakePaymentsUsingNetworks: boolean;\n}\n\nexport interface ApplePayPaymentOptions {\n /**\n * Merchant identifier created in the Apple Developer portal.\n */\n merchantIdentifier: string;\n /**\n * Two-letter ISO 3166 country code.\n */\n countryCode: string;\n /**\n * Three-letter ISO 4217 currency code.\n */\n currencyCode: string;\n /**\n * Payment summary items displayed in the Apple Pay sheet.\n */\n paymentSummaryItems: ApplePaySummaryItem[];\n /**\n * Card networks to support.\n */\n supportedNetworks: ApplePayNetwork[];\n /**\n * Merchant payment capabilities. Defaults to ['3DS'] when omitted.\n */\n merchantCapabilities?: ApplePayMerchantCapability[];\n /**\n * Contact fields that must be supplied for shipping.\n */\n requiredShippingContactFields?: ApplePayContactField[];\n /**\n * Contact fields that must be supplied for billing.\n */\n requiredBillingContactFields?: ApplePayContactField[];\n /**\n * Controls the shipping flow presented to the user.\n */\n shippingType?: ApplePayShippingType;\n /**\n * Optional ISO 3166 country codes where the merchant is supported.\n */\n supportedCountries?: string[];\n /**\n * Optional opaque application data passed back in the payment token.\n */\n applicationData?: string;\n\n /**\n * Recurring payment configuration (iOS 16+).\n */\n recurringPaymentRequest?: ApplePayRecurringPaymentRequest;\n}\n\nexport interface ApplePayContact {\n name?: {\n givenName?: string;\n familyName?: string;\n middleName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n nickname?: string;\n };\n emailAddress?: string;\n phoneNumber?: string;\n postalAddress?: {\n street?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n isoCountryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n };\n}\n\nexport interface ApplePayPaymentResult {\n /**\n * Raw payment token encoded as base64 string.\n */\n paymentData: string;\n /**\n * Raw payment token JSON string, useful for debugging.\n */\n paymentString: string;\n /**\n * Payment transaction identifier.\n */\n transactionIdentifier: string;\n paymentMethod: {\n displayName?: string;\n network?: ApplePayNetwork;\n type: 'debit' | 'credit' | 'prepaid' | 'store';\n };\n shippingContact?: ApplePayContact;\n billingContact?: ApplePayContact;\n}\n\nexport type GooglePayEnvironment = 'test' | 'production';\n\nexport type GooglePayCardNetwork =\n | 'AMEX'\n | 'DISCOVER'\n | 'ELECTRON'\n | 'ELO'\n | 'ELO_DEBIT'\n | 'INTERAC'\n | 'JCB'\n | 'MAESTRO'\n | 'MASTERCARD'\n | 'VISA'\n // Keep this open-ended so users can pass new/region-specific networks without waiting for a release.\n | (string & Record<never, never>);\n\nexport type GooglePayAuthMethod =\n | 'PAN_ONLY'\n | 'CRYPTOGRAM_3DS'\n // Keep this open-ended for forward compatibility without waiting for a release.\n | (string & Record<never, never>);\n\nexport type GooglePayPaymentMethodType = 'CARD' | (string & Record<never, never>);\n\nexport type GooglePayTokenizationType = 'PAYMENT_GATEWAY' | 'DIRECT' | (string & Record<never, never>);\n\nexport type GooglePayBillingAddressFormat = 'MIN' | 'FULL' | 'FULL-ISO3166' | (string & Record<never, never>);\n\nexport type GooglePayShippingAddressFormat = 'FULL' | 'FULL-ISO3166' | (string & Record<never, never>);\n\nexport type GooglePayTotalPriceStatus = 'NOT_CURRENTLY_KNOWN' | 'ESTIMATED' | 'FINAL' | (string & Record<never, never>);\n\nexport type GooglePayCheckoutOption =\n | 'DEFAULT'\n | 'COMPLETE_IMMEDIATE_PURCHASE'\n | 'CONTINUE_TO_REVIEW'\n | (string & Record<never, never>);\n\nexport type GooglePayDisplayItemType =\n | 'LINE_ITEM'\n | 'SUBTOTAL'\n | 'TAX'\n | 'DISCOUNT'\n | 'SHIPPING_OPTION'\n | (string & Record<never, never>);\n\nexport type GooglePayDisplayItemStatus = 'FINAL' | 'PENDING' | (string & Record<never, never>);\n\nexport type GooglePayCallbackIntent =\n | 'OFFER'\n | 'PAYMENT_AUTHORIZATION'\n | 'SHIPPING_ADDRESS'\n | 'SHIPPING_OPTION'\n | 'PAYMENT_METHOD'\n | (string & Record<never, never>);\n\nexport type GooglePayCardFundingSource = 'UNKNOWN' | 'CREDIT' | 'DEBIT' | 'PREPAID' | (string & Record<never, never>);\n\nexport interface GooglePayBillingAddressParameters {\n /**\n * Billing address format to return when `billingAddressRequired` is `true`.\n *\n * Use `FULL` only when you truly need the extra fields to complete the order.\n */\n format?: GooglePayBillingAddressFormat;\n /**\n * Whether a billing phone number should also be returned.\n */\n phoneNumberRequired?: boolean;\n}\n\nexport interface GooglePayShippingAddressParameters {\n /**\n * Restricts shipping addresses to the provided ISO 3166-1 alpha-2 country codes.\n */\n allowedCountryCodes?: string[];\n /**\n * Whether a phone number should be collected with the shipping address.\n */\n phoneNumberRequired?: boolean;\n /**\n * Shipping address format to return when `shippingAddressRequired` is `true`.\n *\n * `MIN` is not a valid value for shipping addresses.\n */\n format?: GooglePayShippingAddressFormat;\n}\n\nexport interface GooglePayCardNetworkParameters {\n /**\n * Card network these network-specific parameters apply to.\n */\n cardNetwork: GooglePayCardNetwork;\n /**\n * Acquiring institution identification code used by some network-specific flows.\n */\n acquirerBin?: string;\n /**\n * Acquirer-assigned merchant identifier used by some network-specific flows.\n */\n acquirerMerchantId?: string;\n}\n\nexport interface GooglePayCardPaymentMethodParameters {\n /**\n * Authentication methods your gateway or processor accepts.\n */\n allowedAuthMethods: GooglePayAuthMethod[];\n /**\n * Card networks your gateway or processor accepts.\n */\n allowedCardNetworks: GooglePayCardNetwork[];\n /**\n * Whether prepaid cards are allowed. Defaults to `true` in Google Pay.\n */\n allowPrepaidCards?: boolean;\n /**\n * Whether credit cards are allowed. Defaults to `true` in Google Pay.\n */\n allowCreditCards?: boolean;\n /**\n * Restricts users to cards issued in the provided ISO 3166-1 alpha-2 countries.\n */\n allowedIssuerCountryCodes?: string[];\n /**\n * Blocks cards issued in the provided ISO 3166-1 alpha-2 countries.\n *\n * This is mutually exclusive with `allowedIssuerCountryCodes`.\n */\n blockedIssuerCountryCodes?: string[];\n /**\n * Whether Google Pay should include assurance details about the selected card.\n */\n assuranceDetailsRequired?: boolean;\n /**\n * Whether a billing address is required from the buyer.\n */\n billingAddressRequired?: boolean;\n /**\n * Additional billing-address controls used when `billingAddressRequired` is `true`.\n */\n billingAddressParameters?: GooglePayBillingAddressParameters;\n /**\n * Optional network-specific processing parameters for supported networks.\n */\n cardNetworkParameters?: GooglePayCardNetworkParameters[];\n /**\n * Whether the card verification code should be returned in the payment token.\n *\n * This requires Google enablement for your account.\n */\n cvcRequired?: boolean;\n}\n\n/**\n * Tokenization parameters for `PAYMENT_GATEWAY` tokenization, which sends the payment data to a supported third-party gateway for tokenization and processing.\n * @see https://developers.google.com/pay/api/android/reference/request-objects#gateway\n */\nexport interface GooglePayPaymentGatewayTokenizationParameters {\n /**\n * Additional gateway-specific tokenization parameters.\n */\n [key: string]: string | undefined;\n /**\n * Google Pay gateway identifier.\n */\n gateway: string;\n /**\n * Merchant identifier issued by your payment gateway when required.\n */\n gatewayMerchantId?: string;\n}\n\nexport interface GooglePayDirectTokenizationParameters {\n /**\n * Payment data cryptography protocol version.\n */\n protocolVersion: string;\n /**\n * Base64-encoded elliptic-curve public key used to encrypt the payment data.\n */\n publicKey: string;\n}\n\nexport interface GooglePayGatewayTokenizationSpecification {\n /**\n * Tokenize payment data for a supported third-party gateway.\n */\n type: 'PAYMENT_GATEWAY';\n /**\n * Gateway-specific tokenization parameters.\n */\n parameters: GooglePayPaymentGatewayTokenizationParameters;\n}\n\nexport interface GooglePayDirectTokenizationSpecification {\n /**\n * Tokenize payment data directly for merchant-side decryption.\n */\n type: 'DIRECT';\n /**\n * Direct tokenization parameters for payment data cryptography.\n */\n parameters: GooglePayDirectTokenizationParameters;\n}\n\nexport interface GooglePayCustomTokenizationSpecification {\n /**\n * Tokenization type understood by your Google Pay integration.\n */\n type?: GooglePayTokenizationType;\n /**\n * Tokenization parameters. Google Pay expects string values.\n */\n parameters?: Record<string, string>;\n}\n\nexport type GooglePayTokenizationSpecification =\n | GooglePayGatewayTokenizationSpecification\n | GooglePayDirectTokenizationSpecification\n | GooglePayCustomTokenizationSpecification;\n\nexport interface GooglePayAllowedPaymentMethod {\n /**\n * Supported payment method type. `CARD` is the only value currently accepted by Google Pay request objects.\n */\n type?: GooglePayPaymentMethodType;\n /**\n * Parameters that control which cards can be shown and what extra data is collected.\n */\n parameters?: GooglePayCardPaymentMethodParameters;\n /**\n * Tokenization settings for the selected payment method.\n *\n * In Google Pay, this is required for `PaymentDataRequest` card payment methods, but ignored by `IsReadyToPayRequest`.\n * @see https://developers.google.com/pay/api/android/reference/request-objects#PaymentMethodTokenizationSpecification\n */\n tokenizationSpecification?: GooglePayTokenizationSpecification;\n}\n\nexport interface GooglePaySoftwareInfo {\n /**\n * Identifier for the software integrating with Google Pay, such as your domain name.\n */\n id?: string;\n /**\n * Version of the integrating software.\n */\n version?: string;\n}\n\nexport interface GooglePayMerchantInfo {\n /**\n * Google merchant identifier.\n *\n * This is required for recognized production web integrations and may also be supplied on Android.\n */\n merchantId?: string;\n /**\n * Merchant name displayed in the Google Pay sheet.\n */\n merchantName?: string;\n /**\n * Optional metadata about the software integrating with Google Pay.\n */\n softwareInfo?: GooglePaySoftwareInfo;\n}\n\nexport interface GooglePayDisplayItem {\n /**\n * User-visible line-item label.\n */\n label: string;\n /**\n * Category of the line item.\n */\n type: GooglePayDisplayItemType;\n /**\n * Monetary value for the item.\n *\n * Google Pay accepts an optional decimal precision of two decimal places.\n */\n price: string;\n /**\n * Whether this line item is final or still pending.\n */\n status?: GooglePayDisplayItemStatus;\n}\n\nexport interface GooglePayOfferDetail {\n /**\n * Redemption code that identifies the offer.\n */\n redemptionCode: string;\n /**\n * User-visible description for the offer.\n */\n description: string;\n}\n\nexport interface GooglePayOfferInfo {\n /**\n * Merchant-provided offers available for the current order.\n */\n offers: GooglePayOfferDetail[];\n}\n\nexport interface GooglePaySelectionOption {\n /**\n * Unique identifier for the option.\n */\n id: string;\n /**\n * User-visible label for the option.\n */\n label: string;\n /**\n * Optional secondary description shown under the label.\n */\n description?: string;\n}\n\nexport interface GooglePayShippingOptionParameters {\n /**\n * Available shipping options presented to the buyer.\n */\n shippingOptions: GooglePaySelectionOption[];\n /**\n * Identifier of the default selected shipping option.\n */\n defaultSelectedOptionId?: string;\n}\n\nexport interface GooglePayTransactionInfo {\n /**\n * Merchant-generated correlation identifier for the transaction.\n */\n transactionId?: string;\n /**\n * ISO 4217 alphabetic currency code.\n *\n * Google Pay requires this for chargeable payment requests.\n */\n currencyCode?: string;\n /**\n * ISO 3166-1 alpha-2 country code where the transaction is processed.\n *\n * This is required for EEA/SCA flows and recommended for country-specific behavior.\n */\n countryCode?: string;\n /**\n * Total transaction price using an optional decimal precision of two decimal places.\n */\n totalPrice?: string;\n /**\n * Custom total label shown with `displayItems`.\n */\n totalPriceLabel?: string;\n /**\n * Status of the total price.\n */\n totalPriceStatus?: GooglePayTotalPriceStatus;\n /**\n * Optional transaction note. Some payment methods, such as UPI on web, require this.\n */\n transactionNote?: string;\n /**\n * Controls the submit button label shown in the Google Pay sheet.\n */\n checkoutOption?: GooglePayCheckoutOption;\n /**\n * Optional cart line items shown in the Google Pay sheet.\n */\n displayItems?: GooglePayDisplayItem[];\n}\n\n/**\n * Self-contained Google Pay request type based on the official request objects and DefinitelyTyped definitions.\n *\n * The plugin forwards the provided JSON to the native Google Pay SDK on Android, while keeping the type surface local\n * so consumers do not need to install `@types/googlepay`.\n */\nexport interface GooglePayIsReadyToPayRequest {\n /**\n * Google Pay API major version.\n *\n * Use `2` for current integrations.\n */\n apiVersion?: number;\n /**\n * Google Pay API minor version.\n *\n * Use `0` for current integrations.\n */\n apiVersionMinor?: number;\n /**\n * Payment methods you want to test for readiness.\n */\n allowedPaymentMethods?: GooglePayAllowedPaymentMethod[];\n /**\n * When `true`, Google Pay also indicates whether an existing matching payment method is present.\n *\n * In the `test` environment this always resolves to `true`.\n */\n existingPaymentMethodRequired?: boolean;\n /**\n * Forward-compatible escape hatch for additional fields supported by Google Pay.\n */\n [key: string]: unknown;\n}\n\n/**\n * Self-contained Google Pay payment request type based on the official request objects and DefinitelyTyped definitions.\n *\n * The plugin forwards the provided JSON to the native Google Pay SDK on Android, while keeping the type surface local\n * so consumers do not need to install `@types/googlepay`.\n */\nexport interface GooglePayPaymentDataRequest {\n /**\n * Google Pay API major version.\n *\n * Use `2` for current integrations.\n */\n apiVersion?: number;\n /**\n * Google Pay API minor version.\n *\n * Use `0` for current integrations.\n */\n apiVersionMinor?: number;\n /**\n * Merchant information displayed in the Google Pay sheet.\n */\n merchantInfo?: GooglePayMerchantInfo;\n /**\n * Allowed payment method configurations.\n */\n allowedPaymentMethods?: GooglePayAllowedPaymentMethod[];\n /**\n * Transaction details such as amount, currency, and checkout behavior.\n */\n transactionInfo?: GooglePayTransactionInfo;\n /**\n * Whether the buyer email address should be returned.\n */\n emailRequired?: boolean;\n /**\n * Whether a shipping address should be collected.\n */\n shippingAddressRequired?: boolean;\n /**\n * Shipping-address restrictions used when `shippingAddressRequired` is `true`.\n */\n shippingAddressParameters?: GooglePayShippingAddressParameters;\n /**\n * Merchant-provided offers to pre-populate in the Google Pay sheet.\n *\n * This is part of the official web request object and may not be supported by every native Android flow.\n */\n offerInfo?: GooglePayOfferInfo;\n /**\n * Whether the Google Pay sheet should collect a shipping option.\n *\n * This is part of the official web request object and is used with dynamic price updates.\n */\n shippingOptionRequired?: boolean;\n /**\n * Default shipping options for the Google Pay sheet.\n *\n * This is part of the official web request object and is used with dynamic price updates.\n */\n shippingOptionParameters?: GooglePayShippingOptionParameters;\n /**\n * Callback intents for dynamic price updates and payment authorization on the web.\n *\n * These values are included for completeness with the official Google Pay request object, but the Capacitor plugin\n * does not currently expose the corresponding web callbacks.\n */\n callbackIntents?: GooglePayCallbackIntent[];\n /**\n * Forward-compatible escape hatch for additional fields supported by Google Pay.\n */\n [key: string]: unknown;\n}\n\nexport interface GooglePayAddress {\n /**\n * Recipient or cardholder name.\n */\n name?: string;\n /**\n * First address line.\n */\n address1?: string;\n /**\n * Second address line.\n */\n address2?: string;\n /**\n * Third address line.\n */\n address3?: string;\n /**\n * City or locality.\n */\n locality?: string;\n /**\n * State, province, or other administrative area.\n */\n administrativeArea?: string;\n /**\n * Two-letter ISO 3166-1 alpha-2 country code.\n */\n countryCode: string;\n /**\n * Postal or ZIP code.\n */\n postalCode: string;\n /**\n * Sorting code used in some countries.\n */\n sortingCode?: string;\n /**\n * Phone number returned when it was requested.\n */\n phoneNumber?: string;\n /**\n * ISO 3166-2 code for the administrative area when `FULL-ISO3166` formatting is used.\n */\n iso3166AdministrativeArea?: string;\n}\n\nexport interface GooglePayAssuranceDetails {\n /**\n * Whether Google verified account possession for the selected card.\n */\n accountVerified?: boolean;\n /**\n * Whether cardholder authentication or ID&V was completed for the selected card.\n */\n cardHolderAuthenticated?: boolean;\n}\n\nexport interface GooglePayCardInfo {\n /**\n * Optional assurance details returned when `assuranceDetailsRequired` was requested.\n */\n assuranceDetails?: GooglePayAssuranceDetails;\n /**\n * Card network for the selected payment method.\n */\n cardNetwork: GooglePayCardNetwork;\n /**\n * Card details, typically the last four digits.\n */\n cardDetails: string;\n /**\n * Billing address returned when `billingAddressRequired` was requested.\n */\n billingAddress?: GooglePayAddress;\n /**\n * Funding source for the selected card when available.\n */\n cardFundingSource?: GooglePayCardFundingSource;\n}\n\nexport interface GooglePayPaymentMethodTokenizationData {\n /**\n * Tokenization type used for the selected payment method.\n */\n type: GooglePayTokenizationType;\n /**\n * Serialized payment token or gateway payload.\n */\n token: string;\n}\n\nexport interface GooglePayPaymentMethodData {\n /**\n * Payment method type returned by Google Pay.\n */\n type: GooglePayPaymentMethodType;\n /**\n * Additional information about the selected card.\n */\n info?: GooglePayCardInfo;\n /**\n * User-facing description of the selected funding source.\n */\n description?: string;\n /**\n * Tokenized payment data you send to your backend or processor.\n */\n tokenizationData: GooglePayPaymentMethodTokenizationData;\n}\n\nexport interface GooglePayOfferData {\n /**\n * Offer redemption codes applied by the buyer.\n */\n redemptionCodes: string[];\n}\n\nexport interface GooglePaySelectionOptionData {\n /**\n * Identifier of the selected option.\n */\n id: string;\n}\n\nexport interface GooglePayIsReadyToPayResponse {\n /**\n * Whether Google Pay is available for at least one of the requested payment methods.\n */\n result: boolean;\n /**\n * Whether the current user already has one of the requested payment methods available.\n *\n * This is only returned by Google Pay web integrations when `existingPaymentMethodRequired` is `true`.\n */\n paymentMethodPresent?: boolean;\n}\n\nexport interface GooglePayPaymentData {\n /**\n * Google Pay API major version returned in the response.\n */\n apiVersion: number;\n /**\n * Google Pay API minor version returned in the response.\n */\n apiVersionMinor: number;\n /**\n * Buyer email address when `emailRequired` was requested.\n */\n email?: string;\n /**\n * Shipping address when `shippingAddressRequired` was requested.\n */\n shippingAddress?: GooglePayAddress;\n /**\n * Selected payment method details and tokenized payload.\n */\n paymentMethodData: GooglePayPaymentMethodData;\n /**\n * Offer redemption data when an offer was applied.\n */\n offerData?: GooglePayOfferData;\n /**\n * Selected shipping option data when shipping options were used.\n */\n shippingOptionData?: GooglePaySelectionOptionData;\n}\n\nexport interface GooglePayAvailabilityOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `IsReadyToPayRequest` JSON as defined by the Google Pay API.\n * Supply the card networks and auth methods you intend to support at runtime.\n *\n * @see https://developers.google.com/pay/api/android/reference/request-objects#IsReadyToPayRequest\n */\n isReadyToPayRequest?: GooglePayIsReadyToPayRequest;\n}\n\nexport interface GooglePayAvailabilityResult {\n /**\n * Whether the user is able to provide payment information through the Google Pay payment sheet.\n */\n isReady: boolean;\n /**\n * The current user's ability to pay with one or more of the payment methods specified in `IsReadyToPayRequest.allowedPaymentMethods`.\n *\n * This property only exists if `IsReadyToPayRequest.existingPaymentMethodRequired` was set to `true`. The property value will always be `true` if the request is configured for a test environment.\n */\n paymentMethodPresent: boolean | undefined;\n}\n\nexport interface GooglePayPaymentOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `PaymentDataRequest` JSON as defined by the Google Pay API.\n * Provide transaction details, merchant info, and tokenization parameters.\n *\n * @see https://developers.google.com/pay/api/android/reference/request-objects#PaymentDataRequest\n */\n paymentDataRequest: GooglePayPaymentDataRequest;\n}\n\nexport interface GooglePayPaymentResult {\n /**\n * Payment data returned by Google Pay.\n *\n * @see https://developers.google.com/pay/api/android/reference/response-objects#PaymentData\n */\n paymentData: GooglePayPaymentData;\n}\n\nexport interface PayAvailabilityOptions {\n apple?: ApplePayAvailabilityOptions;\n google?: GooglePayAvailabilityOptions;\n}\n\nexport interface PayAvailabilityResult {\n available: boolean;\n platform: PayPlatform;\n apple?: ApplePayAvailabilityResult;\n google?: GooglePayAvailabilityResult;\n}\n\nexport interface PayPaymentOptions {\n apple?: ApplePayPaymentOptions;\n google?: GooglePayPaymentOptions;\n}\n\nexport interface ApplePayRequestPaymentResult {\n /**\n * Platform that resolved the payment request.\n */\n platform: 'ios';\n /**\n * Apple Pay payment payload.\n */\n apple: ApplePayPaymentResult;\n}\n\nexport interface GooglePayRequestPaymentResult {\n /**\n * Platform that resolved the payment request.\n */\n platform: 'android';\n /**\n * Google Pay payment payload.\n */\n google: GooglePayPaymentResult;\n}\n\nexport type PayPaymentResult = ApplePayRequestPaymentResult | GooglePayRequestPaymentResult;\n\nexport interface PayPlugin {\n /**\n * Checks whether native pay is available on the current platform.\n * On iOS this evaluates Apple Pay, on Android it evaluates Google Pay.\n */\n isPayAvailable(options?: PayAvailabilityOptions): Promise<PayAvailabilityResult>;\n /**\n * Presents the native pay sheet for the current platform.\n * Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.\n *\n * This promise is the completion path on both platforms.\n */\n requestPayment(options: PayPaymentOptions): Promise<PayPaymentResult>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC,KAAK,CAAC,cAAc,CAAC,QAAiC;QACpD,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE;gBACL,eAAe,EAAE,KAAK;gBACtB,4BAA4B,EAAE,KAAK;aACpC;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC,KAAK,CAAC,cAAc,CAAC,QAAiC;QACpD,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE;gBACL,eAAe,EAAE,KAAK;gBACtB,4BAA4B,EAAE,KAAK;aACpC;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;gBACd,oBAAoB,EAAE,SAAS;aAChC;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAA2B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n PayAvailabilityOptions,\n PayAvailabilityResult,\n PayPaymentOptions,\n PayPaymentResult,\n PayPlugin,\n} from './definitions';\n\nexport class PayWeb extends WebPlugin implements PayPlugin {\n async isPayAvailable(_options?: PayAvailabilityOptions): Promise<PayAvailabilityResult> {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n paymentMethodPresent: undefined,\n },\n };\n }\n\n async requestPayment(_options: PayPaymentOptions): Promise<PayPaymentResult> {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,KAAK;AAC5B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,KAAK,EAAE;AACnB,gBAAgB,eAAe,EAAE,KAAK;AACtC,gBAAgB,4BAA4B,EAAE,KAAK;AACnD,aAAa;AACb,YAAY,MAAM,EAAE;AACpB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;AAC1G,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n paymentMethodPresent: undefined,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,KAAK;AAC5B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,KAAK,EAAE;AACnB,gBAAgB,eAAe,EAAE,KAAK;AACtC,gBAAgB,4BAA4B,EAAE,KAAK;AACnD,aAAa;AACb,YAAY,MAAM,EAAE;AACpB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,gBAAgB,oBAAoB,EAAE,SAAS;AAC/C,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;AAC1G,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,OAAO;IACf,YAAY,SAAS,EAAE,KAAK;IAC5B,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,KAAK,EAAE;IACnB,gBAAgB,eAAe,EAAE,KAAK;IACtC,gBAAgB,4BAA4B,EAAE,KAAK;IACnD,aAAa;IACb,YAAY,MAAM,EAAE;IACpB,gBAAgB,OAAO,EAAE,KAAK;IAC9B,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;IAC1G,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n paymentMethodPresent: undefined,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,OAAO;IACf,YAAY,SAAS,EAAE,KAAK;IAC5B,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,KAAK,EAAE;IACnB,gBAAgB,eAAe,EAAE,KAAK;IACtC,gBAAgB,4BAA4B,EAAE,KAAK;IACnD,aAAa;IACb,YAAY,MAAM,EAAE;IACpB,gBAAgB,OAAO,EAAE,KAAK;IAC9B,gBAAgB,oBAAoB,EAAE,SAAS;IAC/C,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;IAC1G,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
package/docs/google-pay-setup.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Follow this checklist to enable Google Pay for the Android implementation of `@capgo/capacitor-pay`.
|
|
4
4
|
|
|
5
|
+
The plugin already ships its own Google Pay request and response typings, so you do not need to add `@types/googlepay` unless you separately use Google's web JavaScript client.
|
|
6
|
+
|
|
5
7
|
## 1. Requirements
|
|
6
8
|
|
|
7
9
|
- A Google Play Console account with the correct app package name registered.
|
|
@@ -9,6 +11,29 @@ Follow this checklist to enable Google Pay for the Android implementation of `@c
|
|
|
9
11
|
- Android Studio Hedgehog (or newer) with the latest Android SDK tools.
|
|
10
12
|
- Test devices running Google Play services.
|
|
11
13
|
|
|
14
|
+
### Supported card networks
|
|
15
|
+
|
|
16
|
+
For `allowedCardNetworks` options, the possible values are:
|
|
17
|
+
|
|
18
|
+
- `AMEX`: American Express card network.
|
|
19
|
+
- `DISCOVER`: Discover card network.
|
|
20
|
+
- `ELECTRON`: Visa's Electron card network.
|
|
21
|
+
- Note that this option can only be set when `transactionInfo.countryCode` is set to `"BR"`, and `allowedCardNetworks` must also contain `VISA`
|
|
22
|
+
- For processing purposes, you should use this as an indication that the card must be processed through the Electron debit network.
|
|
23
|
+
- `ELO`: Elo card network.
|
|
24
|
+
- Note that this option can only be set when `transactionInfo.countryCode` is set to `"BR"`.
|
|
25
|
+
- `ELO_DEBIT`: Elo's debit network rail.
|
|
26
|
+
- Note that this option can only be set when `transactionInfo.countryCode` is set to `"BR"`, and `allowedCardNetworks` must also contain `ELO`
|
|
27
|
+
- For processing purposes, you should use this as an indication that the card must be processed through the ELO debit network.
|
|
28
|
+
- `INTERAC`: Interac card network.
|
|
29
|
+
- `JCB`: JCB card network.
|
|
30
|
+
- `MAESTRO`: Maestro card network.
|
|
31
|
+
- Note that this option can only be set when `transactionInfo.countryCode` is set to `"BR"`, and `allowedCardNetworks` must also contain `MASTERCARD`
|
|
32
|
+
- For processing purposes, you should use this as an indication that the card must be processed through the Maestro debit network.
|
|
33
|
+
- `MASTERCARD`: Mastercard card network.
|
|
34
|
+
- `VISA`: Visa card network.
|
|
35
|
+
[Read more about supported card networks in Google Pay.](https://developers.google.com/pay/api/web/reference/request-objects#CardParameters)
|
|
36
|
+
|
|
12
37
|
## 2. Create a Google Pay business profile
|
|
13
38
|
|
|
14
39
|
1. Open the [Google Pay & Wallet Console](https://pay.google.com/business/console/).
|
|
@@ -23,10 +48,9 @@ Follow this checklist to enable Google Pay for the Android implementation of `@c
|
|
|
23
48
|
Decide between a **gateway** (e.g., Stripe, Adyen, Braintree) or **direct** processor integration:
|
|
24
49
|
|
|
25
50
|
- For gateway tokenization, collect the `gateway` and `gatewayMerchantId` values.
|
|
51
|
+
- Refer [Google's documentation](https://developers.google.com/pay/api/android/reference/request-objects#gateway) for the required fields based on your chosen processor and tokenization type.
|
|
26
52
|
- For direct tokenization, create and store your public/private key pair and obtain your processor’s parameters.
|
|
27
53
|
|
|
28
|
-
Document these values because they must be inserted into the `paymentDataRequest.tokenizationSpecification`.
|
|
29
|
-
|
|
30
54
|
## 4. Register test cards and test users
|
|
31
55
|
|
|
32
56
|
1. In the Google Pay console, add testing cards or enable the demo cards.
|
|
@@ -37,8 +61,8 @@ Document these values because they must be inserted into the `paymentDataRequest
|
|
|
37
61
|
|
|
38
62
|
Handle the encrypted payment data server-side before charging the customer:
|
|
39
63
|
|
|
40
|
-
- Receive the JSON payload
|
|
41
|
-
- Forward the payment token to your payment processor
|
|
64
|
+
- Receive the JSON payload from the resolved `Pay.requestPayment(...)` result. The `paymentData` object includes the payment method, tokenization type, and gateway payload.
|
|
65
|
+
- Forward the payment token to your payment processor's SDK over HTTPS. Read the authorized token from `paymentMethodData.tokenizationData.token`.
|
|
42
66
|
- Validate essential fields (transaction amount, currency, merchant identifiers) against your order database before capturing payment.
|
|
43
67
|
- Log the Google Pay transaction IDs securely for reconciliation and dispute handling; avoid storing full PAN or raw token data.
|
|
44
68
|
|
|
@@ -112,7 +136,7 @@ const result = await Pay.requestPayment({
|
|
|
112
136
|
},
|
|
113
137
|
});
|
|
114
138
|
|
|
115
|
-
// Send `result.google
|
|
139
|
+
// Send `result.google.paymentData` to your backend to handle payment on server.
|
|
116
140
|
```
|
|
117
141
|
|
|
118
142
|
## 8. Use the correct environment
|
|
@@ -132,12 +156,14 @@ Google Pay itself does not require additional manifest permissions beyond Intern
|
|
|
132
156
|
1. Build and install the Android app on a device with the sandbox card.
|
|
133
157
|
2. Call `Pay.isPayAvailable` with the same `isReadyToPayRequest` JSON you will use in production.
|
|
134
158
|
3. Confirm the method returns `available: true` and `google.isReady: true`.
|
|
135
|
-
4. Trigger `Pay.requestPayment` and complete a transaction with a test card
|
|
159
|
+
4. Trigger `Pay.requestPayment` and complete a transaction with a test card.
|
|
160
|
+
5. Verify the payment token is returned in the resolved `requestPayment()` result and can be processed by your backend.
|
|
136
161
|
|
|
137
162
|
## 11. Launch to production
|
|
138
163
|
|
|
139
164
|
1. Submit your app for Google Play review with Google Pay screenshots or screen recordings if requested.
|
|
140
165
|
2. Promote the business profile to production in the Google Pay & Wallet Console.
|
|
141
|
-
3.
|
|
166
|
+
3. Make sure you handle `requestPayment()` success, cancellation, and errors gracefully in your app.
|
|
167
|
+
4. Switch the runtime configuration to the production environment and merchant details.
|
|
142
168
|
|
|
143
169
|
Completing these steps prepares your Android app to process payments through Google Pay using the Capacitor plugin.
|
|
@@ -5,7 +5,7 @@ import PassKit
|
|
|
5
5
|
|
|
6
6
|
@objc(PayPlugin)
|
|
7
7
|
public class PayPlugin: CAPPlugin, CAPBridgedPlugin, PKPaymentAuthorizationControllerDelegate {
|
|
8
|
-
private let pluginVersion: String = "8.1.
|
|
8
|
+
private let pluginVersion: String = "8.1.2"
|
|
9
9
|
public let identifier = "PayPlugin"
|
|
10
10
|
public let jsName = "Pay"
|
|
11
11
|
public let pluginMethods: [CAPPluginMethod] = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-pay",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"description": "Capacitor plugin to trigger native payment for iOS(Apple pay) and Android(Google Pay)",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"eslint-plugin-import": "^2.31.0",
|
|
65
65
|
"prettier": "^3.6.2",
|
|
66
66
|
"prettier-plugin-java": "^2.7.7",
|
|
67
|
+
"prettier-pretty-check": "^0.2.0",
|
|
67
68
|
"rimraf": "^6.1.0",
|
|
68
69
|
"rollup": "^4.53.2",
|
|
69
70
|
"swiftlint": "^2.0.0",
|
|
70
|
-
"typescript": "^5.9.3"
|
|
71
|
-
"prettier-pretty-check": "^0.2.0"
|
|
71
|
+
"typescript": "^5.9.3"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@capacitor/core": ">=8.0.0"
|