Below is the updated README content tailored to your evzone-africa
package, specifically reflecting the usage of the WalletPaymentForm
component as shown in your provided Cart
component. This README is written in Markdown and can be copied directly into your Markdown editor. I've extracted the props and functionality from your code and adjusted the content to match your implementation.
# Evzone Africa
**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.
## Table of Contents
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Examples](#examples)
- [Configuration](#configuration)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
## Features
- Easy integration with e-commerce platforms.
- Support for React-based frontends.
- Secure payment processing with Evzone Africa digital wallet.
- Customizable payment form component.
- Comprehensive error handling and validation.
- Lightweight and optimized for performance.
## Prerequisites
Before you begin, ensure you have the following installed:
- [Node.js](https://nodejs.org/) (v16 or higher)
- [npm](https://www.npmjs.com/) (v8 or higher) or [yarn](https://yarnpkg.com/)
- A registered Evzone Africa merchant account (to obtain necessary credentials).
## Installation
To install the `evzone-africa` library, run the following command in your project directory:
```bash
npm install evzone-africa
Or, if you're using Yarn:
yarn add evzone-africa
Additionally, import the CSS file for styling the payment form:
import "evzone-africa/dist/WalletPaymentForm.css";
- Import the
WalletPaymentForm
component into your React application. - Use it within a conditional render to show the payment form when needed.
- Pass the required props, such as
customerId
,amount
,onClose
, andonSuccess
.
Here’s an example usage in a shopping cart component:
import React, { useState } from "react";
import WalletPaymentForm from "evzone-africa/dist/WalletPaymentForm";
import "evzone-africa/dist/WalletPaymentForm.css";
const Cart = () => {
const [showPopup, setShowPopup] = useState(false);
const cartTotalAmount = 99.99; // Example amount (replace with your cart logic)
const customerId = "customer123"; // Example customer ID (replace with your auth logic)
const handlePaymentSuccess = () => {
console.log("Payment successful");
// Add logic to clear cart or update order status
setShowPopup(false);
};
return (
<div className="cart-container">
<h2>Shopping Cart</h2>
<button onClick={() => setShowPopup(true)}>Make Payments</button>
{showPopup && (
<WalletPaymentForm
customerId={customerId}
amount={cartTotalAmount}
onClose={() => setShowPopup(false)}
onSuccess={handlePaymentSuccess}
/>
)}
</div>
);
};
export default Cart;
- The
WalletPaymentForm
component is rendered conditionally (e.g., in a popup or modal). - The
customerId
should be obtained from your authentication system or merchant account. - The
amount
should reflect the total amount to be paid (e.g., from your cart).
-
WalletPaymentForm
Component-
customerId
(string, required): The unique identifier for the customer making the payment. -
amount
(number, required): The payment amount in the default currency. -
onClose
(function, required): Callback triggered when the payment form is closed. -
onSuccess
(function, required): Callback triggered on successful payment.
-
- User adds items to the cart.
- User clicks "Make Payments" to trigger the payment form.
- The
WalletPaymentForm
component is displayed. - Upon successful payment, the
onSuccess
callback is triggered, and the form is closed viaonClose
.
See the examples folder for more detailed sample code.
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.
-
Payment Form Not Displaying: Ensure the CSS file is correctly imported (
evzone-africa/dist/WalletPaymentForm.css
) and that theshowPopup
state (or equivalent) is toggled correctly. -
"Invalid Customer ID" Error: Verify that the
customerId
is valid and matches your Evzone Africa merchant account records. - Payment Not Processing: Ensure your network connection is stable and that the Evzone Africa servers are reachable.
We welcome contributions to improve evzone-africa
! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes and commit them (
git commit -m "Add your feature"
). - Push to your branch (
git push origin feature/your-feature
). - Open a Pull Request.
Please read our Contributing Guidelines for more details.
This project is licensed under the MIT License. See the LICENSE file for more information.
For questions, issues, or feature requests, please:
- Open an issue on our GitHub Issues page.
- Contact our support team at support@evzoneafrica.com.
---
### Instructions:
1. **Copy and Paste**: Copy the entire content above (including the ```markdown tags) and paste it directly into your Markdown editor (e.g., in a `README.md` file).
2. **Replace Placeholders**:
- Replace `yourusername` in the GitHub link with your actual GitHub username or organization.
- Replace `support@evzoneafrica.com` with your actual support email.
3. **Adjust Paths**:
- If your package name is different (e.g., `evzone-africa8` instead of `evzone-africa`), update the import statements and installation commands accordingly.
- If you don’t have `examples/`, `CONTRIBUTING.md`, or `LICENSE` files in your repository, either create them or remove the corresponding links.
4. **Verify CSS Path**: Your code uses `evzone-africa8/dist/dist/WalletPaymentForm.css`, which I corrected to `evzone-africa/dist/WalletPaymentForm.css` in the README. Ensure the path matches your actual package structure.
5. **Test**: Preview the README in your Markdown editor or GitHub to ensure formatting looks correct.
### Notes:
- **Backend Section Removed**: Your provided code only shows frontend usage with `WalletPaymentForm`. If you have a backend component (e.g., for verification or webhooks), please share it, and I’ll add a backend section.
- **SVG Namespace**: The SVG namespace document you shared seems unrelated to the `evzone-africa` library. I’ve excluded it from the README, but let me know if you want it included for some reason.
- **Props Extracted**: The `WalletPaymentForm` props (`customerId`, `amount`, `onClose`, `onSuccess`) are based on your `Cart` component usage.
Let me know if you need further adjustments or additional sections!