File tree 2 files changed +25
-3
lines changed
Filter options
2 files changed +25
-3
lines changed
Original file line number Diff line number Diff line change @@ -219,6 +219,28 @@ class PaymentController extends Controller
219
219
}
220
220
```
221
221
222
+ ``` php
223
+ /**
224
+ * In the case where you need to pass the data from your
225
+ * controller instead of a form
226
+ * Make sure to send:
227
+ * required: email, amount, reference, orderID(probably)
228
+ * optionally: currency, description, metadata
229
+ * e.g:
230
+ *
231
+ */
232
+ $data = array(
233
+ "amount" => 700 * 100,
234
+ "reference" => '4g4g5485g8545jg8gj',
235
+ "email" => 'user@mail.com',
236
+ "currency" => "NGN",
237
+ "orderID" => 23456,
238
+ );
239
+
240
+ return Paystack::getAuthorizationUrl($data)->redirectNow();
241
+
242
+ ```
243
+
222
244
Let me explain the fluent methods this package provides a bit here.
223
245
``` php
224
246
/**
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ private function setRequestOptions()
109
109
* @return Paystack
110
110
*/
111
111
112
- public function makePaymentRequest ( $ data = null )
112
+ public function makePaymentRequest ($ data = null )
113
113
{
114
114
if ( $ data == null ) {
115
115
@@ -205,9 +205,9 @@ private function setHttpResponse($relativeUrl, $method, $body = [])
205
205
* Get the authorization url from the callback response
206
206
* @return Paystack
207
207
*/
208
- public function getAuthorizationUrl ()
208
+ public function getAuthorizationUrl ($ data = null )
209
209
{
210
- $ this ->makePaymentRequest ();
210
+ $ this ->makePaymentRequest ($ data );
211
211
212
212
$ this ->url = $ this ->getResponse ()['data ' ]['authorization_url ' ];
213
213
You can’t perform that action at this time.
0 commit comments