Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ Note that all 3 implementations produce the same results.
return (
<div>
<button onClick={() => {
initializePayment(onSuccess, onClose)
// Updated usage: pass an object with onSuccess and onClose
initializePayment({ onSuccess, onClose });
}}>Paystack Hooks Implementation</button>
</div>
);
Expand Down Expand Up @@ -205,7 +206,8 @@ import './App.css';
</a>
</header>
<PaystackConsumer {...componentProps} >
{({initializePayment}) => <button onClick={() => initializePayment(handleSuccess, handleClose)}>Paystack Consumer Implementation</button>}
{/* Updated usage: pass an object to initializePayment */}
{({initializePayment}) => <button onClick={() => initializePayment({ onSuccess: handleSuccess, onClose: handleClose })}>Paystack Consumer Implementation</button>}
</PaystackConsumer>
</div>
);
Expand Down
7 changes: 2 additions & 5 deletions libs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ interface PaystackCustomFields {
}

interface PaystackMetadata {
custom_fields: PaystackCustomFields[];
}

interface PaystackMetadata {
custom_fields?: PaystackCustomFields[];
[key: string]: any;
}

Expand Down Expand Up @@ -66,4 +63,4 @@ export type InitializePayment = (options: {
}) => void;

export type HookConfig = Omit<Partial<PaystackProps>, 'publicKey'> &
Pick<PaystackProps, 'publicKey'>;
Pick<PaystackProps, 'publicKey'>;