iamraphson / react-paystack

ReactJS library for implementing paystack payment gateway
https://www.npmjs.com/package/react-paystack
MIT License
445 stars 159 forks source link

feat: allow paystack options as argument in initialize function #94

Closed kadetXx closed 10 months ago

kadetXx commented 11 months ago

initializePayment function now takes in an optional paystackProps argument as a config param. Props passed in the function's config param will overwrite props passed in the usePaystackPayment Hook.

In hook config options, only the publicKey prop is mandatory since it doesn't change and will be a pain to pass in on every invocation of the initializePayment function. In initializePayment config options, publicKey is omitted.

Fixes issue #78

BREAKING CHANGES: initializePayment function now takes in an object with onClose, onSuccess and config as keys rather than as individual arguments. This ensures all three props can in any order or omitted since they are all optional.