expo-mercadopago-integration
Version:
Expo library for integrating Mercado Pago native SDK without ejecting
53 lines (52 loc) • 1.86 kB
TypeScript
import { Subscription } from "expo-modules-core";
export interface MercadoPagoConfig {
publicKey: string;
preferenceId?: string;
siteId?: string;
language?: string;
}
export interface PaymentResult {
status: "approved" | "rejected" | "pending" | "in_process";
paymentId: string;
statusDetail: string;
paymentData?: PaymentData;
error?: {
message: string;
code: string;
};
}
export interface PaymentData {
transactionAmount: number;
currency: string;
description?: string;
payer?: {
email: string;
name?: string;
};
}
export interface MercadoPagoSDK {
initialize(): Promise<void>;
startPayment(preferenceId?: string): Promise<PaymentResult>;
addPaymentResultListener(callback: (result: PaymentResult) => void): Subscription;
removePaymentResultListener(subscription: Subscription): void;
isMercadoPagoInstalled(): Promise<boolean>;
getSDKVersion(): Promise<string>;
}
declare class ExpoMercadoPagoModule {
private eventEmitter;
private config;
private isInitialized;
constructor(config: MercadoPagoConfig);
initialize(): Promise<void>;
startPayment(preferenceId?: string): Promise<PaymentResult>;
addPaymentResultListener(callback: (result: PaymentResult) => void): Subscription;
removePaymentResultListener(subscription: Subscription): void;
isMercadoPagoInstalled(): Promise<boolean>;
getSDKVersion(): Promise<string>;
static initializeAsync(config: MercadoPagoConfig): Promise<void>;
static startPaymentAsync(preferenceId: string): Promise<PaymentResult>;
static isMercadoPagoInstalledAsync(): Promise<boolean>;
static getSDKVersionAsync(): Promise<string>;
}
export declare function createMercadoPagoSDK(config: MercadoPagoConfig): MercadoPagoSDK;
export default ExpoMercadoPagoModule;