doc/quick_start_cn.md in alipay-0.15.1 vs doc/quick_start_cn.md in alipay-0.15.2

- old
+ new

@@ -101,16 +101,16 @@ ```ruby @client.page_execute_url( method: 'alipay.trade.page.pay', return_url: 'https://mystore.com/orders/20160401000000/return', notify_url: 'https://mystore.com/orders/20160401000000/notify', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '20160401000000', product_code: 'FAST_INSTANT_TRADE_PAY', total_amount: '0.01', subject: 'Example #123' - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => 'https://openapi.alipaydev.com/gateway.do?app_id=2016...' ``` #### 值得注意的参数 @@ -139,17 +139,17 @@ ```ruby @client.page_execute_url( method: 'alipay.trade.wap.pay', return_url: 'https://mystore.com/orders/20160401000000/return', notify_url: 'https://mystore.com/orders/20160401000000/notify', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '20160401000000', product_code: 'QUICK_WAP_WAY', total_amount: '0.01', subject: 'Example: 456' quit_url: 'https://mystore.com/orders/20160401000000/' - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => 'https://openapi.alipaydev.com/gateway.do?app_id=2016...' ``` #### 值得注意的参数 * `quit_url` 顾客在移动版支付页面时,支付宝会以这个参数所提供的地址生成一个返回按钮。 @@ -172,15 +172,15 @@ ```ruby # 创建支付订单并取得订单信息 response = @client.execute( method: 'alipay.trade.precreate', notify_url: 'https://mystore.com/orders/20160401000000/notify', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '20160401000000', total_amount: '50.00', subject: 'QR Code Test' - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_trade_precreate_response\":{\"code\"...' # 提取二维码地址 qr_code = JSON.parse(response)["alipay_trade_precreate_response"]["qr_code"] @@ -215,30 +215,30 @@ out_trade_no: '20160401000000', product_code: 'FAST_INSTANT_TRADE_PAY', total_amount: '0.01', subject: 'Example #654', enable_pay_channels: 'balance,pcreditpayInstallment', - extend_params: { + extend_params: JSON.generate({ hb_fq_num: '6'', hb_fq_seller_percent: '0' } - }.to_json(ascii_only: true) + }, ascii_only: true) ) ``` 情景:商城网站不提供分期选项,但允许客户在支付宝的支付过程中自行决定分期付款。 ```ruby @client.page_execute_url( method: 'alipay.trade.page.pay', return_url: 'https://mystore.com/orders/20160401000000/return', notify_url: 'https://mystore.com/orders/20160401000000/notify', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '20160401000000', product_code: 'FAST_INSTANT_TRADE_PAY', total_amount: '0.01', subject: 'Example #654', enable_pay_channels: 'balance,pcreditpayInstallment', - }.to_json(ascii_only: true) + }, ascii_only: true) ) ``` #### 值得注意的参数 * `enable_pay_channels` 这个参数指定用户可使用的付款渠道。 `pcreditpayInstallment` 是分期付款的参数值。可同时指定多个参数值。 * `hb_fq_num` 这个参数指定分期数. 有效的参数值为 `3`,`6`, 和 `12`。 @@ -297,13 +297,13 @@ #### 示例 ```ruby response = @client.execute( method: 'alipay.trade.query', - biz_content: { + biz_content: JSON.generate({ trade_no: '2013112611001004680073956707', - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_trade_query_response\":{\"code\"...' # Get payment status result_status = JSON.parse(response)["alipay_trade_query_response"]["trade_status"] @@ -331,13 +331,13 @@ #### 示例 ```ruby response = @client.execute( method: 'alipay.trade.close', notify_url: 'https://mystore.com/orders/20160401000000/notify', - biz_content: { + biz_content: JSON.generate({ trade_no: '2013112611001004680073956707', - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_trade_close_response\":{\"code\"...' # 取得请求结果代码 result_code = JSON.parse(response)["alipay_trade_close_response"]["code"] @@ -363,13 +363,13 @@ #### 示例 ```ruby response = @client.execute( method: 'alipay.trade.cancel', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '20160401000000', - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_trade_cancel_response\":{\"code\"...' # 取得撤销结果 result_action = JSON.parse(response)["alipay_trade_cancel_response"]["action"] @@ -398,15 +398,15 @@ #### 示例 情景:顾客请求总额为 210.85 元的订单退款 10.12 元。 ```ruby response = @client.execute( method: 'alipay.trade.refund', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '6c50789a0610', out_request_no: '6c50789a0610-1', refund_amount: '10.12' - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_trade_refund_response\":{\"code\"...' # 取得结果 result_code = JSON.parse(response)["alipay_trade_refund_response"]["code"] @@ -436,14 +436,14 @@ #### 示例 ```ruby response = @client.execute( method: 'alipay.trade.fastpay.refund.query', - biz_content: { + biz_content: JSON.generate({ out_trade_no: '6c50789a0610', out_request_no: '6c50789a0610-1' - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_trade_fastpay_refund_query_response\":{\"code\"...' # 取得退款金额 result_refund_amount = JSON.parse(response)["alipay_trade_fastpay_refund_query_response"]["refund_amount"] @@ -471,16 +471,16 @@ #### 示例 ```ruby response = @client.execute( method: 'alipay.fund.trans.toaccount.transfer', - biz_content: { + biz_content: JSON.generate({ out_biz_no: '3142321423432', payee_type: 'ALIPAY_LOGONID', payee_account: 'customer@example.com', amount: '12.23' - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_fund_trans_toaccount_transfer_response\":{\"code\"...' # 取得转帐ID result_order_id = JSON.parse(response)["alipay_fund_trans_toaccount_transfer_response"]["order_id"] @@ -509,12 +509,12 @@ #### 示例 ```ruby response = @client.execute( method: 'alipay.fund.trans.order.query', - biz_content: { + biz_content: JSON.generate({ out_biz_no: '3142321423432', - }.to_json(ascii_only: true) + }, ascii_only: true) ) # => '{\"alipay_fund_trans_order_query_response\":{\"code\"...' # 取得转帐状态 refund_status = JSON.parse(response)["alipay_fund_trans_order_query_response"]["status"]