Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.

Commit 9e9fe96

Browse files
author
Patrick Arnold
committed
initial commit
0 parents  commit 9e9fe96

11 files changed

Lines changed: 1484 additions & 0 deletions

.styleci.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
preset: psr2
2+
3+
risky: false
4+
5+
disabled:
6+
7+
enabled:
8+
# - align_double_arrow
9+
# - align_equals
10+
- binary_operator_spaces
11+
# - blank_line_after_namespace #psr2
12+
- blank_line_after_opening_tag
13+
- blank_line_before_return
14+
# - braces #psr2
15+
- cast_spaces
16+
# - class_definition #psr2
17+
- concat_with_spaces
18+
# - concat_without_spaces
19+
# - declare_equal_normalize
20+
# - declare_strict_types
21+
# - dir_constant
22+
# - echo_to_print
23+
# - elseif #psr2
24+
# - encoding #psr2
25+
# - ereg_to_preg #risky
26+
# - full_opening_tag #psr2
27+
# - function_declaration #psr2
28+
- function_typehint_space
29+
- hash_to_slash_comment
30+
- heredoc_to_nowdoc
31+
- include
32+
- linebreak_after_opening_tag
33+
# - long_array_syntax
34+
- lowercase_cast
35+
# - lowercase_constants #psr2
36+
# - lowercase_keywords #psr2
37+
# - method_argument_space #psr2
38+
- method_separation
39+
# - modernize_types_casting
40+
- native_function_casing
41+
- new_with_braces
42+
# - no_alias_functions
43+
- no_blank_lines_after_class_opening
44+
- no_blank_lines_after_phpdoc
45+
- no_blank_lines_after_return
46+
- no_blank_lines_after_throw
47+
- no_blank_lines_between_imports
48+
- no_blank_lines_between_traits
49+
# - no_blank_lines_before_namespace
50+
# - no_closing_tag #psr2
51+
- no_empty_comment
52+
- no_empty_phpdoc
53+
- no_empty_statement
54+
- no_extra_consecutive_blank_lines
55+
- no_leading_import_slash
56+
- no_leading_namespace_whitespace
57+
# - no_multiline_whitespace_around_double_arrow
58+
# - no_multiline_whitespace_before_semicolons
59+
# - no_php4_constructor #risky
60+
- no_short_bool_cast
61+
# - no_short_echo_tag
62+
- no_singleline_whitespace_before_semicolons
63+
# - no_spaces_after_function_name #psr2
64+
- no_spaces_inside_offset
65+
# - no_spaces_inside_parenthesis #psr2
66+
- no_spaces_outside_offset
67+
# - no_tab_indentation #psr2
68+
- no_trailing_comma_in_list_call
69+
- no_trailing_comma_in_singleline_array
70+
# - no_trailing_whitespace #psr2
71+
# - no_trailing_whitespace_in_comment #psr2
72+
- no_unneeded_control_parentheses
73+
# - no_unreachable_default_argument_value
74+
- no_unused_imports
75+
# - no_useless_else
76+
- no_useless_return
77+
- no_whitespace_before_comma_in_array
78+
- no_whitespace_in_blank_line
79+
- normalize_index_brace
80+
# - not_operator_with_space
81+
# - not_operator_with_successor_space
82+
- object_operator_without_whitespace
83+
# - ordered_class_elements
84+
- alpha_ordered_imports
85+
# - phpdoc_align
86+
- phpdoc_add_missing_param_annotation
87+
- phpdoc_indent
88+
- phpdoc_inline_tag
89+
- phpdoc_link_to_see
90+
- phpdoc_no_access
91+
- phpdoc_no_empty_return
92+
- phpdoc_no_package
93+
- phpdoc_order
94+
- phpdoc_property
95+
- phpdoc_scalar
96+
- phpdoc_separation
97+
- phpdoc_single_line_var_spacing
98+
# - phpdoc_summary
99+
# - phpdoc_to_comment
100+
- phpdoc_trim
101+
- phpdoc_type_to_var
102+
- phpdoc_types
103+
# - phpdoc_var_to_type
104+
- phpdoc_var_without_name
105+
- print_to_echo
106+
# - property_visibility_required #psr2
107+
# - psr4 #psr2
108+
- return_type_declaration
109+
- self_accessor
110+
- short_array_syntax
111+
- short_scalar_cast
112+
# - simplified_null_return
113+
# - single_blank_line_at_eof #psr2
114+
- single_blank_line_before_namespace
115+
# - single_class_element_per_statement #psr2
116+
# - single_import_per_statement #psr2
117+
# - single_line_after_imports #psr2
118+
- single_quote
119+
- space_after_semicolon
120+
- standardize_not_equals
121+
# - switch_case_semicolon_to_colon #psr2
122+
# - switch_case_space #psr2
123+
- ternary_operator_spaces
124+
- trailing_comma_in_multiline_array
125+
- trim_array_spaces
126+
- unalign_double_arrow
127+
- unalign_equals
128+
- unary_operator_spaces
129+
# - unix_line_endings #psr2
130+
# - uppercase_constants
131+
# - visibility_required #psr2
132+
- whitespace_after_comma_in_array

.stylelintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"indentation": 4
4+
}
5+
}

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing Guidelines
2+
3+
* Fork the project.
4+
* Make your feature addition or bug fix.
5+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
6+
* Commit just the modifications, do not mess with the composer.json or CHANGELOG.md files.
7+
* Ensure your code is nicely formatted in the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
8+
style and that all tests pass.
9+
* Send the pull request.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 RingierOneAfricaMedia
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Omnipay: Paystack
2+
3+
**Paystack driver for the Omnipay PHP payment processing library**
4+
5+
[![Maintainability](https://api.codeclimate.com/v1/badges/0b7329e3c725e30c4344/maintainability)](https://codeclimate.com/github/oneafricamedia/omnipay-paystack/maintainability)
6+
[![Test Coverage](https://api.codeclimate.com/v1/badges/0b7329e3c725e30c4344/test_coverage)](https://codeclimate.com/github/oneafricamedia/omnipay-paystack/test_coverage)
7+
[![Style CI](https://styleci.io/repos/121246094/shield)](https://styleci.io/repos/121246094/shield)
8+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/oneafricamedia/omnipay-paystack/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/oneafricamedia/omnipay-paystack/?branch=master)
9+
10+
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
11+
processing library for PHP. This package implements Paystack support for Omnipay. https://paystack.com/
12+
refer to the API docs here: http://developer.paystack.com/
13+
## Install
14+
15+
Via Composer
16+
17+
``` bash
18+
$ composer require oneafricamedia/omnipay-paystack
19+
```
20+
21+
## Basic Usage
22+
23+
### Get the Paystack redirect URL
24+
25+
```php
26+
use Omnipay\Omnipay;
27+
28+
$url = Omnipay::create('Paystack')
29+
->setCredentials(
30+
'your_key',
31+
'your_secret'
32+
)
33+
->setCallbackUrl('https://example.com/callback')
34+
->getUrl(
35+
'test@example.com',
36+
'my_reference',
37+
'description',
38+
100
39+
);
40+
```
41+
42+
### Check transaction status (from the Paystack ipn)
43+
44+
1) Configure & setup an endpoint to receive the ipn message from Paystack
45+
2) Listen for the message and use `getTransactionStatus` (please handle the http GET vars accordingly)
46+
47+
```php
48+
use Omnipay\Omnipay;
49+
50+
$status = Omnipay::create('Paystack')
51+
->setCredentials(
52+
'your_key',
53+
'your_secret'
54+
)
55+
->getTransactionStatus(
56+
$_GET['paystack_notification_type'],
57+
$_GET['paystack_transaction_tracking_id'],
58+
$_GET['paystack_merchant_reference']
59+
);
60+
```
61+
3) `$status` will be either `PENDING`, `COMPLETED`, `FAILED` or `INVALID`. Handle these statuses in your application workflow accordingly.
62+
63+
### TODO
64+
65+
1) Test coverage
66+
2) add `QueryPaymentStatusByMerchantRef` support
67+
3) add `QueryPaymentDetails` support
68+

composer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "oneafricamedia/omnipay-paystack",
3+
"type": "library",
4+
"description": "Paystack gateway for Omnipay payment processing library",
5+
"keywords": [
6+
"gateway",
7+
"merchant",
8+
"omnipay",
9+
"pay",
10+
"payment",
11+
"paystack",
12+
"purchase"
13+
],
14+
"homepage": "https://github.com/OneAfricaMedia/omnipay-paystack",
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "ROAM - Ringier OneAfricaMedia",
19+
"email": "oamdev@roam.africa"
20+
}
21+
],
22+
"autoload": {
23+
"psr-4": {
24+
"Omnipay\\Paystack\\" : "src/"
25+
}
26+
},
27+
"require": {
28+
"php": "^7.0",
29+
"omnipay/omnipay": "v3.0-alpha.1",
30+
"php-http/guzzle6-adapter": "^1.1"
31+
},
32+
"minimum-stability": "dev"
33+
}

0 commit comments

Comments
 (0)