Skip to content

Repository files navigation

FedaPay React

FedaPay CheckoutJs integration for React.js projects.

Install

From a command terminal type the following

npm install fedapay-reactjs --save

Add the CheckoutJs script

Add the checkout.js script in your index.html file.

<!doctype html><htmllang="en"><head><metacharset="utf-8"><title>Fedapay Checkout React.JS Plugin</title><metaname="viewport" content="width=device-width, initial-scale=1"></head><body><noscript>
You need to enable JavaScript to run this app.
</noscript><divid="root"></div><!-- Load the FedaPay checkout.js --><scriptsrc="https://cdn.fedapay.com/checkout.js?v=1.1.2"></script></body></html>

Usage

importReact,{Component}from'react';import{FedaCheckoutButton,FedaCheckoutContainer}from'fedapay-reactjs';exportdefaultclassAppextendsComponent{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){constFedaPay=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(<div><FedaCheckoutButtonoptions={this.checkoutButtonOptions}/><FedaCheckoutContaineroptions={this.checkoutEmbedOptions}style={{height: 500,width: 500,backgroundColor: '#eee'}}/></div>)}}

About

FedaPay integration for ReactJs applications

Topics

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages