Skip to content

Commit

Permalink
Merge pull request #50 from mollie/travis-composer-examples
Browse files Browse the repository at this point in the history
Add basic example and do some changes to composer and travis
  • Loading branch information
barryvdh authored Jul 24, 2018
2 parents dafdbdd + d9a7c73 commit e50613b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ install:
- if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi

script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
script:
- composer validate --strict
- vendor/bin/phpcs --standard=PSR2 src
- vendor/bin/phpunit --coverage-text
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,40 @@ The following gateways are provided by this package:
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)
repository.

### Basic purchase example

```php
$gateway = \Omnipay\Omnipay::create('Mollie');
$gateway->setApiKey('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM');

$response = $gateway->purchase(
[
"amount" => "10.00",
"currency" => "EUR",
"description" => "My first Payment",
"returnUrl" => "https://webshop.example.org/mollie-return.php"
]
)->send();

// Process response
if ($response->isSuccessful()) {

// Payment was successful
print_r($response);

} elseif ($response->isRedirect()) {

// Redirect to offsite payment gateway
$response->redirect();

} else {

// Payment failed
echo $response->getMessage();
}
```


## Support

If you are having general issues with Omnipay, we suggest posting on
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"psr-4": { "Omnipay\\Mollie\\Test\\": "tests/" }
},
"require": {
"omnipay/common": "3.0.2"
"omnipay/common": "^3.0.1"
},
"require-dev": {
"omnipay/tests": "^3.1",
Expand Down

0 comments on commit e50613b

Please sign in to comment.