定制 nkm/redsys-virtual-pos 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nkm/redsys-virtual-pos

最新稳定版本:v0.5.0

Composer 安装命令:

composer require nkm/redsys-virtual-pos

包简介

Redsys Virtual POS is an unofficial standalone PHP library to handle payments through the spanish payment service Redsys.

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Redsys Virtual POS is an unofficial standalone PHP library to handle payments through the spanish payment service Redsys.

NOTE: This library its still under development and its functionality is subject to change.

Prerequisites

  • PHP >=5.4.0 <8.0

Installation

Installation is recommended through Composer.

$ composer require bahiazul/redsys-virtual-pos

Sample

Go to the sample folder an run the following command in a terminal to start PHP's built-in web server:

# install dependencies
$ composer install

# start the server
$ php -S 0.0.0.0:8000

Then open your browser and go to here.

If you want to test the online (async) response, replace localhost with your public IP or hostname, making sure that your machine is accesible through the port 8000 (you can use another port if you want).

Usage

Basic usage:

use Bahiazul\RedsysVirtualPos\Message\WebRequest;
use Bahiazul\RedsysVirtualPos\Field\Currency;
use Bahiazul\RedsysVirtualPos\Field\TransactionType;

$secret       = 'Mk9m98IfEblmPfrpsawt7BmxObt98Jev';
$merchantCode = '999008881';
$terminal     = '871';

// The Environment object holds connection details
$env = new Bahiazul\RedsysVirtualPos\Environment\DevelopmentEnvironment();
$env->setSecret($secret);

// Setup the Parameters for the Request
$params['Amount']             = '145'; // €1,45
$params['Order']              = strval(time());
$params['MerchantCode']       = $merchantCode;
$params['Currency']           = Currency::EUR;
$params['TransactionType']    = TransactionType::STANDARD;
$params['Terminal']           = $terminal;
$params['MerchantName']       = 'Test Store';                        // optional
$params['ProductDescription'] = 'Product Description';               // optional
$params['UrlOk']              = 'http://localhost:8000/success.php'; // optional
$params['UrlKo']              = 'http://localhost:8000/failure.php'; // optional

// Generate the Request
$webRequest = new WebRequest($env);
$webRequest->setParams($params);

// Generate the form
$submitBtn = "<p><input type='submit' value='Submit'></p>";
$wrForm = $webRequest->getForm([], $submitBtn);

// Render the HTML form w/ Submit button
echo $wrForm;

See sample/index.php and sample/response.php for more detailed examples.

Test

Run the following command in a terminal:

# install dependencies
$ composer install

# run the tests
$ phpunit

Changelog

See CHANGELOG.md

Authors

License

MIT

统计信息

  • 总下载量: 187
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-30