UNPKG

@astropay/payments-lib

Version:

Official AstroPay payments library for web and mobile.

57 lines (56 loc) 1.73 kB
import { Component } from '../../components/templates/Component'; import { APPayment } from '../../types'; /** * AstroPayPayment provides a streamlined payment component focused on AstroPay's * native payment method. * * @example * ```ts * const payment = new AstroPayPayment({ * amount: 100, * currency: 'USD', * country: 'BR' * // Optional props * onSuccess: () => console.log('Payment successful'), * onError: () => console.error('Payment failed') * }); * ``` * * @see {@link APPayment} for all available configuration options */ export declare class AstroPayPayment extends Component<HTMLDivElement> { private loadingWrapper; private readonly componentProps; private readonly methodCode; constructor(params: APPayment); private createPayment; private renderAstroPayMethod; private showSuccessContent; /** * Renders the payment component into the specified DOM container. * * @example * ```ts * const paymentComponent = new AstroPayPayment(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 AstroPayPayment(paymentSettings); * paymentComponent.render(container); * * // Later cleanup * paymentComponent.destroy(); * ``` */ destroy(): void; }