doc/quick_start_en.md in alipay-0.15.1 vs doc/quick_start_en.md in alipay-0.15.2
- old
+ new
@@ -99,16 +99,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...'
```
#### Notable Parameters
@@ -141,17 +141,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...'
```
#### Notebale Parameters
* `quit_url` is where Alipay will redirect customer to if the customer have completed the payment or have exited the payment process. This redirect only applies to the mobile html verison. This is an *optional* parameter.
@@ -175,15 +175,15 @@
```ruby
# Create a QR code based payment
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\"...'
# Get payment url to render as QR code for customer
qr_code = JSON.parse(response)["alipay_trade_precreate_response"]["qr_code"]
@@ -212,36 +212,36 @@
```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',
extend_params: {
hb_fq_num: '6'',
hb_fq_seller_percent: '0'
}
- }.to_json(ascii_only: true)
+ }, ascii_only: true)
)
```
Scenario: Customer select an installment plan or their choice at Alipay's payment page.
```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)
)
```
#### Notebale Parameters
* `enable_pay_channels` defines the funding methods that the customer can use to
pay for your order. `pcreditpayInstallment` is the value to enable installment plans. Mutiple
@@ -311,13 +311,13 @@
#### Example
```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"]
@@ -348,13 +348,13 @@
#### Example
```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\"...'
# Get request result
result_code = JSON.parse(response)["alipay_trade_close_response"]["code"]
@@ -386,13 +386,13 @@
#### Example
```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\"...'
# Get cancellation result
result_action = JSON.parse(response)["alipay_trade_cancel_response"]["action"]
@@ -423,15 +423,15 @@
#### Example
Secenario: Customer request refund on a ¥10.12 item on a ¥210.85 order(payment).
```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\"...'
# Get result
result_code = JSON.parse(response)["alipay_trade_refund_response"]["code"]
@@ -466,14 +466,14 @@
#### Example
```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\"...'
# Get refund amount
result_refund_amount = JSON.parse(response)["alipay_trade_fastpay_refund_query_response"]["refund_amount"]
@@ -504,16 +504,16 @@
#### Example
```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\"...'
# Get order ID
result_order_id = JSON.parse(response)["alipay_fund_trans_toaccount_transfer_response"]["order_id"]
@@ -546,12 +546,12 @@
#### Example
```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\"...'
# Get refund_status
refund_status = JSON.parse(response)["alipay_fund_trans_order_query_response"]["status"]