# [mpesa-go-sdk]: M-Pesa SDK for Golang
## Overview
`mpesa-go-sdk` is a Go SDK for interacting with Safaricom's M-Pesa API. This SDK simplifies integration with M-Pesa's services, enabling operations such as B2C payments, C2B URL registration, USSD Push payments, transaction status queries, account balance checks, and transaction reversals.
## Documentation
For further detailed documentation and api keys you can access it here.
## Features
- **Authentication**: Retrieve OAuth2 access tokens.
- **B2C Payments**: Transfer funds from a business account to a customer account.
- **C2B URL Registration**: Register URLs for payment notifications.
- **USSD Push**: Initiate USSD-based payment requests.
- **Transaction Status**: Query the status of transactions.
- **Account Balance**: Retrieve M-Pesa account balances.
- **Transaction Reversal**: Reverse a completed M-Pesa transaction.
## Requirements
- Go (Golang) Installed: The SDK is a Go module and requires a Go development environment. Make sure that Go is installed on your system. You can download it from the official Go website:
golang.org.
- M-Pesa Developer Account: You need access to the Safaricom Ethiopia Developer (
developer.safaricom.et) Portal to obtain the following credentials:
- `CONSUMER_KEY`
- `CONSUMER_SECRET`
## Installation
To install the SDK, use the following command:
```bash
go get
github.com
```
## Configuration
### Quick Start - Initialize the MpesaClient
```go
package main
import (
"fmt"
"log"
"
github.com"
"
github.com"
)
func main() {
// Load configuration from environment variables
cfg, err := config.NewFromEnv()
if err != nil {
log.Fatal(err.Error())
}
// Create a new Mpesa client
app := mpesa-go-sdk.New(cfg)
fmt.Println("Application is created with: ", *app)
}
```
### Environment variables
To configure this application you ca …