Giter Site home page Giter Site logo

tolutheo / paystack-class Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yabacon/paystack-class

0.0 1.0 0.0 13 KB

A library to make Paystack API calls by including a single file or from within codeigniter.

License: MIT License

PHP 100.00%

paystack-class's Introduction

====================

PHP Paystack Class

A class to make Paystack API calls by including a single file or from within codeigniter.

Requirements

  • Curl 7.34.0 or more recent
  • PHP 5.4.0 or more recent
  • OpenSSL v1.0.1 or more recent

##Get it Download Paystack.php

##Usage - Direct use The main idea here is to be as simple as possible, basically you just instantiate the library and execute any of the methods in it, all the public API methods available for the moment are implemented.

  // Require the paystack class
  require_once 'Paystack.php';

	// Configuration options
	$config['paystack_key_test_secret']         = 'sk_test_xxxx';
	$config['paystack_key_live_secret']         = 'sk_live_xxxx';
	$config['paystack_test_mode']               = TRUE; // set to false when you are ready to go live

	// Create the library object
	$paystack = new Paystack( $config );

	// Run the required operations
	$response = $paystack->customer_list();
	$response = $paystack->customer->list(['perPage'=>5,'page'=>2]);
	// list the second page at 5 customers per page

  $response = $paystack->customer->create([
                            'first_name'=>'Dafe',
                            'last_name'=>'Aba',
                            'email'=>"[email protected]",
                            'phone'=>'08012345678'
                          ]);
  $response = $paystack->transaction->initialize([
                            'reference'=>'unique_refencecode',
                            'amount'=>'120000',
                            'email'=>'[email protected]'
                          ]);
  $response = $paystack->transaction->verify([
                            'reference'=>'refencecode'
                          ]);

That's it! Have fun.

##Usage - Codeigniter Paste the file as your {APPLICATION}/libraries/Paystack.php

This library is completely functional as standalone but is developed as a Codeigniter library, to use it that way you simply create a config file in: {APPLICATION}/config/paystack.php to store the config array.

Remember to uncomment the CodeIgniter access check before using.

A sample config file is here: config/paystack.php

	// Create the library object
	$this->load->library( 'paystack' );

	// Run the required operations
	$response = $this->paystack->customer_list();
	// list the second page at 5 customers per page
	$response = $this->paystack->transaction->initialize([
                            'reference'=>'unique_refencecode',
                            'amount'=>'120000',
                            'email'=>'[email protected]'
                          ]);
  $response = $this->paystack->transaction->verify([
                            'reference'=>'refencecode'
                          ]);

##Samples Check SAMPLES for more sample API calls

paystack-class's People

Contributors

ibrahimlawal avatar

Watchers

Theophilus Ajayi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.