react-native-plugpag-nitro
Version:
High-performance React Native library for PagSeguro PlugPag payment terminals with TypeScript-first hooks API, real-time events, and 10x faster performance using Nitro Modules
103 lines • 3.64 kB
TypeScript
import type { PlugpagInitializationResult, PlugpagTransactionResult, PlugpagConstants, PlugpagStyleData, PaymentEvent } from './PlugpagNitro.nitro';
import { PaymentType, InstallmentType, ErrorCode, PaymentEventCode } from './PlugpagNitro.nitro';
export { PaymentType, InstallmentType, ErrorCode, ActionType, PaymentEventCode, } from './PlugpagNitro.nitro';
export type { PlugpagInitializationResult, PlugpagTransactionResult, PlugpagConstants, PlugpagPaymentData, PlugpagVoidData, PlugpagStyleData, PaymentEvent, } from './PlugpagNitro.nitro';
export { ThemeUtils } from './themes';
export interface PaymentOptions {
amount: number;
type: PaymentType;
installmentType?: InstallmentType;
installments?: number;
printReceipt?: boolean;
userReference?: string;
}
/**
* Get payment constants from the native module
*/
export declare function getConstants(): PlugpagConstants;
/**
* Get the terminal's serial number
*/
export declare function getTerminalSerialNumber(): string;
/**
* Initialize and activate the pin pad terminal
*/
export declare function initializeAndActivatePinPad(activationCode: string): Promise<PlugpagInitializationResult>;
/**
* Process a payment transaction
*/
export declare function doPayment(options: {
amount: number;
type: PaymentType;
installmentType?: InstallmentType;
installments?: number;
printReceipt?: boolean;
userReference?: string;
}): Promise<PlugpagTransactionResult>;
/**
* Hook for listening to transaction payment events
* Provides real-time updates during payment flow including:
* - Card insertion/removal events
* - Password entry progress
* - Processing status updates
* - Error notifications
* - Transaction completion status
*/
export declare function useTransactionEvent(): PaymentEvent & {
resetEvent: () => void;
};
/**
* Enhanced payment flow manager
* Combines payment execution with event monitoring
*/
/**
* Refund a previous payment transaction
*/
export declare function refundPayment(options: {
transactionCode: string;
transactionId: string;
printReceipt?: boolean;
}): Promise<PlugpagTransactionResult>;
/**
* Abort the current ongoing transaction
*/
export declare function doAbort(): Promise<ErrorCode>;
/**
* Set custom style theme for PagBank SDK UI components
* Allows customization of colors for modal dialogs, buttons, and text
*/
export declare function setStyleTheme(styleData: PlugpagStyleData): Promise<boolean>;
/**
* Print a custom receipt from file path
*/
export declare function print(filePath: string, textSize?: number): Promise<ErrorCode>;
/**
* Reprint the last customer receipt
*/
export declare function reprintCustomerReceipt(): Promise<void>;
/**
* Simple transaction status checker
* Helper function to check if a transaction result indicates success
*/
/**
* Simple transaction error checker
* Helper function to get a human-readable error message
*/
declare const _default: {
getConstants: typeof getConstants;
getTerminalSerialNumber: typeof getTerminalSerialNumber;
initializeAndActivatePinPad: typeof initializeAndActivatePinPad;
doPayment: typeof doPayment;
refundPayment: typeof refundPayment;
doAbort: typeof doAbort;
setStyleTheme: typeof setStyleTheme;
print: typeof print;
reprintCustomerReceipt: typeof reprintCustomerReceipt;
useTransactionEvent: typeof useTransactionEvent;
PaymentType: typeof PaymentType;
InstallmentType: typeof InstallmentType;
ErrorCode: typeof ErrorCode;
PaymentEventCode: typeof PaymentEventCode;
};
export default _default;
//# sourceMappingURL=index.d.ts.map