pay-sdk-web9 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # Evzone Pay
2
+
3
+ <img src="https://github.com/Bravothe/payment-library/blob/main/src/assets/logo.jpg?raw=true" alt="Evzone Pay Logo" width="200" />
4
+
5
+ **Evzone Africa** is a library designed to simplify the integration of a digital wallet payment system into e-commerce platforms. Built with **React** and **Node.js**, it provides a seamless way for developers to enable their customers to make payments using the Evzone Africa digital wallet. This package is lightweight, customizable, and developer-friendly.
6
+
7
+ ## Table of Contents
8
+ - [Features](#features)
9
+ - [Prerequisites](#prerequisites)
10
+ - [Installation](#installation)
11
+ - [Usage](#usage)
12
+ - [API Reference](#api-reference)
13
+ - [Examples](#examples)
14
+ - [Configuration](#configuration)
15
+ - [Troubleshooting](#troubleshooting)
16
+ - [Contributing](#contributing)
17
+ - [License](#license)
18
+ - [Support](#support)
19
+
20
+ ## Features
21
+
22
+ - Easy integration with e-commerce platforms.
23
+ - Support for React-based frontends.
24
+ - Secure payment processing with Evzone Africa digital wallet.
25
+ - Customizable payment form component.
26
+ - Comprehensive error handling and validation.
27
+ - Lightweight and optimized for performance.
28
+
29
+ ## Prerequisites
30
+
31
+ Before you begin, ensure you have the following installed:
32
+ - [Node.js](https://nodejs.org/) (v16 or higher)
33
+ - [npm](https://www.npmjs.com/) (v8 or higher) or [yarn](https://yarnpkg.com/)
34
+ - A registered Evzone Africa merchant account (to obtain necessary credentials).
35
+
36
+ ## Installation
37
+ To install the `evzone-alb` library, run the following command in your project directory:
38
+
39
+ ```bash
40
+
41
+ npm install evzone-alb
42
+
43
+ ```
44
+
45
+ Additionally, import the CSS file for styling the payment form:
46
+
47
+ ```js
48
+ import "evzone-alb/dist/dist/WalletPaymentForm.css";
49
+ ```
50
+
51
+ ## Usage
52
+ ### Frontend (React)
53
+ 1. Import the `WalletPaymentForm` component into your React application.
54
+ 2. Use it within a conditional render to show the payment form when needed.
55
+ 3. Pass the required props, such as `customerId`, `amount`, `onClose`, and `onSuccess`.
56
+
57
+ Here’s an example usage in a shopping cart component:
58
+
59
+ ```js
60
+
61
+
62
+ import React, { useState } from "react";
63
+ import WalletPaymentForm from "evzone-alb/dist/WalletPaymentForm.esm";
64
+ import "evzone-alb/dist/dist/WalletPaymentForm.css";
65
+
66
+ const Cart = () => {
67
+ const [showPopup, setShowPopup] = useState(false);
68
+ const cartTotalAmount = 99.99; // Example amount (replace with your cart logic)
69
+ const customerId = "customer123"; // Example customer ID (replace with your auth logic)
70
+
71
+ const handlePaymentSuccess = () => {
72
+ console.log("Payment successful");
73
+ // Add logic to clear cart or update order status
74
+ setShowPopup(false);
75
+ };
76
+
77
+ return (
78
+ <div className="cart-container">
79
+ <h2>Shopping Cart</h2>
80
+ <button onClick={() => setShowPopup(true)}>Make Payments</button>
81
+ {showPopup && (
82
+ <WalletPaymentForm
83
+ customerId={customerId}
84
+ amount={cartTotalAmount}
85
+ onClose={() => setShowPopup(false)}
86
+ onSuccess={handlePaymentSuccess}
87
+ />
88
+ )}
89
+ </div>
90
+ );
91
+ };
92
+
93
+ export default Cart;
94
+
95
+
96
+ ```
97
+
98
+ ### Notes
99
+
100
+ - The `WalletPaymentForm` component is rendered conditionally (e.g., in a popup or modal).
101
+ - The `customerId` should be obtained from your authentication system or merchant account.
102
+ - The `amount` should reflect the total amount to be paid (e.g., from your cart).
103
+
104
+ ## API Reference
105
+
106
+ ### Frontend (React)
107
+
108
+ - **`WalletPaymentForm` Component**
109
+ - `customerId` (string, required): The unique identifier for the customer making the payment.
110
+ - `amount` (number, required): The payment amount in the default currency.
111
+ - `onClose` (function, required): Callback triggered when the payment form is closed.
112
+ - `onSuccess` (function, required): Callback triggered on successful payment.
113
+
114
+ ## Examples
115
+
116
+ ### Complete Checkout Flow
117
+
118
+ 1. User adds items to the cart.
119
+ 2. User clicks "Make Payments" to trigger the payment form.
120
+ 3. The `WalletPaymentForm` component is displayed.
121
+ 4. Upon successful payment, the `onSuccess` callback is triggered, and the form is closed via `onClose`.
122
+
123
+ See the [examples folder](examples/) for more detailed sample code.
124
+
125
+ ## Configuration
126
+
127
+ The `WalletPaymentForm` component currently supports the props listed in the API Reference. Additional customization (e.g., theming, currency) may be added in future updates. Check the latest documentation or release notes for updates.
128
+
129
+ ## Troubleshooting
130
+
131
+ - **Payment Form Not Displaying**: Ensure the CSS file is correctly imported (`evzone-africa/dist/dist/WalletPaymentForm.css`) and that the `showPopup` state (or equivalent) is toggled correctly.
132
+ - **"Invalid Customer ID" Error**: Verify that the `customerId` is valid and matches your Evzone Africa merchant account records.
133
+ - **Payment Not Processing**: Ensure your network connection is stable and that the Evzone Africa servers are reachable.
134
+
135
+ ## Contributing
136
+
137
+ We welcome contributions to improve `evzone-africa`! To contribute:
138
+ 1. Fork the repository.
139
+ 2. Create a new branch (`git checkout -b feature/your-feature`).
140
+ 3. Make your changes and commit them (`git commit -m "Add your feature"`).
141
+ 4. Push to your branch (`git push origin feature/your-feature`).
142
+ 5. Open a Pull Request.
143
+
144
+ Please read our [Contributing Guidelines](CONTRIBUTING.md) for more details.
145
+
146
+ ## License
147
+
148
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
149
+
150
+ ## Support
151
+
152
+ For questions, issues, or feature requests, please:
153
+ - Open an issue on our [GitHub Issues page](https://github.com/yourusername/evzone-africa/issues).
154
+ - Contact our support team at support@evzoneafrica.com.
155
+
156
+
157
+