React.js SDK
The React.js library from FedaPay enables quick and seamless payment integration into interactive user interfaces, making it ideal for modern projects.
Installation
Add the library to your project using npm:
Use Case
This use case demonstrates how to integrate the FedaPay payment button and widget into a React application using the fedapay-reactjs library.
Find more details and examples in the FedaPay React.js SDK GitHub repository.
Note:
Ensure you use the appropriate public key based on your environment:
-
For the sandbox environment (test), use the public key of your sandbox account.
-
For the live environment (production), use the public key of your live account.
In a React application, directly manipulating the global FedaPay object can lead to errors if the component mounts or unmounts before the transaction is completed. To avoid this:
-
Add checks to properly handle the component lifecycle.
-
Ensure the FedaPay script is included via a CDN in the main HTML file (commonly public/index.html) if required.
Example of inclusion in public/index.html :