Skip to content

Commit e57fcf7

Browse files
Merge pull request #2 from webong/main
v1.0.0 Release
2 parents 3c469b1 + 039d0f1 commit e57fcf7

File tree

4 files changed

+200
-98
lines changed

4 files changed

+200
-98
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
# plugin-gravity-forms
2-
Gravity Forms Paystack Plugin
1+
# Paystack Addon for Gravity Forms
2+
3+
## Introduction
4+
Paystack Addon for Gravity Forms allows you to quickly and easily implement credit card payments with WordPress. With the Paystack Add-On you can capture one time credit card payments or setup recurring payment subscriptions.
5+
6+
## Pre-Requisites
7+
- Gravity Forms v2.4+
8+
- WordPress v3.8+
9+
- SSL Certificate Installed and - Configured
10+
- Download and install the add-on
11+
- A Paystack account
12+
13+
## Paystack Settings
14+
The Paystack Settings will allow you to connect and authenticate with your paystack account and it will allow you to setup webhooks which are used to communicate events from Paystack back to your Gravity Forms environment.
15+
16+
Navigate to your Paystack Add-On Settings page:
17+
18+
1. Log into your WordPress admin dashboard.
19+
2. On the left side navigation menu, hover over Forms and click on Settings.
20+
3. Click the Paystack tab.
21+
22+
![Paystack Settings](./images/screenshot-paystack-settings.png)
23+
24+
### Mode
25+
Allows you to specify the default environment you want to send your form submission to. Choosing Live will initiate real transactions, while Test will run the form entry into your paystack test environment, which should not generate any real transactions.

class-gf-paystack-api.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
class GFPaystackApi
77
{
8-
private $plugin_name;
9-
private $public_key;
10-
private $secret_key;
8+
public $plugin_name;
9+
10+
protected $public_key;
11+
12+
protected $secret_key;
1113

1214
public function __construct($config)
1315
{
@@ -68,12 +70,14 @@ public function send_request(
6870

6971
if (is_wp_error($res)) {
7072
throw new Exception(sprintf(__('You had an HTTP error connecting to %s', 'gravityformspaystack'), $this->name));
71-
}
73+
}
7274

7375
$body = json_decode($res['body'], true);
74-
76+
7577
if ($body !== null) {
76-
if (isset($json_res['error']) || $body['status'] == false) {
78+
error_log(__METHOD__ . '(): for ' . $uri . ' Paystack Request ' . print_r($arg_array, true) . ' Paystack Response => ' . print_r($body, true));
79+
80+
if (isset($body['error']) || $body['status'] == false) {
7781
throw new Exception("{$body['message']}");
7882
} else {
7983
return $body;
@@ -101,11 +105,8 @@ public function validate_webhook($input)
101105
*/
102106
public function get_headers()
103107
{
104-
return apply_filters(
105-
'mepr_paystack_request_headers',
106-
[
107-
'Authorization' => "Bearer {$this->secret_key}",
108-
]
109-
);
108+
return apply_filters('gf_paystack_request_headers', [
109+
'Authorization' => "Bearer {$this->secret_key}"
110+
]);
110111
}
111112
}

0 commit comments

Comments
 (0)