Skip to content

eliakimatamba/Mpesa_Shop_Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

The multi-vendor m-pesa shop should have the following features:

  1. A user friendly interface that is easy to navigate
  2. The ability to add/remove vendors
  3. The ability to add/remove products
  4. The ability to view vendor and product information
  5. The ability to search for vendors and products
  6. The ability to make payments using m-pesa
  7. The ability to view payment history
  8. The ability to track m-pesa transactions
  9. The ability to refund payments
  10. The ability to generate reports

M-Pesa Java SDK

The M-Pesa Java SDK makes it easy to develop Java applications that integrate with the M-Pesa API. The SDK handles the details of making requests and parsing responses from the M-Pesa API, making it quick and easy to get started.

Features

  • Easy to use: The SDK takes care of the details of making requests and parsing responses from the M-Pesa API, making it quick and easy to get started.
  • Flexible: The SDK is designed to be flexible, allowing you to choose the best way to integrate M-Pesa into your Java application.
  • Well documented: The SDK comes with full documentation, making it easy to get started and learn how to use the SDK.

Getting Started

To get started with the M-Pesa Java SDK, you will need:

  • A Java development environment
  • Maven 3.0 or above

Once you have these set up, you can install the SDK using Maven:

$ mvn install

You can then include the SDK in your Java project by adding the following dependency to your pom.xml file:

<dependency>
    <groupId>com.mpesa.sdk</groupId>
    <artifactId>mpesa-java-sdk</artifactId>
    <version>1.0.0</version>
</dependency>

Usage

To use the M-Pesa Java SDK, you will need to create a MpesaClient:

import com.mpesa.sdk.MpesaClient;
import com.mpesa.sdk.MpesaClientConfig;

MpesaClientConfig config = new MpesaClientConfig();
config.setConsumerKey("your-consumer-key");
config.setConsumerSecret("your-consumer-secret");
config.setEnvironment(MpesaClientConfig.Environment.SANDBOX);

MpesaClient mpesaClient = new MpesaClient(config);

You can then use the MpesaClient to make requests to the M-Pesa API. For example, to create a customer:

import com.mpesa.sdk.requests.CreateCustomerRequest;
import com.mpesa.sdk.responses.CreateCustomerResponse;

CreateCustomerRequest request = new CreateCustomerRequest();
request.setFirstName("John");
request.setLastName("Doe");
request.setPhoneNumber("+254711123456");

CreateCustomerResponse response = mpesaClient.createCustomer(request);