Git Product home page Git Product logo

unionpay's Introduction

银联支付

鸣谢

jetbrains.svg

帮助

在集成的过程中有遇到问题,欢迎加 QQ 群 203357977 讨论。

安装

go get github.com/smartwalle/unionpay
import github.com/smartwalle/unionpay

关于错误 x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: insecure algorithm SHA1-RSA (temporarily override with GODEBUG=x509sha1=1)" while trying to verify candidate authority certificate "CFCA TEST OCA1")

由于安全问题,从 Go 1.18 开始,其 crypto/x509 包默认将拒绝使用 SHA-1 哈希函数签名的证书(自签发的除外)。

银联测试环境签发的证书目前使用的是 SHA-1 签名(没有生产环境,无法得知生产环境信息是否也是使用 SHA-1 进行签名)。

解决办法

可以通过设置 GODEBUG=x509sha1=1 环境变量暂时恢复。

GODEBUG=x509sha1=1 go run main.go 

其它支付

支付宝 https://github.com/smartwalle/alipay

苹果支付 https://github.com/smartwalle/apple

PayPal https://github.com/smartwalle/paypal

测试环境

可从 https://open.unionpay.com/tjweb/ij/user/mchTest/param 获取测试环境信息。

示例

https://github.com/smartwalle/unionpay/tree/master/examples 包含一个完整示例。

运行该示例代码之后,可以在浏览器中访问 http://127.0.0.1:9988/unionpay 以打开测试页面。

已实现接口

  • 消费接口-创建网页支付 - CreateWebPayment()
  • 消费接口-创建 App 支付 - CreateAppPayment()
  • 交易状态查询接口 - GetTransaction()
  • 消费撤销接口 - Revoke()
  • 退货接口接口 - Refund()

关于交易状态

在银联系统中,发起消费(支付)、消费撤销(退款)和退货(退款)都会产生交易,都可以通过交易状态查询接口查询相关信息。

退款状态不会在原支付交易中体现。

重要资料

unionpay's People

Contributors

smartwalle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wellcms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.