websystem / gp-webpay-sdk
This is my package gp-webpay-sdk
Fund package maintenance!
Codehub
Requires
- php: >=8.2
- ext-dom: *
- ext-iconv: *
- ext-libxml: *
- ext-openssl: *
- illuminate/contracts: ^9.28|^10.0|^11.0
- spatie/array-to-xml: *
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
README
This package provides a simple way to integrate GPWebpay payment gateway into Laravel applications.
Requirements for the package
- PHP 8.2 or higher
- Laravel 10 or higher
Installation
Install the package via composer
composer require websystem/gp-webpay-sdk
Publish the configuration file
php artisan vendor:publish --tag=webpay-config
Define environment variables
Save the following environment variables to the .env
file in the root directory of the project.
Locate your keys and certificates in the storage
directory.
GPWEBPAY_PRIVATE_KEY_PATH= # Storage path to the private key GPWEBPAY_PRIVATE_KEY_PASSWORD= # Password for the private key GPWEBPAY_PUBLIC_KEY_PATH= # Storage path to the public key GPWEBPAY_MERCHANT_NUMBER= # Merchant number GPWEBPAY_URL=https://test.3dsecure.gpwebpay.com/pgw/order.do GPWEBPAY_ADD_INFO_SCHEMA= # Storage path to the additional info schema
Available methods
Create payment
use Websystem\Gpwebpay\Enums\Currency; use Websystem\Gpwebpay\Facades\Gpwebpay; $paymentData = [ 'orderNumber' => 1001, # Unique order number 'amount' => 150.50, # Float value 'currency' => Currency::EUR, 'depositFlag' => 1, 'returnUrl' => 'https://example.com/callback', 'addInfo' => [ 'name' => 'John Doe', 'email' => 'doe@invelity.com', ], 'addInfoSchemaPath' => config('gpwebpay.add_info_schema'), ]; $requestUrl = Gpwebpay::createPaymentRequestUrl($paymentData); return redirect($requestUrl);
Credits
This library originates from adamstipak/webpay-php. I have adapted it into a package for Laravel and made slight code modifications.