Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
Tenpay ====== A Ruby on Rails plugin for Tenpay (Online pay solution from Tencent). Install ======= $ script/plugin install git://github.com/yzhang/tenpay.git Charge ======= 1. After you installing the plugin, there should be a tenpay.yml in your RAILS_ENV/config dir, you should edit that file and set your spid and key you got from Tencent. 2. To start a transaction, you will need create a new Tenpay::Request instance, for example: @request = Tenpay::Request.new('test product', # Product name 1, # Order id, should be unique 4500, # Product price, in cent 'http://return', # Url user will return after the transaction, support Get/Post request.remote_ip, # Use for ip validation, ignored in development mode. 'attach data') # Attach data, will be pass to the return url. redirect_to @request.url This will redirect user to pay page. 3. After user finishing the paying, the return url will be called, below code will demo if the request is legal and user finish the paying. @response = Tenpay::Response.new(params) if @response.successful? # paying is successful else # it's failed end Query ======== If you want to query if user has paid for an order, use below interface: @query = Tenpay::Query.new(1, # Order id Time.now) # Order date @query.response.successful? # true => paid, false => unpaid. It's all, feedbacks are always welcome, feel free to contact me at email@example.com Copyright (c) 2009 Yuanyi Zhang, released under the MIT license