Skip to content

Commit e50613b

Browse files
authored
Merge pull request #50 from mollie/travis-composer-examples
Add basic example and do some changes to composer and travis
2 parents dafdbdd + d9a7c73 commit e50613b

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ install:
2828
- if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction; fi
2929
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi
3030

31-
script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
31+
script:
32+
- composer validate --strict
33+
- vendor/bin/phpcs --standard=PSR2 src
34+
- vendor/bin/phpunit --coverage-text

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,40 @@ The following gateways are provided by this package:
2727
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)
2828
repository.
2929

30+
### Basic purchase example
31+
32+
```php
33+
$gateway = \Omnipay\Omnipay::create('Mollie');
34+
$gateway->setApiKey('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM');
35+
36+
$response = $gateway->purchase(
37+
[
38+
"amount" => "10.00",
39+
"currency" => "EUR",
40+
"description" => "My first Payment",
41+
"returnUrl" => "https://webshop.example.org/mollie-return.php"
42+
]
43+
)->send();
44+
45+
// Process response
46+
if ($response->isSuccessful()) {
47+
48+
// Payment was successful
49+
print_r($response);
50+
51+
} elseif ($response->isRedirect()) {
52+
53+
// Redirect to offsite payment gateway
54+
$response->redirect();
55+
56+
} else {
57+
58+
// Payment failed
59+
echo $response->getMessage();
60+
}
61+
```
62+
63+
3064
## Support
3165

3266
If you are having general issues with Omnipay, we suggest posting on

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"psr-4": { "Omnipay\\Mollie\\Test\\": "tests/" }
3434
},
3535
"require": {
36-
"omnipay/common": "3.0.2"
36+
"omnipay/common": "^3.0.1"
3737
},
3838
"require-dev": {
3939
"omnipay/tests": "^3.1",

0 commit comments

Comments
 (0)