first commit
This commit is contained in:
70
plugins/stPayNowPlugin/vendor/pay-now/paynow-php-sdk/README.md
vendored
Normal file
70
plugins/stPayNowPlugin/vendor/pay-now/paynow-php-sdk/README.md
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# Paynow PHP SDK
|
||||
|
||||
[](https://github.com/pay-now/paynow-php-sdk/releases)
|
||||
[](https://travis-ci.org/pay-now/paynow-php-sdk)
|
||||
[](LICENSE)
|
||||
<!--[](https://packagist.org/packages/pay-now/paynow-php-sdk)-->
|
||||
|
||||
Paynow PHP Library provides access to Paynow API from Applications written in PHP language.
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer
|
||||
Install the library using [Composer](https://getcomposer.org)
|
||||
```bash
|
||||
$ composer require pay-now/paynow-php-sdk
|
||||
```
|
||||
and include composer autoloader
|
||||
```php
|
||||
require_once('vendor/autoload.php');
|
||||
```
|
||||
|
||||
## Usage
|
||||
Making a payment
|
||||
```php
|
||||
$client = new \Paynow\Client('TestApiKey', 'TestSignatureKey', Environment::SANDBOX);
|
||||
$orderReference = "success_1234567";
|
||||
$idempotencyKey = uniqid($orderReference . '_');
|
||||
|
||||
$paymentData = [
|
||||
"amount" => "100",
|
||||
"currency" => "PLN",
|
||||
"externalId" => $orderReference,
|
||||
"description" => "Payment description",
|
||||
"buyer" => [
|
||||
"email" => "customer@domain.com"
|
||||
]
|
||||
];
|
||||
|
||||
try {
|
||||
$payment = new \Paynow\Service\Payment($client);
|
||||
$result = $payment->authorize($paymentData, $idempotencyKey);
|
||||
} catch (PaynowException $exception) {
|
||||
// catch errors
|
||||
}
|
||||
```
|
||||
|
||||
Handling notification with current payment status
|
||||
```php
|
||||
$payload = trim(file_get_contents('php://input'));
|
||||
$headers = getallheaders();
|
||||
$notificationData = json_decode($payload, true);
|
||||
|
||||
try {
|
||||
new \Paynow\Notification('TestSignatureKey', $payload, $headers);
|
||||
// process notification with $notificationData
|
||||
} catch (\Exception $exception) {
|
||||
header('HTTP/1.1 400 Bad Request', true, 400);
|
||||
}
|
||||
|
||||
header('HTTP/1.1 202 Accepted', true, 202);
|
||||
```
|
||||
|
||||
## Documentation
|
||||
See the [Paynow API documentation](https://docs.paynow.pl)
|
||||
|
||||
## Support
|
||||
If you have any questions or issues, please contact our support at support@paynow.pl.
|
||||
|
||||
## License
|
||||
MIT license. For more information see the [LICENSE file](LICENSE)
|
||||
Reference in New Issue
Block a user