Skip to content
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 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" => '[email protected]',
"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 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