react-paystack
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -52,3 +52,2 @@ import React, { useState, useEffect, createContext, forwardRef, useContext } from 'react'; | ||
var callPaystackPop = function (paystackArgs) { | ||
console.log('callPaystackPop', paystackArgs); | ||
//@ts-ignore | ||
@@ -61,3 +60,3 @@ var handler = window.PaystackPop && window.PaystackPop.setup(paystackArgs); | ||
var _a = usePaystackScript(), scriptLoaded = _a[0], scriptError = _a[1]; | ||
var publicKey = options.publicKey, email = options.email, amount = options.amount, reference = options.reference, _b = options.metadata, metadata = _b === void 0 ? {} : _b, _c = options.currency, currency = _c === void 0 ? 'NGN' : _c, channels = options.channels, _d = options.label, label = _d === void 0 ? '' : _d, _e = options.plan, plan = _e === void 0 ? '' : _e, _f = options.quantity, quantity = _f === void 0 ? '' : _f, _g = options.subaccount, subaccount = _g === void 0 ? '' : _g, _h = options.transaction_charge, transaction_charge = _h === void 0 ? 0 : _h, _j = options.bearer, bearer = _j === void 0 ? 'account' : _j; | ||
var publicKey = options.publicKey, firstname = options.firstname, lastname = options.lastname, phone = options.phone, email = options.email, amount = options.amount, reference = options.reference, _b = options.metadata, metadata = _b === void 0 ? {} : _b, _c = options.currency, currency = _c === void 0 ? 'NGN' : _c, channels = options.channels, _d = options.label, label = _d === void 0 ? '' : _d, _e = options.plan, plan = _e === void 0 ? '' : _e, _f = options.quantity, quantity = _f === void 0 ? '' : _f, _g = options.subaccount, subaccount = _g === void 0 ? '' : _g, _h = options.transaction_charge, transaction_charge = _h === void 0 ? 0 : _h, _j = options.bearer, bearer = _j === void 0 ? 'account' : _j; | ||
function initializePayment(callback, onClose) { | ||
@@ -74,2 +73,5 @@ if (scriptError) { | ||
email: email, | ||
firstname: firstname, | ||
lastname: lastname, | ||
phone: phone, | ||
amount: amount, | ||
@@ -76,0 +78,0 @@ currency: currency, |
@@ -59,3 +59,2 @@ 'use strict'; | ||
var callPaystackPop = function (paystackArgs) { | ||
console.log('callPaystackPop', paystackArgs); | ||
//@ts-ignore | ||
@@ -68,3 +67,3 @@ var handler = window.PaystackPop && window.PaystackPop.setup(paystackArgs); | ||
var _a = usePaystackScript(), scriptLoaded = _a[0], scriptError = _a[1]; | ||
var publicKey = options.publicKey, email = options.email, amount = options.amount, reference = options.reference, _b = options.metadata, metadata = _b === void 0 ? {} : _b, _c = options.currency, currency = _c === void 0 ? 'NGN' : _c, channels = options.channels, _d = options.label, label = _d === void 0 ? '' : _d, _e = options.plan, plan = _e === void 0 ? '' : _e, _f = options.quantity, quantity = _f === void 0 ? '' : _f, _g = options.subaccount, subaccount = _g === void 0 ? '' : _g, _h = options.transaction_charge, transaction_charge = _h === void 0 ? 0 : _h, _j = options.bearer, bearer = _j === void 0 ? 'account' : _j; | ||
var publicKey = options.publicKey, firstname = options.firstname, lastname = options.lastname, phone = options.phone, email = options.email, amount = options.amount, reference = options.reference, _b = options.metadata, metadata = _b === void 0 ? {} : _b, _c = options.currency, currency = _c === void 0 ? 'NGN' : _c, channels = options.channels, _d = options.label, label = _d === void 0 ? '' : _d, _e = options.plan, plan = _e === void 0 ? '' : _e, _f = options.quantity, quantity = _f === void 0 ? '' : _f, _g = options.subaccount, subaccount = _g === void 0 ? '' : _g, _h = options.transaction_charge, transaction_charge = _h === void 0 ? 0 : _h, _j = options.bearer, bearer = _j === void 0 ? 'account' : _j; | ||
function initializePayment(callback, onClose) { | ||
@@ -81,2 +80,5 @@ if (scriptError) { | ||
email: email, | ||
firstname: firstname, | ||
lastname: lastname, | ||
phone: phone, | ||
amount: amount, | ||
@@ -83,0 +85,0 @@ currency: currency, |
declare type Currency = 'NGN' | 'GHS' | 'USD'; | ||
declare type PaymentChannels = 'bank' | 'card' | 'qr' | 'ussd' | 'mobile_money'; | ||
declare type Bearer = 'account' | 'subaccount'; | ||
declare type phone = number | string; | ||
export interface PaystackProps { | ||
publicKey: string; | ||
email: string; | ||
firstname?: string; | ||
lastname?: string; | ||
phone?: phone; | ||
amount: number; | ||
@@ -8,0 +12,0 @@ reference?: string; |
@@ -10,5 +10,17 @@ import React from 'react'; | ||
amount: 20000, | ||
publicKey: 'pk_test_dsdfghuytfd2345678gvxxxxxxxxxx', | ||
publicKey: 'pk_test_deea911dsamnfdknerkhfkrwni239823erwlmqqaADF', | ||
firstname: 'cool', | ||
lastname: 'story' | ||
}; | ||
const onSuccess = (reference) => { | ||
// Implementation for whatever you want to do with reference and after success call. | ||
console.log(reference); | ||
}; | ||
const onClose = () => { | ||
// implementation for whatever you want to do when the Paystack dialog closed. | ||
console.log('closed') | ||
} | ||
const PaystackHookExample = () => { | ||
@@ -19,3 +31,3 @@ const initializePayment = usePaystackPayment(config); | ||
<button onClick={() => { | ||
initializePayment() | ||
initializePayment(onSuccess, onClose) | ||
}}>Paystack Hooks Implementation</button> | ||
@@ -30,4 +42,4 @@ </div> | ||
text: 'Paystack Button Implementation', | ||
onSuccess: () => null, | ||
onClose: () => null | ||
onSuccess, | ||
onClose | ||
}; | ||
@@ -34,0 +46,0 @@ |
export const callPaystackPop = (paystackArgs: Record<string, any>): void => { | ||
console.log('callPaystackPop', paystackArgs); | ||
//@ts-ignore | ||
const handler = window.PaystackPop && window.PaystackPop.setup(paystackArgs); | ||
handler && handler.openIframe(); | ||
}; | ||
//@ts-ignore | ||
const handler = window.PaystackPop && window.PaystackPop.setup(paystackArgs); | ||
handler && handler.openIframe(); | ||
}; |
@@ -7,5 +7,10 @@ type Currency = 'NGN' | 'GHS' | 'USD'; | ||
type phone = number | string; | ||
export interface PaystackProps { | ||
publicKey: string; | ||
email: string; | ||
firstname?: string; | ||
lastname?: string; | ||
phone?: phone; | ||
amount: number; | ||
@@ -12,0 +17,0 @@ reference?: string; |
@@ -12,2 +12,5 @@ import {useEffect} from 'react'; | ||
publicKey, | ||
firstname, | ||
lastname, | ||
phone, | ||
email, | ||
@@ -39,2 +42,5 @@ amount, | ||
email, | ||
firstname, | ||
lastname, | ||
phone, | ||
amount, | ||
@@ -41,0 +47,0 @@ currency, |
{ | ||
"name": "react-paystack", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "This is an reactJS library for implementing paystack payment gateway", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1654655
16394
0