No description
Find a file
2018-04-22 00:17:01 +02:00
.docker Refresh development environment. Update PHPUnit. 2017-11-27 09:42:27 +01:00
src Downgraded to PHP 56 2018-04-16 06:05:47 +02:00
tests Signer returns true in verify method. 2018-01-21 13:11:16 +01:00
.gitignore Ignoring .idea. 2017-11-27 15:55:09 +01:00
.travis.yml Fix PHP version. 2017-11-27 15:39:43 +01:00
composer.json Update composer.json 2018-04-22 00:01:18 +02:00
docker-compose.yml Refresh development environment. Update PHPUnit. 2017-11-27 09:42:27 +01:00
phpunit.xml Moving tests/bootstrap to PHPUnit configuration. 2015-05-03 14:16:21 +02:00
README.md Update README.md 2018-04-22 00:17:01 +02:00

GP Webpay PHP SDK

Build Status

Full featured PHP SDK for GP Webpay payments.

Installation

The best way to install GP Webpay PHP SDK is using Composer:

$ composer require vitexus/webpay-php5 dev-php56

## Setup

```php
$signer = new \AdamStipak\Webpay\Signer(
  $privateKeyFilepath,    // Path of private key.
  $privateKeyPassword,    // Password for private key.
  $publicKeyFilepath      // Path of public key.
);
    
$api = new \AdamStipak\Webpay\Api(
  $merchantNumber,    // Merchant number.
  $webpayUrl,         // URL of webpay.
  $signer             // instance of \AdamStipak\Webpay\Signer.
);

Create payment

Create payment url

use \AdamStipak\Webpay\PaymentRequest;

$request = new PaymentRequest(...);

$url = $api->createPaymentRequestUrl($request); // $api instance of \AdamStipak\Webpay\Api

// use $url as you want. In most cases for redirecting to GP Webpay.

Verify payment response

use \AdamStipak\Webpay\PaymentResponse;
use \AdamStipak\Webpay\Exception;
 
$response = new PaymentResponse(...); // fill response with response parameters (from request).
 
try {
  $api->verifyPaymentResponse($response);
} 
catch (PaymentResponseException $e) {
  // PaymentResponseException has $prCode, $srCode for properties for logging GP Webpay response error codes.
}
catch (Exception $e) {
  // Digest is not correct.
}

##Development

GP Webpay PHP SDK is developed in Docker container via docker-compose command.

Example:

$ docker-compose run --rm default install  # install deps via composer
$ docker-compose run --rm default  # runs tests in container

Attach to container:

$ docker-compose run --rm default bash # runs bash in container and attach tty