2017 © Pedro Peláez
 

library webpay-php

GP Webpay API Wrapper

image

adamstipak/webpay-php

GP Webpay API Wrapper

  • Monday, April 16, 2018
  • by newPOPE
  • Repository
  • 7 Watchers
  • 23 Stars
  • 5,163 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 1 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

GP Webpay PHP SDK

Build Status, (*1)

Full featured PHP SDK for GP Webpay payments., (*2)

Installation

The best way to install GP Webpay PHP SDK is using Composer:, (*3)

$ composer require adamstipak/webpay-php dev-master

Setup

$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

```php use \AdamStipak\Webpay\PaymentRequest;, (*4)

$request = new PaymentRequest(...);, (*5)

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

// use $url as you want. In most cases for redirecting to GP Webpay. ```, (*7)

ADDINFO parameter

// for minimal setup you can use
use \AdamStipak\Webpay\PaymentRequest;
use AdamStipak\Webpay\PaymentRequest\AddInfo;

$schema = file_get_contents("Path to XSD schema (GPwebpayAdditionalInfoRequest_v.4.xsd) from portal https://portal.gpwebpay.com/");
// use minimal valid values for XSD schema
$addInfo = new AddInfo($schema, AddInfo::createMinimalValues());
// or you can use valid values against XSD schema (start here AddInfo::createMinimalValues())
$request = new AddInfo($schema, [...]);

$request = new PaymentRequest(..., $addInfo);

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., (*8)

Example:, (*9)

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

Attach to container:, (*10)

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

The Versions

16/04 2018

dev-master

9999999-dev https://github.com/newPOPE/webpay-php

GP Webpay API Wrapper

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • php 7.*

 

The Development Requires

php webpay

26/01 2016

1.1.1

1.1.1.0 https://github.com/newPOPE/webpay-php

GP Webpay API Wrapper

  Sources   Download

MIT

The Requires

  • ext-openssl *

 

The Development Requires

php webpay

10/01 2016

1.1.0

1.1.0.0 https://github.com/newPOPE/webpay-php

GP Webpay API Wrapper

  Sources   Download

MIT

The Requires

  • ext-openssl *

 

The Development Requires

php webpay

13/08 2013

1.0.0

1.0.0.0 https://github.com/newPOPE/webpay-php

Simple request builder for GP Webpay

  Sources   Download

webpay