Project

jw_alipay

0.0
No commit activity in last 3 years
No release in over 3 years
A gem for alipay, contains mobile payment
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

~> 3.2.8
 Project Readme

JwAlipay¶ ↑

install

gem 'jw_alipay'
bundle install

or

gem install 'jw_alipay'

doc

https://b.alipay.com/order/productDetail.htm?productId=2012120700377308

config(config/alipay.yml)

development:
  # alipay pid http://help.alipay.com/support/help_detail.htm?help_id=243726&sh=Y&tab=null&info_type=9
  partner: '***'
  # alipay key http://help.alipay.com/support/help_detail.htm?help_id=243726&sh=Y&tab=null&info_type=9
  key: ***
  # alipay account
  email: ***

test:
  partner: '***'
  key: ***
  email: ***

production:
  partner: '***'
  key: ***
  email: ***

routes

get "pay/index"
get "pay/pay_call_back"
post "pay/pay_notify"

controller

# encoding: utf-8
class PayController < ApplicationController
  include JwAlipay::WapHelper

  def index
    redirect_to_wap_alipay_gateway(
        :subject => "pay",
        :out_trade_no => '1234567890', :total => 0.01,
        :call_back_url => 'http://domain/pay/pay_call_back',
        :notify_url => 'http://domain/pay/pay_notify',
        :merchant_url => 'http://domain'
    ) do |token|
      puts token
    end
  end

  # call_back_url http://help.alipay.com/support/help_detail.htm?help_id=243126&sh=Y&tab=null&info_type=9
  def pay_call_back
    call_back do |data|
      puts data.inspect
    end
  end

  # notify_url http://help.alipay.com/support/help_detail.htm?help_id=243126&sh=Y&tab=null&info_type=9
  def pay_notify
    notify do |data|
      puts data.inspect
    end
    render :text => 'success'
  end
end