All Projects → zhangv → union-pay

zhangv / union-pay

Licence: MIT license
simplest union pay(银联支付)

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to union-pay

Alipay kit
flutter版支付宝登录/支付
Stars: ✭ 140 (+337.5%)
Mutual labels:  pay
WHMCS-JSJ-API-Pay-Gateway
WHMCS 财务系统对接金莎云免签支付API(你们怎么用,与我无瓜好吧:)
Stars: ✭ 58 (+81.25%)
Mutual labels:  pay
mollie-api-go
Golang wrapper for Mollie's REST API with full resource coverage.
Stars: ✭ 45 (+40.63%)
Mutual labels:  pay
Pay Java Parent
第三方支付对接全能支付Java开发工具包.优雅的轻量级支付模块集成支付对接支付整合(微信,支付宝,银联,友店,富友,跨境支付paypal,payoneer(P卡派安盈)易极付)app,扫码,网页刷脸付刷卡付条码付转账服务商模式,微信分账,微信合单支付、支持多种支付类型多支付账户,支付与业务完全剥离,简单几行代码即可实现支付,简单快速完成支付模块的开发,可轻松嵌入到任何系统里 目前仅是一个开发工具包(即SDK),只提供简单Web实现,建议使用maven或gradle引用本项目即可使用本SDK提供的各种支付相关的功能
Stars: ✭ 2,025 (+6228.13%)
Mutual labels:  pay
Oneqrcode
📱 微信、支付宝、QQ 三合一收款二维码(单文件版)
Stars: ✭ 233 (+628.13%)
Mutual labels:  pay
credit-card-prompt
Credit card prompt with validation and address lookup
Stars: ✭ 13 (-59.37%)
Mutual labels:  pay
Best Pay Demo
best-pay-sdk demo
Stars: ✭ 120 (+275%)
Mutual labels:  pay
scala-3-crash-course
Scala 3 workshop presenting the top new features of the language.
Stars: ✭ 34 (+6.25%)
Mutual labels:  union
Pay Gateway
pay gateway. support alipay,wechatpay,unionpay,jdpay etc.
Stars: ✭ 247 (+671.88%)
Mutual labels:  pay
BDB-Frame-API
Frame API -开箱即用(封装函数、服务类、api ...)等等一系列功能案例,可以ctrl+c/v & 拿去使用 (免费)。如有问题,社区联系交流即可。
Stars: ✭ 163 (+409.38%)
Mutual labels:  pay
Priest
dubbo mybatis springboot base soa rest api framework with customer code generator
Stars: ✭ 160 (+400%)
Mutual labels:  pay
Best Pay Sdk
可能是最好的支付SDK
Stars: ✭ 2,651 (+8184.38%)
Mutual labels:  pay
alipay kit
flutter版支付宝登录/支付
Stars: ✭ 240 (+650%)
Mutual labels:  pay
Gochat
🔥 微信 Go SDK 🚀🚀🚀
Stars: ✭ 141 (+340.63%)
Mutual labels:  pay
omnipay-unionpay
UnionPay driver for the Omnipay PHP payment processing library
Stars: ✭ 111 (+246.88%)
Mutual labels:  unionpay
Dwwxpay
微信支付/订单查询
Stars: ✭ 122 (+281.25%)
Mutual labels:  pay
web-monetized-video
experimenting with web monetisation API
Stars: ✭ 15 (-53.12%)
Mutual labels:  pay
CoinHive
A nice friendly simple and easly customizable GUI for coinhives javascript miner to embed onto websites so users of your site can interact with features of the miner on every single page this javascript miner is to help those who have problems with advertisements/advertising/ads popups banners mobile redirects malvertising/malware etc and provid…
Stars: ✭ 58 (+81.25%)
Mutual labels:  pay
copanier
A minimalist collective buying software.
Stars: ✭ 19 (-40.62%)
Mutual labels:  pay
typescript-cheatsheet
Cheatsheet for TypeScript.
Stars: ✭ 28 (-12.5%)
Mutual labels:  union

UnionPay - 银联支付

Latest Stable Version License Build Status codecov

simplest union pay - no dependency to any library, simple enough to let you hack.

Feature

Install

composer require zhangv/union-pay

or

add:

"zhangv/union-pay":"0.8.12"

in composer.json

Step 1: config.php - 配置

return ['test', [
		'version' => '5.1.0',
		'signMethod'=> '01', //RSA
		'encoding' => 'UTF-8',
		'merId' => '700000000000001',
		'returnUrl' => 'http://dev.git.com/union-pay/demo/payreturn.php', //前台网关支付返回
		'notifyUrl' => 'http://dev.git.com/union-pay/demo/paynotify.php', //后台通知
		'frontFailUrl'   => 'http://dev.git.com/union-pay/demo/payfail.php',
		'refundnotifyUrl' => 'http://dev.git.com.com/union-pay/demo/refundnotify.php',
		'signCertPath' => dirname(__FILE__).'/../cert/acp_test_sign.pfx',
		'signCertPwd' => '000000', //签名证书密码
		'verifyCertPath' => dirname(__FILE__).'/../cert/acp_test_verify_sign.cer',  //v5.0.0 required
		'verifyRootCertPath' => dirname(__FILE__).'/../cert/acp_test_root.cer', //v5.1.0 required
		'verifyMiddleCertPath' => dirname(__FILE__).'/../cert/acp_test_middle.cer', //v5.1.0 required
		'encryptCertPath' => dirname(__FILE__).'/../cert/acp_test_enc.cer',
		'ifValidateCNName' => false, //正式环境设置为true
	]
];

Step 2: pay.php - 支付

<?php

list($mode,$config) = include './config.php';
$unionPay = UnionPay::B2C($config,$mode);

$payOrderNo = date('YmdHis');
$amt = 1;

$html = $unionPay->pay($payOrderNo,$amt);
echo $html;

Step 3: payreturn.php - 支付完成前台返回

<?php

list($mode,$config) = include './config.php';
$unionPay = UnionPay::B2C($config,$mode);

$postdata = $_REQUEST;
$unionPay->onPayNotify($postdata,function($notifydata){
	echo 'SUCCESS';
	var_dump($notifydata);
});

Step 4: paynotify.php - 支付完成后台通知

<?php
list($mode,$config) = include './config.php';
$unionPay = UnionPay::B2C($config,$mode);

$notifyData = $_POST;
$respCode = $notifyData['respCode'];
if($respCode == '00'){
	$unionPay->onNotify($notifyData,'demoCallback');
}elseif(in_array($respCode,['03','04','05'])){
	//后续需发起交易状态查询交易确定交易状态
}else{
	echo 'fail';
}


function demoCallback($notifyData){//自定义回调
	var_dump($notifyData);
	print('ok');
}

FAQ

  • 关于测试环境:有时候会报验签错误,一般的原因是证书错误或者参数拼接,如果确认二者没错,那么可能是因为你的商户号在银联测试环境中不生效,这种时候需要联系银联的客服。也可以直接用生产环境的证书测试交易,如果可以正常交易,那么测试交易这步也可以不做。
  • 关于测试用例:目前的测试用例依赖银联的测试环境,但并不是很稳定,经常会有返回错误的情况。后续可能考虑改成模拟数据。
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].