Skip to content

prinx/payswitch-momo-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PAYSWITCH MOBILE MONEY PHP SDK

Build Status Latest Stable Version License StyleCI

Work In Progress

Installation

composer require prinx/payswitch-momo

Usage

Configuration in .env file (in the project root folder)

# .env file

PAYSWITCH_MOMO_API_ENV=test|prod
PAYSWITCH_MOMO_API_USER=
PAYSWITCH_MOMO_API_KEY=
PAYSWITCH_MOMO_API_MERCHANT_ID=
PAYSWITCH_MOMO_API_PROCESSING_CODE="000200"
PAYSWITCH_MOMO_API_DESCRIPTION="At least 10 characters"

PAYSWITCH_MOMO_LOG_ENABLED=true|false
PAYSWITCH_MOMO_LOCAL_LOG_ENABLED=true|false

Make sure the value for PAYSWITCH_MOMO_API_PROCESSING_CODE and PAYSWITCH_MOMO_API_KEY are enclosed with double quotes.

Making a payment request

use Prinx\Payswitch\MobileMoney;

$momo = new MobileMoney;

$amount = 1; // 1 cedi
$phone = '233...';
$network = ''; // Must be one of MTN|VODAFONE|AIRTEL

$response = $momo->pay($amount, $phone, $network);

if ($response->isSuccessful()) {
    // User successfully payed
} else {
    $error = $response->getError();
}

Voucher code for Vodafone users

Vodafone users always generate a voucher code to be able to process their mobile money transactions. After getting the voucher code from the user, you can easily pass it argument of the pay method:

// ...

$response = $momo->pay($amount, $phone, $network, $voucherCode);

License

MIT

About

Payswitch Mobile Money PHP SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages