sonawap/paystack 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sonawap/paystack

Composer 安装命令:

composer require sonawap/paystack

包简介

This library will help you manage and use paystack api

README 文档

README

Helps you manage and use Packstack's api

To Start run

Composer require sonawap/paystack

Define your paystack key

Go to vendor > sonawap > paystack > core > config > config.php then replace with your key

Create a new file index.php

Include the autoload file

<?php
require 'vendor/autoload.php';

Using the Library

use Sonawap\Paystack\Transaction\Transaction;
use Sonawap\Paystack\Transaction\Plan;
use Sonawap\Paystack\Transaction\Product;
use Sonawap\Paystack\Transaction\Invoice;
use Sonawap\Paystack\Customer\Customer;

Create a new instance of the class

$transaction = new Transaction();
$customer = new Customer();
$plan = new Plan();
$product = new Product();
$invoice = new Invoice();

Now you have access to all the methods in the classes, see docs or example for details

Transaction

/// initialize a transaction

$transaction->initializeTransaction($fields); //$fields as to be array

<!-- Example -->

$transaction->initializeTransaction(
    $fields = [
        'email' => "customer@email.com",
        'amount' => "20000",
    ]
);

/// Charge Authorization

$transaction->chargeAuthorization(array); //$field as to be array

/// Check Authorization

$transaction->checkAuthorization(array); //$field as to be array

/// Partial_debits

$transaction->partial_debit(array); //$field as to be array

$transaction->transactionTotal([
    'perPage' => 5,
    'page' => 1
]); 


// List transactions carried out on your integration

$transaction->transactionTotal(array); //$field as to be array

// Get details of a transaction carried out on your integration.

$transaction->transactionTotal(array); //$field as to be array

/// Verify Transaction

$transaction->verifyTransaction(reference); // passing the reference gotten from the initialization of the transaction

Customer

// Create a Customer
$customer->createCustomer(); // $field must be array


// Example
$result = $customer->createCustomer(
    $fields = [
        'first_name' => '',
        'last_name' => '',
        'email' => "customer@email.com"
    
    ]
);

// Desactivate Authorisation

$customer->deAuth(array);

// List Customers

$customer->listCustomers([
    'perPage' => 5,
    'page' => 1
]); 

// Fetch Customer

$customer->fetchCustomer("email"); ;

// Update Customer

$customer->updateCustomer(array);

// Validate Customer

$customer->validateCustomer(array);

// Whitelist/Blacklist Customer

$customer->wnbCustomer(array);

Plans

// Create Plan

$plan->createPlan(array);

// Example 
$plan->createPlan(
    $fields = [

		'name' => "Monthly retainer",

		'interval' => "monthly", 
	
		'amount' => "500000"
    
    ]
);

// Fetch Plan

$plan->fetchPlan(idOrCode);

// List Plans

$plan->listPlans(perPage, Page);

// Update Plan

$plan->updatePlan(code, array);

Product

// Create Product

$product->createProduct(array);

// Example 
$product->createProduct(
    $fields = [
        'description' => "Product Six Description",
        'name' => "Product Six",
        'price' => 500000,
        'currency' => "USD",
        'limited' => false,
        'quantity' => 100,
    ]
);

// Fetch Product

$product->fetchProduct(idOrCode);

// List Products

$product->listProducts(perPage, Page);

// Update Product

$product->updateProduct(code, array);

Invoice

// Create Product

$invoice->createInvoice(array);

// Example 
$invoice->createInvoice(
    $fields = [

        "description" => "a test invoice",
        "line_items"=> [
            {
                "name" => "item 1", 
                "amount" => 20000
            },

            {
                "name" => "item 2", 
                "amount" => 20000
            }
        ],
        "tax" => [
            {
                "name" => "VAT", 
                "amount" => 2000
            }
        ],
        "customer" => "CUS_xwaj0txjryg393b",
        "due_date" => "2020-07-08"

    ];
);

// Send Nofication

$invoice->sendNotification($fields = []);

// Archive Invoice

$invoice->archiveInvoice($fields = []);

// Total Invoice

$invoice->totalInvoice();

// List Invoices

$invoice->listInvoices() ;  //perPage = 5, customer = Customer_id

// View Invoice

$invoice->fetchInvoice($idOrCode) ;  

// View Invoice

$invoice->finalizeInvoice() ; 

// Verify Invoice

$invoice->verifyInvoice($idOrCode) ;  

// Archive Invoice

$invoice->verifyInvoice($idOrCode) ;  

// Update Product

$invoice->updateInvoice(code, array);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固