Skip to content

sajfi/gp-webpay-php-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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

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.
}

About

GP Webpay PHP SDK

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%