Skip to content

Commit a211c23

Browse files
authored
Update README.md
1 parent 1d3f37c commit a211c23

1 file changed

Lines changed: 31 additions & 17 deletions

File tree

README.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
# Cakephp-Paystack
12
A Cakephp 3.x Plugin for making paystack payments
23
Installation
34
PHP 5.4+ , and Composer are required.
45

56
To get the latest version of Cakephp Paystack, simply require it
67

7-
composer require jtad009/paystack
8+
composer require jtad009/cakephp-paystack
89
Or add the following line to the require block of your composer.json file.
910

10-
"jtad009/paystack": "1.0.*"
11+
"jtad009/cakephp-paystack"
12+
1113
You'll then need to run composer install or composer update to download it and have the autoloader updated.
1214

13-
Once Laravel Paystack is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.
15+
Once Cakephp-Paystack is installed, you need to register the plugin. Open up config/bootstrap.php and add the following .
1416

15-
Also, register the Plugins like this in the config/bootstrap.php:
16-
<?php
17-
Plugin::load('PayStack', ['bootstrap' => false, 'routes' => true,'autoload'=>true]);
18-
?>
1917

18+
<?php
2019

20+
Plugin::load("PayStack", ["bootstrap" => false, "routes" => true,"autoload"=>true]);
2121

22+
?>
2223

2324
##General payment flow
2425

@@ -30,25 +31,31 @@ The redirection is accomplished by submitting a form with some hidden fields. Th
3031

3132

3233

33-
Usage
34+
##Usage
3435
Open your config/path.php file and add your public key, secret key, merchant email and payment url like so:
35-
<?php
36-
define("PaystackPublicKey",xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx);
37-
define("PaystackSecretKey",xxxxxxxxxxxxxxxxxxxxxxxxxx);
3836

39-
?>
40-
Simple Example on how to pay with this plugin
37+
<?php
38+
39+
define("PaystackPublicKey",xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx);
40+
define("PaystackSecretKey",xxxxxxxxxxxxxxxxxxxxxxxxxx);
41+
42+
?>
43+
##Simple Example on how to pay with this plugin
4144
--Let's say a cutomer wants to pay for sms
4245

4346
Step 1: Include the following code into your AppController.php to load the paystack component
44-
<?php
47+
48+
<?php
49+
4550
$this->loadComponent('PayStack.PayStack');
4651
$this->loadComponent('PayStack.CurlConnection');
4752
?>
4853

4954

5055
Step 2: in your controller create an action, mine will be PurchaseSMS()
56+
5157
<?php
58+
5259
public function purchaseSMS(array $data){
5360
$postArray = array(
5461
'description'=>'SMS UNIT PURCHASE',
@@ -71,6 +78,7 @@ Step 2: in your controller create an action, mine will be PurchaseSMS()
7178
//Authorization url will redirect you to this function
7279
//$routes->connect('/success/', ['controller' => 'StudentsProfiles', 'action' => 'complete']);
7380
//I had set up a route to redirect to complete action when the callback_url above is lookedup by paystack
81+
7482
public function complete(){
7583
7684
$reference = isset($_GET['reference']) ? $_GET['reference'] : '';
@@ -88,7 +96,11 @@ Step 2: in your controller create an action, mine will be PurchaseSMS()
8896

8997

9098
After verification of reference code the following response is sent and you can use this to update DB
91-
object(stdClass)#224 (3) {
99+
100+
101+
<?php
102+
103+
object(stdClass)#224 (3) {
92104
["status"]=> bool(true)
93105
["message"]=> string(23) "Verification successful"
94106
["data"]=> object(stdClass)#315 (24) {
@@ -148,8 +160,10 @@ object(stdClass)#224 (3) {
148160
["transaction_date"]=> string(24) "2019-02-07T07:59:08.000Z"
149161
["plan_object"]=> object(stdClass)#307 (0) { }
150162
["subaccount"]=> object(stdClass)#310 (0) { } } }
163+
164+
?>
151165

152-
----Todo
166+
##Todo
153167
Charge Returning Customers
154168
Add Comprehensive Tests
155169
Implement Transaction Dashboard to see all of the transactions in your Cakephp app
@@ -160,7 +174,7 @@ Manage Subsctiptions
160174
Export Transactions as csv
161175

162176

163-
----How can I thank you?
177+
##How can I thank you?
164178
Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!
165179

166180
Don't forget to follow me on <a href="http://linkedin.com/in/%D0%B8%D1%81%D1%80%D0%B0%D0%B5%D0%BB-%D0%B5%D0%B4%D0%B5%D1%82-502b27174">LinkedIn</a>

0 commit comments

Comments
 (0)