export interface IAPProduct { productId: string; title: string; description: string; price: string; localizedPrice: string; currencyCode: string; } export interface IAPResult { status: 'purchased' | 'restored' | 'cancelled' | 'deferred'; productId: string; transactionId?: string; originalTransactionId?: string; /** Base64 App Store receipt; send to your backend for validation. */ receipt?: string; } export interface IAPProductsResult { products: IAPProduct[]; invalidProductIds: string[]; } export abstract class IAPImpl { abstract init(products: string[]): Promise; abstract purchase(product: string): Promise; abstract restore(): Promise; abstract getPendingTransactions(): Promise; /** Only call after verification and idempotent delivery of the purchase. */ abstract finishTransaction(transactionId: string): Promise; abstract onTransaction(listener: (transaction: IAPResult) => void): () => void; }