import React from 'react'; /** * Configuration for SimpliPay Checkout */ interface SimpliPayConfig { /** Your SimpliPay public key */ publicKey: string; /** Environment: 'development' | 'production' */ environment?: 'development' | 'production'; /** Custom API base URL (optional) */ baseUrl?: string; } /** * Payment data for checkout */ interface PaymentData { /** Organization ID from SimpliPay */ organizationId: string; /** Customer email address */ email: string; /** Customer phone number (with country code, e.g., +2348012345678) */ phone: string; /** Payment amount */ amount: number; /** Currency code (e.g., 'NGN') */ currency: string; /** Unique transaction reference */ transactionRef: string; /** Your customer's unique identifier */ customerId: string; /** Service ID for the payment */ serviceId?: string; /** Payment narration/description */ narration?: string; /** Merchant/business name to display */ merchantName?: string; /** Additional metadata */ metadata?: Record; } /** * Callback functions for checkout events */ interface CheckoutCallbacks { /** Called when payment is successful */ onSuccess: (result: TransactionResult) => void; /** Called when payment fails */ onError: (error: TransactionError) => void; /** Called when user closes the checkout */ onClose: () => void; /** Called before payment initiation (optional) */ onBeforePayment?: () => void | Promise; } /** * Transaction result on successful payment */ interface TransactionResult { success: true; transactionRef: string; message: string; amount: number; currency: string; paymentMethod: string; responseCode?: string; } /** * Transaction error */ interface TransactionError { success: false; message: string; code?: string; transactionRef?: string; } /** * Props for SimpliPayCheckout component */ interface SimpliPayCheckoutProps { /** Whether to show the checkout modal */ isOpen: boolean; /** Payment data */ paymentData: PaymentData; /** SimpliPay configuration */ config: SimpliPayConfig; /** Callback functions */ callbacks: CheckoutCallbacks; } /** * SimpliPay Checkout Component * * A complete checkout modal for accepting card payments via SimpliPay. * * @example * ```tsx * import { SimpliPayCheckout } from '@simplipayng/checkout'; * * function App() { * const [isOpen, setIsOpen] = useState(false); * * return ( * console.log('Success:', result), * onError: (error) => console.error('Error:', error), * onClose: () => setIsOpen(false) * }} * /> * ); * } * ``` */ declare const SimpliPayCheckout: React.FC; interface UseSimplipayReturn { isOpen: boolean; openCheckout: (paymentData: PaymentData) => void; closeCheckout: () => void; paymentData: PaymentData | null; result: TransactionResult | null; error: TransactionError | null; } /** * Hook for programmatic control of SimpliPay Checkout * * @example * ```tsx * const { isOpen, openCheckout, closeCheckout, result, error } = useSimplipay({ * publicKey: 'pk_test_xxxxx', * environment: 'development' * }); * * // Open checkout * openCheckout({ * email: 'customer@example.com', * phone: '+2348012345678', * amount: 5000, * currency: 'NGN', * transactionRef: 'TXN-123', * customerId: 'CUST-456' * }); * ``` */ declare const useSimplipay: (config: SimpliPayConfig) => UseSimplipayReturn; export { SimpliPayCheckout as Checkout, SimpliPayCheckout, useSimplipay }; export type { CheckoutCallbacks, PaymentData, SimpliPayConfig, TransactionResult };