lightools/payu 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

lightools/payu

Composer 安装命令:

composer require lightools/payu

包简介

Simple PayU client for online payments with automatic confirmations enabled.

README 文档

README

This library provides API for the simplest possible online payment via PayU where automatic payment confirmation is enabled.

Installation

$ composer require lightools/payu

Simple usage

// 1. redirect to payment gate
$httpClient = new Bitbang\Http\Clients\CurlClient();
$xmlLoader = new Lightools\Xml\XmlLoader();
$payu = new Lightools\PayU\PayU($posId, $posAuthKey, $key1, $key2, $httpClient, $xmlLoader);
$payment = new Lightools\PayU\NewPayment(
    $orderId, // your order identification
    $priceAmount, // in crowns (not in hellers)
    PayU::CHANNEL_TEST,
    $paymentDescription,
    $clientFirstname,
    $clientSurname,
    $clientEmail
);

$ipAddress = $_SERVER['REMOTE_ADDR'];
$redirectUrl = $payu->getRedirectUrl($payment, $ipAddress);

header("Location: $redirectUrl");
exit();

// 2. accept payment update (on "UrlOnline")
try {
    $post = filter_input_array(INPUT_POST);
    $status = $payu->getPaymentStatus($post);

    $status->getOrderId();
    $status->getStatus(); // e.g. PaymentStatus::STATUS_PAID

    echo 'OK';
    exit();

} catch (InvalidRequestException $ex) {
    // invalid request received (e.g. some data missing)

} catch (InvalidSignatureException $ex) {
    // invalid signature in request or response

} catch (RequestFailedException $ex) {
    // HTTP request to PayU failed
}

How to run tests

$ vendor/bin/tester tests

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固