payuni/sdk

v1.2.3 2024-09-16 09:46 UTC

This package is auto-updated.

Last update: 2024-09-16 09:47:07 UTC


README

环境需求

  • PHP:^7.1 || ^8.0

安装

请使用Composer进行安装

composer require payuni/sdk

使用方法

  • 正式环境
$payuniApi = new \Payuni\Sdk\PayuniApi($merKey, $merIV);
  • 测试环境
$payuniApi = new \Payuni\Sdk\PayuniApi($merKey, $merIV, $type);
  • API集成
$result = $payuniApi->UniversalTrade($encryptInfo, $mode, $version);
  • upp ReturnURL、NotifyURL接收返回参数后的处理方式
$result = $payuniApi->ResultProcess($requestData);
  • 参数说明

    $encryptInfo = [
              'MerID' => 'ABC',
              'Timestamp' => time(),
              ...
          ];
    • 若要使用代理商功能,请将encryptInfo中添加IsPlatForm参数,并设置为1
    $encryptInfo = [
              'IsPlatForm' => 1,
              'MerID' => 'ABC',
              'Timestamp' => time(),
              ...
          ];
    • $merKey
      • 请登录PAYUNi平台查看商店集成信息获取Hash Key
    • $merIV
      • 请登录PAYUNi平台查看商店集成信息获取Hash IV
    • $type (非必填)
      • 连接测试环境 => t
      • 连接正式环境 => 不提供该参数或提供空值
    • $mode
      • 集成支付页面 => upp
      • 虚拟账户后台 => atm
      • 便利店后台 => cvs
      • 信用卡后台 => credit
      • 交易查询 => trade_query
      • 交易请退款 => trade_close
      • 交易取消授权 => trade_cancel
      • 信用卡Token(约定) => credit_bind_query
      • 信用卡Token取消(约定/记忆卡号) => credit_bind_cancel
      • 爱金卡退款(ICASH) => trade_refund_icash
      • 后支付退款(AFTEE) => trade_refund_aftee
    • $version (非必填)
      • 所调用API的版本号,默认1.0
      • 若需调用其他版本号,请提供字符串,例如 $payuni->UniversalTrade($encryptInfo, 'trade_query','2.0');,而不是数字或浮点数
      • 若需调用新版本号,请参考统一金流API集成文件对应功能请求参数的Version备注
  • 其余请参考示例

  • 原生php

    • your file path => 请自行填写程序放置的路径
namespace Payuni\Sdk;
require_once('<your file path>/PayuniApi.php');
$merKey = '12345678901234567890123456789012';
$merIV  = '1234567890123456';
$payuni = new PayuniApi($merKey, $merIV);

$encryptInfo = [
    'MerID' => 'ABC',
    'TradeNo'   => '16614190477810373246',
    'Timestamp' => time()
];
$result = $payuni->UniversalTrade($encryptInfo, 'trade_query');

LICENSE

Copyright 2022 PRESCO. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://apache.ac.cn/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.