UNPKG

@astropay/payments-lib

Version:

Official AstroPay payments library for web and mobile.

61 lines (60 loc) 1.86 kB
import { Component } from '../../components/templates/Component'; import { APCardPayment } from '../../types'; /** * AstroPayCardPayment provides a secure card payment form for credit/debit transactions. * * @example * ```ts * const payment = new AstroPayCardPayment({ * amount: 100, * currency: 'USD', * country: 'BR' * config: { * userId: 'user-id-789'; * }, * // Optional props * showPaymentSummary: true, * expirationDateFormat: 'MM/YY' * onSuccess: () => console.log('Payment successful'), * onError: () => console.error('Payment failed') * }); * ``` * * @see {@link APCardPayment} for all available configuration options */ export declare class AstroPayCardPayment extends Component<HTMLDivElement> { private loadingWrapper; private readonly componentProps; private readonly methodCode; constructor(params: APCardPayment); private createPayment; private renderAstroPayCardMethod; private showErrorMessage; /** * Renders the payment component into the specified DOM container. * * @example * ```ts * const paymentComponent = new AstroPayCardPayment(paymentSettings); * paymentComponent.render(document.getElementById('payment-container')); * ``` * * @param {HTMLElement} container - The DOM element to render the payment component into. */ render(container: HTMLElement): void; /** * Destroys the payment component instance, cleaning up all DOM elements * and unregistering from the AstroPay Payments Library. * * @example * ```ts * // Initialize and render component * const paymentComponent = new AstroPayCardPayment(paymentSettings); * paymentComponent.render(container); * * // Later cleanup * paymentComponent.destroy(); * ``` */ destroy(): void; }