Explicador e2Payments PHP SDK

Overview

Explicador e2Payments PHP SDK

Latest Version on Packagist Build Status Quality Score Total Downloads

Plataforma e2Payments

This package seeks to help php developers implement the e2Payments APIs without much hustle. It is based on the REST API whose documentation is available on https://e2payments.explicador.co.mz/docs.

Installation

You can install the package via composer:

composer require explicador/e2payments-php-sdk

Usage

// Set the consumer key and consumer secret as follows
$mpesa = new \Explicador\E2paymentsPhpSdk\Mpesa();
$mpesa->setClientId('your e2payments client id');
$mpesa->setClientSecret('your e2payments client secret');
$mpesa->setWalletId('your walletId from e2payments');// 'live' production environment 

//This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa.

$result = $mpesa->c2b($phone_number, $amount, $reference);

Example

// Your variables

// The e2payments is REST API based platform
// find or create your credential from: https://e2payments.explicador.co.mz/admin/credentials

$client_id = 'oQPGhzqyDRilpzvTT6g0nhSeomVQ9G7zZrvY4v00'; //you must change
$client_secret = '961022ed-08f6-4980-a1b3-f017fd15b800'; //you must change

// find your wallet_id from: https://e2payments.explicador.co.mz/admin/mpesa
// or in the organizations where you were invited 
// The wallet_id starts by (#), insert here without (#)

$wallet_id = '111111'; //you must change
 
// SDK initiation for mpesa transaction
$mpesa = new \Explicador\E2paymentsPhpSdk\Mpesa([
   'client_secret' => $client_secret,
   'client_id'     => $client_id,
   'wallet_id'     => $wallet_id,
]);

//This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa.
$result = $mpesa->c2b($phone_number, $amount, $reference);

echo var_dump($result);

Common HTTP Status Codes

Status Code Description Explanation
200 OK Request Executed successfully and stored in e2Payments Platform
201 Added The transaction executed successfully and stored in e2Payments Platform
400 Bad Request Wallet, origin or other mpesa issues
403 Forbidden If the Wallet ID does not exists or does not belongs to the user (if walletId belongs to some organization, the user must be invited)
401 Unauthenticated Client ID or Client Secret issues
500 Server error If this happens please, report to Explicador Team.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.

You might also like...
OneSignal PHP SDK

OneSignal SDK for PHP developers with fluent API and supports Laravel / Lumen out of the box.

2c2p payment gateway Redirect PHP-SDK
2c2p payment gateway Redirect PHP-SDK

2c2p payment gateway Redirect PHP-SDK

可能是基于 hyperf 的最优雅的支付宝、微信支付 SDK 了
可能是基于 hyperf 的最优雅的支付宝、微信支付 SDK 了

当前组件整体处于 beta 阶段 运行环境 php = 7.3 composer hyperf = 2.1 安装 composer require yansongda/hyperf-pay:~1.0.0 说明 发布配置文件 php bin/hyperf.php vendor:publish ya

SDK for latest version of Telegram bots API

SDK for latest version of Telegram bots API (from April 24, 2020) Using Examples Installing composer require "DiyorbekUz/Telelib: dev-master" Init bot

API SDK for OpenTrade Commerce API: Taobao, Alibaba, JD, 1688, Aliexpress, Ebay.

OtapiPhpClient Create Client $client = new OtClient($key, $secret, $lang); key (Access Key) secret (Secret for access key) language (2 symbol lang id

Laravel SDK for Sentry
Laravel SDK for Sentry

Sentry for Laravel Laravel integration for Sentry. Laravel Version Compatibility Laravel = 4.2.x is supported until 0.8.x Laravel = 5.7.x on PHP =

Universal payments API SDK (UNOFFICIAL QIWI CLIENT)

Qiwi Php Client Especially for 🦊 Zorra Telecom and 👥 Everyone else Привет Attention: At the moment the number of methods is very limited, they will

⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC. This project is a work-in-progress. Code and docume

Lightweight PHP library for WhatsApp API to send the whatsapp messages in PHP provided by ultramsg.com

Ultramsg.com WhatsApp API PHP SDK Lightweight PHP library for WhatsApp API to send the whatsappp messages in PHP provided by Ultramsg.com Installation

Releases(v1.0.4)
  • v1.0.4(Apr 19, 2022)

    What's Changed

    • Update Mpesa.php by @tantofaznem in https://github.com/Explicador/e2Payments-php-sdk/pull/1

    Full Changelog: https://github.com/Explicador/e2Payments-php-sdk/compare/v1.0.3...v1.0.4

    Source code(tar.gz)
    Source code(zip)
  • v1.0.3(Apr 19, 2022)

    What's Changed

    • Update ServiceProvider.php by @tantofaznem in https://github.com/Explicador/e2Payments-php-sdk/pull/2

    New Contributors

    • @tantofaznem made their first contribution in https://github.com/Explicador/e2Payments-php-sdk/pull/2

    Full Changelog: https://github.com/Explicador/e2Payments-php-sdk/compare/v1.0.2...v1.0.3

    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Apr 18, 2022)

  • v1.0.1(Apr 18, 2022)

Owner
Explicador
App que te permite Encontrar os melhores explicadores da sua região
Explicador
Official repository of the AWS SDK for PHP (@awsforphp)

AWS SDK for PHP - Version 3 The AWS SDK for PHP makes it easy for developers to access Amazon Web Services in their PHP code, and build robust applica

Amazon Web Services 5.7k Jan 1, 2023
Mailgun's Official SDK for PHP

Mailgun PHP client This is the Mailgun PHP SDK. This SDK contains methods for easily interacting with the Mailgun API. Below are examples to get you s

Mailgun Team 1k Dec 23, 2022
A Laravel package to help integrate Shopware PHP SDK much more easier

Shopware 6 Laravel SDK A Laravel package to help integrate Shopware PHP SDK much more easier Installation Install with Composer composer require sas/s

Shape & Shift 16 Nov 3, 2022
Minter Blockchain PHP SDK

About This is a pure PHP SDK for working with Minter blockchain Installation Minter Api Methods: getBalance getNonce send getAddresses getStatus getVa

Minter 24 Nov 21, 2022
The official PHP SDK for Webmarketer (app.webmarketer.io)

PHP SDK for Webmarketer The official PHP SDK for Webmarketer (app.webmarketer.io). Install To add this package, your project must meet several require

Webmarketer 5 Dec 13, 2021
A PHP SDK for the GlobalSmartOTP API.

GlobalSmartOTP PHP SDK A PHP SDK for the GlobalSmartOTP API. Requirements PHP 7.4 or higher cURL Installation $ git clone [email protected]:GlobalSmartOT

GlobalSmartOTP 4 Oct 2, 2022
Fatture in Cloud SDK (Software Development Kit) for PHP

FattureInCloud PHP SDK Request informations In every request description you will be able to find some additional informations about context, permissi

Fatture in Cloud 25 Dec 5, 2022
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Telegram Bot API - PHP SDK Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box. Telegram Bot API is an

Irfaq Syed 2.5k Jan 6, 2023
Official PHP SDK for interacting with the Knock API.

Knock PHP library Documentation See the documentation for PHP usage examples

Knock 4 Dec 16, 2022
Laravel wrapper for the Facebook Graph PHP 8 SDK

Laravel Facebook Graph SDK Installation Getting started with Laravel Facebook Graph is easy - first, install the package via composer composer require

Joel Butcher 44 Dec 8, 2022