@@ -13,7 +13,7 @@ After updating composer, add the ServiceProvider to the providers array in app/c
13
13
14
14
'Barryvdh\Omnipay\ServiceProvider',
15
15
16
- You need to publish the config for this package
16
+ You need to publish the config for this package. A sample configuration is provided. The defaults will be merged with gateway specific configuration.
17
17
18
18
$ php artisan config:publish barryvdh/laravel-omnipay
19
19
@@ -24,3 +24,33 @@ To use the Facade (`Omnipay::purchase()` instead of `App::make(`omnipay`)->purch
24
24
When calling the Omnipay facade/instance, it will create the default gateway, based on the configuration.
25
25
You can change the default gateway by calling ` Omnipay::setDefaultGateway('My\Gateway') ` .
26
26
You can get a different gateway by calling ` Omnipay::gateway('My\Cass') `
27
+
28
+ ## Examples
29
+
30
+ $params = [
31
+ 'amount' => $order->amount,
32
+ 'issuer' => $issuerId,
33
+ 'description' => $order->description,
34
+ 'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
35
+ ];
36
+ $response = Omnipay::purchase($params)->send();
37
+
38
+ if ($response->isSuccessful()) {
39
+ // payment was successful: update database
40
+ print_r($response);
41
+ } elseif ($response->isRedirect()) {
42
+ // redirect to offsite payment gateway
43
+ return $response->getRedirectResponse();
44
+ } else {
45
+ // payment failed: display message to customer
46
+ echo $response->getMessage();
47
+ }
48
+
49
+ Besides the gateway calls, there is also a shortcut for the creditcard:
50
+
51
+ $formInputData = array(
52
+ 'firstName' => 'Bobby',
53
+ 'lastName' => 'Tables',
54
+ 'number' => '4111111111111111',
55
+ );
56
+ $card = Omnipay::CreditCard($formInputData);
0 commit comments