Minimal Paystack Inline payments for React apps, compatible with modern Next.js and TypeScript/JavaScript projects.
next@^16react@^18 || ^19react-dom@^18 || ^19
Paystack opens a checkout UI in the browser, so this package must be used from a Client Component in Next.js.
npm i @0x0pharaoh/next-paystack'use client';
import {PaystackButton} from '@0x0pharaoh/next-paystack';
export default function Page() {
return (
<PaystackButton
publicKey="pk_test_xxx"
email="user@example.com"
amount={20000}
text="Pay now"
onSuccess={(tx) => console.log(tx?.reference)}
onClose={() => console.log('closed')}
/>
);
}publicKey(maps to InlineJSkey)emailamount(lowest currency unit, e.g. kobo)
'use client';
import {usePaystackPayment} from '@0x0pharaoh/next-paystack';
export default function Donate() {
const initializePayment = usePaystackPayment({
publicKey: 'pk_test_xxx',
email: 'user@example.com',
amount: 20000,
});
return <button onClick={() => initializePayment({})}>Pay</button>;
}import type {PaystackProps, PaystackTransaction} from '@0x0pharaoh/next-paystack';- This package is derived from iamraphson/react-paystack.
MIT (see LICENSE).