GithubHelp home page GithubHelp logo

unionpei's Introduction

UnionPei - 非官方银联支付(UnionPay)SDK


1. 安装
gem 'unionpei'

2. 快速开始(rails)
2.1 指定读取设定的配置文件

# config/initializers/unionpei.rb
UnionPei.configure do |config|
  if Rails.env.production?
    config.acp_sdk_config_path = Rails.root.join('safe/unionpay/acp_production_sdk.ini')
  end
end

2.2 生成支付的页面
参数可参考相关文档,或者源码中payment.rb

class PaymentsController < ApplicationController
  
  # B2C 支付
  def union_b2c_pay
    UnionPei::Payment.b2c({})
    render html: UnionPei::Payment.b2c.html_safe
  end

  # B2B 支付
  def union_b2b_pay
    UnionPei::Payment.b2b({})
    render html: UnionPei::Payment.b2b.html_safe
  end

  # 查询订单详情
  def query_trans
    UnionPei::Payment.query_trans({})
  end
end


3. 参考文档

- 银联测试参数:https://open.unionpay.com/tjweb/user/mchTest/param
- 测试说明:https://open.unionpay.com/tjweb/support/faq/mchlist?id=516
- 证书说明:https://open.unionpay.com/tjweb/support/faq/mchlist?id=21
- API文档:https://open.unionpay.com/tjweb/acproduct/APIList?apiservId=448&acpAPIId=754&bussType=0
- SDK下载:https://open.unionpay.com/tjweb/support/faq/mchlist?id=38
- 测试卡信息:https://open.unionpay.com/tjweb/support/faq/mchlist?id=4
- B2B:https://open.unionpay.com/tjweb/acproduct/list?apiSvcId=452&index=999

4. 免责声明

本Gem对以下非官方代码进行封装和改造:
https://open.unionpay.com/tjweb/support/faq/mchlist?id=38
代码仅供参考学习,生产环境请自行封装代码。

unionpei's People

Contributors

memorycancel avatar tianlu1677 avatar

Stargazers

 avatar

Watchers

 avatar

unionpei's Issues

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.