@@ -13,7 +13,7 @@ After updating composer, add the ServiceProvider to the providers array in app/c
1313
1414 'Barryvdh\Omnipay\ServiceProvider',
1515
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.
1717
1818 $ php artisan config:publish barryvdh/laravel-omnipay
1919
@@ -24,3 +24,33 @@ To use the Facade (`Omnipay::purchase()` instead of `App::make(`omnipay`)->purch
2424When calling the Omnipay facade/instance, it will create the default gateway, based on the configuration.
2525You can change the default gateway by calling ` Omnipay::setDefaultGateway('My\Gateway') ` .
2626You 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