支付宝支付相关

支付宝支付相关开发,需要先开通即时到账功能,由于notify_url不一定收到,所有如果需要主动查询订单状态还需要申请对接到账接口。

notify_url 必须是post请求

  def forward
    raw_url = params[:raw_url]
    if !raw_url.present?
      render text: 'empty raw url'
    end
    agent = Mechanize.new
    agent.post(URI.decode(raw_url), params)
    render :text => 'success'
  end


    notify_url = notify_hao_alipay_orders_url(host: Rails.env.production? ? host : "www.wode520.com")
    if Rails.env.production?
      notify_url = URI.escape(notify_url)
    else
      notify_url = URI::HTTP.build([nil,'www.cn.jobs',nil,"/hao/auth/forward",{raw_url: notify_url}.to_param,nil]).to_s
    end

猜你喜欢

转载自zhangcaiyanbeyond.iteye.com/blog/2195772