alipay2

所属分类:支付接口
开发工具:Ruby
文件大小:0KB
下载次数:0
上传日期:2021-02-03 09:05:29
上 传 者sh-1993
说明:  支付宝2,,
(alipay2,,)

文件列表:
Gemfile (38, 2021-02-03)
LICENSE (1068, 2021-02-03)
Rakefile (173, 2021-02-03)
alipay.gemspec (676, 2021-02-03)
lib/ (0, 2021-02-03)
lib/alipay2.rb (403, 2021-02-03)
lib/alipay2/ (0, 2021-02-03)
lib/alipay2/config.rb (465, 2021-02-03)
lib/alipay2/notify.rb (118, 2021-02-03)
lib/alipay2/service.rb (2044, 2021-02-03)
lib/alipay2/service/ (0, 2021-02-03)
lib/alipay2/service/api.rb (1534, 2021-02-03)
lib/alipay2/service/app.rb (737, 2021-02-03)
lib/alipay2/service/auth.rb (1696, 2021-02-03)
lib/alipay2/service/page.rb (908, 2021-02-03)
lib/alipay2/sign.rb (1324, 2021-02-03)
lib/alipay2/sign/ (0, 2021-02-03)
lib/alipay2/sign/rsa.rb (410, 2021-02-03)
lib/alipay2/sign/rsa2.rb (491, 2021-02-03)
lib/alipay2/utils.rb (1049, 2021-02-03)
lib/alipay2/version.rb (37, 2021-02-03)
test/ (0, 2021-02-03)
test/alipay/ (0, 2021-02-03)
test/alipay/notify_test.rb (1053, 2021-02-03)
test/alipay/service/ (0, 2021-02-03)
test/alipay/service/open_test.rb (206, 2021-02-03)
test/alipay/service_test.rb (11534, 2021-02-03)
test/alipay/sign/ (0, 2021-02-03)
test/alipay/sign/md5_test.rb (492, 2021-02-03)
test/alipay/sign/rsa_test.rb (657, 2021-02-03)
test/alipay/sign_test.rb (964, 2021-02-03)
test/alipay/utils_test.rb (318, 2021-02-03)
test/alipay_test.rb (141, 2021-02-03)
test/test_helper.rb (1409, 2021-02-03)

# Alipay2 A unofficial alipay ruby gem. Alipay2 official document: https://doc.open.alipay.com/. ## Installation Add this line to your application's Gemfile: ```ruby gem 'alipay2', '~> 1.0.beta' ``` And then execute: ```console $ bundle ``` ## Configuration ```ruby Alipay2.pid = 'YOUR_PID' Alipay2.key = 'YOUR_KEY' #Alipay2.sign_type = 'MD5' # Available values: MD5, RSA. Default is MD5 #Alipay2.sandbox = true # Enable parameter check. Default is true. ``` You can set default key, or pass a key directly to service method: ```ruby Service.create_partner_trade_by_buyer_url({ out_trade_no: 'OUT_TRADE_NO', # Order params... }, { pid: 'ANOTHER_PID', key: 'ANOTHER_KEY', }) ``` ## menu 1. 电脑网站支付(即时到账) 文档[链接](https://doc.open.alipay.com/doc2/detail.htm?treeId=62&articleId=103566&docType=1) * [即时到账交易接口](#即时到账交易接口) * [即时到账有密退款接口](#即时到账有密退款接口) 2. 手机网站支付 * [手机网站支付接口](#手机网站支付接口) 3. 通用 * [交易查询接口] * [交易关闭接口] * [交易退款接口] * [交易退款查询接口] * [查询账单下载地址接口] ## Service ### 即时到账交易接口 * 接口名称:`create_direct_pay_by_user` * 文档:[链接](https://doc.open.alipay.com/docs/doc.htm?treeId=62&articleId=104743&docType=1) | Key | Requirement | Description | | --- | --- | --- | | out_order_no | required | Order id in your application. | | subject | required | Order subject. | | total_fee | required | Order’s total fee. | | return_url | optional | Redirect customer to this url after payment. | | notify_url | optional | Alipay2 asyn notify url. | ```ruby # Usage Alipay2::Service.create_direct_pay_by_user_url(arguments, options = {}) # Example Alipay2::Service.create_direct_pay_by_user_url( out_trade_no: '20150401000-0001', subject: 'Order Name', total_fee: '10.00', return_url: 'https://example.com/orders/20150401000-0001', notify_url: 'https://example.com/orders/20150401000-0001/notify' ) ``` ### 即时到账有密退款接口 https://doc.open.alipay.com/docs/doc.htm?treeId=62&articleId=104744&docType=1 接口名称:refund_fastpay_by_platform_pwd #### Arguments | Key | Requirement | Description | | --- | --- | --- | | batch_no | required | Refund batch no, you should store it to db to avoid alipay duplicate refund. | | data | required | Refund data, a hash array. | | notify_url | required | Alipay2 notify url. | ##### Data Item | Key | Requirement | Description | | --- | --- | --- | | trade_no | required | Trade number in alipay system. | | amount | required | Refund amount. | | reason | required | Refund reason. Less than 256 bytes, could not contain special characters: ^ $ | #. | #### Example ```ruby # Usage example batch_no = Alipay2::Utils.generate_batch_no # refund batch no, you SHOULD store it to db to avoid alipay duplicate refund Alipay2::Service.refund_fastpay_by_platform_pwd_url( batch_no: batch_no, data: [{ trade_no: '201504010000001', amount: '10.0', reason: 'REFUND_REASON' }], notify_url: 'https://example.com/orders/20150401000-0001/refund_notify' ) # Return # https://mapi.alipay.com/gateway.do?service=refund_fastpay_by_platform_pwd&... ``` ### 验证通知 ```ruby # Rails # params except :controller_name, :action_name, :host, etc. notify_params = params.except(*request.path_parameters.keys) Alipay2::Wap::Notify.verify?(notify_params) ``` ## Contributing Bug report or pull request are welcome. ### Make a pull request 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request Please write unit test with your code if necessary.

近期下载者

相关文件


收藏者