Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Added an option to add request data from controller #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions 22 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,28 @@ class PaymentController extends Controller
}
```

```php
/**
* In the case where you need to pass the data from your
* controller instead of a form
* Make sure to send:
* required: email, amount, reference, orderID(probably)
* optionally: currency, description, metadata
* e.g:
*
*/
$data = array(
"amount" => 700 * 100,
"reference" => '4g4g5485g8545jg8gj',
"email" => 'user@mail.com',
"currency" => "NGN",
"orderID" => 23456,
);

return Paystack::getAuthorizationUrl($data)->redirectNow();

```

Let me explain the fluent methods this package provides a bit here.
```php
/**
Expand Down
6 changes: 3 additions & 3 deletions 6 src/Paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function setRequestOptions()
* @return Paystack
*/

public function makePaymentRequest( $data = null)
public function makePaymentRequest($data = null)
{
if ( $data == null ) {

Expand Down Expand Up @@ -205,9 +205,9 @@ private function setHttpResponse($relativeUrl, $method, $body = [])
* Get the authorization url from the callback response
* @return Paystack
*/
public function getAuthorizationUrl()
public function getAuthorizationUrl($data = null)
{
$this->makePaymentRequest();
$this->makePaymentRequest($data);

$this->url = $this->getResponse()['data']['authorization_url'];

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.