UNPKG

@paydock/client-sdk

Version:

Paydock client sdk

65 lines 2.76 kB
import { type GetConfigResponse } from '../api/api-service-internal'; import type { OpenWalletService } from './base/open-wallet.service'; import { OpenWalletButtons } from './base/open-wallet-buttons'; import type { GooglePayOpenWalletMeta } from './interfaces/google-pay'; import type { WalletType } from './types'; /** * @classdesc Google Pay wallet button that creates One-Time Tokens (OTT) via Google Pay. * * Provides a fully typed Google Pay integration with Google Pay-specific metadata * and validates that the service configuration corresponds to a Google Pay service. * On `load()`, the button fetches the service configuration and raises an error via `onError` * if the service type does not match Google Pay. * * @class GooglePayOpenWalletButton * @extends OpenWalletButtons * * @param {string} selector - CSS selector of the HTML element that will contain the Google Pay button. * @param {string} publicKeyOrAccessToken - Public key or access token for API authentication. * @param {string} serviceId - The Google Pay service ID configured in PayDock dashboard. * @param {GooglePayOpenWalletMeta} meta - Google Pay-specific metadata (amount, currency, country, card_config, merchant_name, style, etc.). * * @example * const button = new GooglePayOpenWalletButton( * '#wallet-container', * publicKeyOrAccessToken, * serviceId, * { * amount: 100, * currency: 'AUD', * country: 'AU', * merchant_name: 'Your Store', * }, * ); * button.setEnv('sandbox'); * button.onSuccess((data) => console.log('OTT:', data.token)); * button.onError((error) => console.error('Error:', error)); * button.load(); */ export declare class GooglePayOpenWalletButton extends OpenWalletButtons<GooglePayOpenWalletMeta> { /** @private */ readonly walletType: WalletType; /** * Validates Google Pay-specific required metadata fields. * Google Pay has no additional required fields beyond the base (amount, currency, country). * @private */ protected validateWalletMeta(): void; /** * Validates that the service configuration type is Google Pay. * * @private * @param serviceConfig - The service configuration response from the API. * @throws {Error} If the service type is not Google Pay. */ protected validateServiceType(serviceConfig: GetConfigResponse): void; /** * Creates a Google Pay wallet service instance. * * @private * @param serviceConfig - The service configuration response from the API. * @returns The Google Pay wallet service instance. */ protected createWalletService(serviceConfig: GetConfigResponse): OpenWalletService; } //# sourceMappingURL=google-pay-open-wallet-button.d.ts.map