FedaPay integration for ReactJs applications
npm install fedapay-reactjsFedaPay CheckoutJs integration for React.js projects.
npm install fedapay-reactjs --save
`Add the CheckoutJs script
Add the checkout.js script in your index.html file.
`html
Fedapay Checkout React.JS Plugin
`Usage
``tsxexport default class App extends Component {
PUBLIC_KEY = 'pk_sandbox_XXXXXX';
checkoutButtonOptions = {
public_key: this.PUBLIC_KEY,
transaction: {
amount: 100,
description: 'Airtime'
},
currency: {
iso: 'XOF'
},
button: {
class: 'btn btn-primary',
text: 'Payer 100 FCFA'
},
onComplete(resp) {
const FedaPay = window['FedaPay'];
if (resp.reason === FedaPay.DIALOG_DISMISSED) {
alert('Vous avez fermé la boite de dialogue');
} else {
alert('Transaction terminée: ' + resp.reason);
}
console.log(resp.transaction);
}
};
checkoutEmbedOptions = {
public_key: this.PUBLIC_KEY,
transaction: {
amount: 100,
description: 'Airtime'
},
currency: {
iso: 'XOF'
}
};
render() {
return (