定制 kwaadpepper/payment-form-api 二次开发

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

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

kwaadpepper/payment-form-api

最新稳定版本:3.0.3

Composer 安装命令:

composer require kwaadpepper/payment-form-api

包简介

Common API to make Lyra payment platform integration easier in PHP based websites.

README 文档

README

Lyra payment form API is an open source PHP SDK that allows integration of secured payment gateway developped by Lyra Network inside e-commerce websites.

Requirements

PHP 5.3.0 and later.

Installation

Composer

You can install the API via Composer. Run the following command:

composer require kwaadpepper/payment-form-api

To use the API, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the API, include the init.php file.

require_once('/path/to/payment-form-api/init.php');

Usage

To create payment form do :

$ctxMode = 'TEST';
$keyTest = '1111111111111111';
$keyProd = '2222222222222222';
$algo = 'SHA-1';

$request = new \Lyranetwork\Request();
$request->set('ctx_mode', $ctxMode);
$request->set('key_test', $keyTest);
$request->set('key_prod', $keyProd);
$request->set('sign_algo', $algo);


$request->set('site_id', '12345678');
$request->set('amount', '100'); // amount in cents
$request->set('currency', '978');
$request->set('capture_delay', '');
$request->set('validation_mode', '');

echo $request->getRequestHtmlForm(); // display generated payment form

To process payment result, do :

$keyTest = '1111111111111111';
$keyProd = '2222222222222222';
$algo = 'SHA-1';

$response = new \LyraNetwork\Response($_REQUEST, $keyTest, $keyProd, $algo);

if (! $response->isAuthentified()) {
    // Unauthenticated response received
    die('An error occurred while computing the signature.');
}

$order = get_my_order($response->get('order_id'));

if ($response->isAcceptedPayment()) {
    // update order status, reduce products stock, send customer notifications, ...
    update_my_order($order, 'success');

    // redirect to success page
} elseif ($response->isCancelledPayment()) {
    // redirect to cart page to allow re-order
} else {
     // failed payment logic here
     update_my_order($order, 'failed');

    // redirect to failure or cart page
}

License

Each Lyra payment form API source file included in this distribution is licensed under GNU GENERAL PUBLIC LICENSE (GPL 3.0).

Please see LICENSE file for the full text of the GPL 3.0 license. It is also available through the world-wide-web at this URL: http://www.gnu.org/licenses/.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2023-03-30