New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kuaiqian

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kuaiqian

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

快钱

用于支持快钱(http://99bill.com/)支付网关的Rails插件。 演示代码:http://github.com/yzhang/kuaiqian_demo

集成

  1. 修改Gemfile:

gem "kuaiqian"

  1. 生成配置文件:

$ script/rails g kuaiqian

这个命令会在你的应用的config目录创建一个kuaiqian.yml文件,默认是快钱提供的测试帐号(关于测试帐号的使用方法请参看测试章节) 将kuaiqian.yml中的商户ID和密钥替换为快钱提供给你的真实ID和密钥然后进行下一步。

  1. 下面的代码会创建一笔新订单:

@request = Kuaiqian::Request.new('产品名称', # 产品名称 1, # 订单ID,必须全局唯一 Time.now, # 订单生成时间,格式为20091104174132 4500, # 订单金额,以分为单位 'http://return', # 通知地址,用户支付成功后快钱会通过此地址通知商户支付结果 '00', # 支付类型,00显示所有方式,10只显示银行卡方式,11只显示电话银行方式,12只显示快钱帐户支付方式,13只显示线下方式 'attach', #自定义数据,会在返回URL中原样返回 'name') #订单支付人名称 redirect_to @request.url

上面的代码会将用户重定向到快钱的支付页面。

  1. 在用户完成支付后,快钱会调用你在支付请求中提供的返回URL:

@response = Kuaiqian::Response.new(params) if @response.successful? # 支付成功 else # 支付失败 end

注意,快钱可能会多次调用你的返回URL,并将结果展现给用户,因此你的代码要考虑多次执行后的输出对用户的有好度。

测试

要使用快钱提供的测试ID,需要修改你的hosts文件,将快钱的域名指向测试服务器:

218.242.247.5 www.99bill.com

然后使用下面的帐号进行支付:

用户名:kquser02@sina.com 密码:99bill


如果在使用中遇到任何的问题或者建议,欢迎和我联系: zhangyuanyi@gmail.com

Copyright (c) 2009 Yuanyi Zhang, released under the MIT license

FAQs

Package last updated on 04 Jun 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc