Gem alipay gem 的一些问题

sunshineboy · May 06, 2017 · Last by jasl replied at May 06, 2017 · 2592 hits

移动支付接口

Name

https://github.com/chloerei/alipay

mobile.securitypay.pay

Definition

Alipay::Mobile::Service.mobile_securitypay_pay_string({ARGUMENTS}, {OPTIONS})

Example

Alipay::Mobile::Service.mobile_securitypay_pay_string( out_trade_no: '20150401000-0001', notify_url: 'https://example.com/orders/20150401000-0001/notify' subject: 'subject', total_fee: '10.00', body: 'text' )

=> service="mobile.securitypay.pay"&_input_charset="utf-8"&partner=...

话说下面的 zip 链接已经实效了,谁能给个包,感谢@REI

Alipay 的接口已经大面积更新,这个 gem 稍显落后

能给个比较新的 alipay github 地址吗谢谢

没有。我 clone 过 rei 这个修改过,没有弄完,近期没有支付需求要做。你可以先 clone 下来自己改改,或者将就用用支付宝废弃的接口。

我只想要这个 zip 包。地址实效了哎

目前参数 Alipay.key = Base64.decode64(privatekey) Alipay.pid = "#{result[:partner]}"
Alipay.sign_type = 'RSA' content = Alipay::Mobile::Service.mobile_securitypay_pay_string( seller_id: "#{result[:seller_id]}", out_trade_no: "#{result[:out_trade_no]}", subject: "#{result[:subject]}", body: "#{result[:body]}", total_fee: "#{result[:total_fee]}", notify_url: "#{result[:notify_url]}", it_b_pay: "#{result[:it_b_pay]}", sign_type: "#{result[:sign_type]}" )

Alipay.key = Base64.decode64(privatekey)
        Alipay.pid = "#{result[:partner]}"      
        Alipay.sign_type = 'RSA'
        content = Alipay::Mobile::Service.mobile_securitypay_pay_string(
            seller_id: "#{result[:seller_id]}",
          out_trade_no: "#{result[:out_trade_no]}",
          subject: "#{result[:subject]}",
          body: "#{result[:body]}",
          total_fee: "#{result[:total_fee]}",
          notify_url: "#{result[:notify_url]}",
          it_b_pay: "#{result[:it_b_pay]}",
          sign_type: "#{result[:sign_type]}"
        )

我不知道 show_url 要不要

@Rei 到底有几个参数需要传递。帮忙看下

文档写的就是最简例子 https://github.com/chloerei/alipay#mobileservice

你为什么要把 privatekey decode64?

Reply to Rei

私钥是要pkcs8还是要pkcs1,你看我下面写的可以用吗

Alipay.key = File.read("#{Rails.root}/rsa_private_key_1.pem")
Alipay.pid = "#{result[:partner]}"
Alipay.sign_type = 'RSA'
        content = Alipay::Mobile::Service.mobile_securitypay_pay_string(
            seller_id: "#{result[:seller_id]}",
          out_trade_no: "#{result[:out_trade_no]}",
          subject: "#{result[:subject]}",
          body: "#{result[:body]}",
          total_fee: "#{result[:total_fee]}",
          notify_url: "#{result[:notify_url]}",
          it_b_pay: "#{result[:it_b_pay]}",
          show_url: "#{result[:show_url]}",
          sign_type: "#{result[:sign_type]}"
        )
Reply to sunshineboy

不知道,这个模块不是我写的,我也没有权限调用。API 有没有被弃用都不知道。

建议看新的文档自己调 API。

Reply to Rei

新的文档知道的话给个链接谢谢,我自己看 api👌

Reply to Rei

👍 又学会一招!

那个接口我贡献的,要大客户才可以有,就是那种阿里主动来联系你们的那种...

所以不要被函数名误导... 现在做没作废不道了 不做这块了

Reply to jasl

大客户好!

Reply to martin91

我也算是享受过了...集成方面阿里给专门配专员的...

You need to Sign in before reply, if you don't have an account, please Sign up first.