ZenoPay is a simple and seamless payment designed for developers looking to integrate secure and reliable payment functionality into their applications. With minimal setup, you can initiate payments and track their statuses effortlessly.
ZenoPay supports the following mobile payment networks:
- M-PESA
- TIGOPESA (MIX BY YAS)
- HALOPESA
- AIRTEL MONEY
To install the package, run:
go get github.com/hekimapro/zeno
- Initiate a payment
- Check payment status
- Go 1.18 or later
- ZenoPay API credentials (
APIKey
,SecretKey
,AccountID
)
import "github.com/hekimapro/zeno"
package main
import (
"fmt"
"log"
"github.com/hekimapro/zeno"
)
func main() {
// Initialize ZenoPay with API credentials
zenoPay := zeno.NewZenoPay(APIKey, SecretKey, AccountID)
// Example usage of Pay function
orderID, err := zenoPay.Pay(zenopay.PaymentOptionsType{
CustomerName: "John Doe",
CustomerEmail: "[email protected]",
CustomerPhoneNumber: "1234567890",
AmountToCharge: 100.50,
CallbackURL: "https://your-callback-url.com",
})
if err != nil {
log.Fatalf("Error initiating payment: %s", err.Error())
}
fmt.Printf("Payment initiated successfully. Order ID: %s\n", orderID)
// Example usage of CheckPaymentStatus function
status, err := zenoPay.CheckPaymentStatus(orderID)
if err != nil {
log.Fatalf("Error checking payment status: %s", err.Error())
}
fmt.Printf("Payment status: %s\n", status)
}
Field | Type | Description |
---|---|---|
APIKey |
string | Your ZenoPay API key |
SecretKey |
string | Your ZenoPay secret key |
AccountID |
string | Your ZenoPay account ID |
Field | Type | Description |
---|---|---|
CustomerName |
string | Name of the customer |
CustomerEmail |
string | Email address of the customer |
CustomerPhoneNumber |
string | Phone number of the customer |
AmountToCharge |
float64 | Payment amount |
CallbackURL |
string | URL to receive payment status updates |
- Description: Initiates a payment.
- Parameters:
PaymentOptionsType
- Returns:
string
- Order IDerror
- Error message, if any
- Description: Checks the payment status for a given order ID.
- Parameters:
string
- Order ID
- Returns:
string
- Payment statuserror
- Error message, if any
This project is licensed under the MIT License. See the LICENSE file for details.
Replace "your_api_key"
, "your_secret_key"
, and "your_account_id"
with your actual ZenoPay API credentials to get started.