Code Monkey home page Code Monkey logo

jw_alipay's Introduction

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

jw_alipay's People

Contributors

fangzhu19880123 avatar

Watchers

 avatar

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.