定制 jesuferanmi/php-monicredit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jesuferanmi/php-monicredit

Composer 安装命令:

composer require jesuferanmi/php-monicredit

包简介

Monicredit Rest API php library

README 文档

README

Github top language License Github issues Github forks

About   |   Requirements   |   Usage   |   Contribution   |   License   |   Author


🎯 About

PHP Library for Monicredit API

✅ Requirements

Before starting 🏁, you need to have Git and PHP 7+ installed.

🏁 Usage

# Installation
$ composer require jesuferanmi/php-monicredit

ENV Configuration

Open your .env file and add your demo public key, live public key, demo private key, live private key, monicredit live and demo base url(You will find this in the api documentation. An example of the base url is: https://baseURL/api/) and monicredit environment('DEMO' or 'LIVE') like this:

MONICREDIT_DEMO_PUBLIC_KEY=""
MONICREDIT_DEMO_PRIVATE_KEY=""
MONICREDIT_LIVE_PUBLIC_KEY=""
MONICREDIT_LIVE_PRIVATE_KEY=""
MONICREDIT_ENVIRONMENT="DEMO"
MONICREDIT_DEMO_BASEURL=""
MONICREDIT_LIVE_BASEURL=""

If you are using a hosting service like heroku, ensure to add the above details to your configuration variables.

#Usage

  • Initiate Transaction
$monicredit = new Monicredit();

$customer = [
            'first_name' => 'Olasunkanmi',
            'last_name' => 'Feranmi',
            'email' => 'feranmiolasunkanmi91@gmail.com',
            'phone' => '0000000002'
        ];

$splitDetails = [
    'sub_account_code' => 'SB0000000',
    'fee_percentage' => 100,
    'fee_flat' => 0
];
$itemDetails = [
    "item" => 'Test Transaction',
    "revenue_head_code" => 'REV0000000',
    "unit_cost" => '300',
    "split_details" => array($splitDetails),
];

$payload = [
    'order_id' => rand(1000, 9000),
    'customer' => $customer,
    'items' => [$itemDetails],
    'feeBearer' => 'merchant'
];

$initiate = $monicredit->intiateTransaction($payload);
  • Verify Transaction
$monicredit = new Monicredit();

$payload = ["transaction_id" => "ACX000000"];

$verify = $monicredit->verifyTransaction($payload);
  • Get Transaction Info
$monicredit = new Monicredit();
$payload = "ACX000000";

$response = $monicredit->getInitiatedTransactionInfo();

🔨 Countribution

# fork and Clone the fork project
# Access the folder
$ cd monicredit-php

# Install dependencies
$ composer Install

# Create .env and update
$ cp .env.example .env

# Run test
$ vendor/bin/phpunit tests

📝 License

This project is under license from MIT. For more details, see the LICENSE file.

Made with ❤️ by Emmanuel Jesuferanmi

 

Todo:

  • Update Readme with Usage

Back to top

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-25