Bigcommerce OAuth2及API开发调试

OAuth2获取Code

(1)跳转Bigcommerce地址:https://login.bigcommerce.com/oauth2/authorize?client_id=55s0zc5yt0x1b70wgnq12cv2r0kid5i&redirect_uri=https://xkgdu.sse.codesandbox.io/auth&response_type=code&scope=store_v2_orders store_v2_products store_v2_transactions store_checkout&context=stores/sw7v0idzxq

(2)Bigcommerce回跳地址:https://xkgdu.sse.codesandbox.io/auth?code=2fdold6490zp84jjgdroma3v8r6k0pe&context=stores/sw7v0idzxq&scope=store_v2_orders store_v2_products store_v2_transactions store_checkout users_basic_information store_v2_default

OAuth2获取Token

POST: https://login.bigcommerce.com/oauth2/token
Content-Type: x-www-form-urlencoded

  • Body
1
client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&code=qr6h3thvbvag2ffq&scope=store_v2_orders&grant_type=authorization_code&redirect_uri=https://app.example.com/oauth&context=stores/{STORE_HASH}
1
2
3
4
5
6
7
client_id: 55s0zc5yt0x1b70wgnq12cv2r0kid5i
client_secret: 85bc36e88750f8c5332f351a6317cab0779b96d43c04f6aa8df66059843c9a6a
redirect_uri: https://xkgdu.sse.codesandbox.io/auth
grant_type: authorization_code
code: 2fdold6490zp84jjgdroma3v8r6k0pe
scope: store_v2_orders store_v2_products store_v2_transactions store_checkout
context: stores/sw7v0idzxq
  • Response
1
2
3
4
5
6
7
8
9
10
{
"access_token": "meyftuf5s36qc8ld2xbaqr46myyc0mb",
"scope": "store_v2_orders store_v2_products store_v2_transactions store_checkout",
"user": {
"id": 1897540,
"username": "test@appblog.cn",
"email": "test@appblog.cn"
},
"context": "stores/sw7v0idzxq"
}

获取订单信息

GET: https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112

  • Header
1
2
X-Auth-Client: 55s0zc5yt0x1b70wgnq12cv2r0kid5i
X-Auth-Token: meyftuf5s36qc8ld2xbaqr46myyc0mb
  • Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0"?>
<order>
<id>112</id>
<customer_id>0</customer_id>
<date_created>Thu, 28 Jan 2021 06:08:41 +0000</date_created>
<date_modified>Thu, 28 Jan 2021 06:29:57 +0000</date_modified>
<date_shipped>Thu, 28 Jan 2021 06:29:12 +0000</date_shipped>
<status_id>11</status_id>
<status>Awaiting Fulfillment</status>
<subtotal_ex_tax>225.0000</subtotal_ex_tax>
<subtotal_inc_tax>225.0000</subtotal_inc_tax>
<subtotal_tax>0.0000</subtotal_tax>
<base_shipping_cost>0.0000</base_shipping_cost>
<shipping_cost_ex_tax>0.0000</shipping_cost_ex_tax>
<shipping_cost_inc_tax>0.0000</shipping_cost_inc_tax>
<shipping_cost_tax>0.0000</shipping_cost_tax>
<shipping_cost_tax_class_id>2</shipping_cost_tax_class_id>
<base_handling_cost>0.0000</base_handling_cost>
<handling_cost_ex_tax>0.0000</handling_cost_ex_tax>
<handling_cost_inc_tax>0.0000</handling_cost_inc_tax>
<handling_cost_tax>0.0000</handling_cost_tax>
<handling_cost_tax_class_id>2</handling_cost_tax_class_id>
<base_wrapping_cost>0.0000</base_wrapping_cost>
<wrapping_cost_ex_tax>0.0000</wrapping_cost_ex_tax>
<wrapping_cost_inc_tax>0.0000</wrapping_cost_inc_tax>
<wrapping_cost_tax>0.0000</wrapping_cost_tax>
<wrapping_cost_tax_class_id>3</wrapping_cost_tax_class_id>
<total_ex_tax>225.0000</total_ex_tax>
<total_inc_tax>225.0000</total_inc_tax>
<total_tax>0.0000</total_tax>
<items_total>1</items_total>
<items_shipped>0</items_shipped>
<payment_method>LianLian Pay</payment_method>
<payment_provider_id>NULL</payment_provider_id>
<payment_status/>
<refunded_amount>0.0000</refunded_amount>
<order_is_digital>false</order_is_digital>
<store_credit_amount>0.0000</store_credit_amount>
<gift_certificate_amount>0.0000</gift_certificate_amount>
<ip_address>60.191.76.226</ip_address>
<geoip_country>China</geoip_country>
<geoip_country_iso2>CN</geoip_country_iso2>
<currency_id>1</currency_id>
<currency_code>CNY</currency_code>
<currency_exchange_rate>1.0000000000</currency_exchange_rate>
<default_currency_id>1</default_currency_id>
<default_currency_code>CNY</default_currency_code>
<staff_notes/>
<customer_message/>
<discount_amount>0.0000</discount_amount>
<coupon_discount>0.0000</coupon_discount>
<shipping_address_count>1</shipping_address_count>
<is_deleted>false</is_deleted>
<ebay_order_id>0</ebay_order_id>
<cart_id>5827fa15-3fda-4fd9-b0de-6c51bd6f0e7b</cart_id>
<billing_address>
<first_name>Joe</first_name>
<last_name>Ye</last_name>
<company>LianLianPay</company>
<street_1>&#x5251;&#x6C60;&#x8857;&#x9053;</street_1>
<street_2/>
<city>LongQuan</city>
<state>ZheJiang</state>
<zip>323700</zip>
<country>China</country>
<country_iso2>CN</country_iso2>
<phone>10086</phone>
<email>yezhou@lianlianpay.com</email>
<form_fields/>
</billing_address>
<is_email_opt_in>false</is_email_opt_in>
<credit_card_type>NULL</credit_card_type>
<order_source>www</order_source>
<channel_id>1</channel_id>
<external_source/>
<products>
<link rel="resource" href="https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112/products">/orders/112/products</link>
</products>
<shipping_addresses>
<link rel="resource" href="https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112/shipping_addresses">/orders/112/shipping_addresses</link>
</shipping_addresses>
<coupons>
<link rel="resource" href="https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112/coupons">/orders/112/coupons</link>
</coupons>
<external_id>NULL</external_id>
<external_merchant_id>NULL</external_merchant_id>
<tax_provider_id>BasicTaxProvider</tax_provider_id>
<customer_locale>en</customer_locale>
<store_default_currency_code>CNY</store_default_currency_code>
<store_default_to_transactional_exchange_rate>1.0000000000</store_default_to_transactional_exchange_rate>
<custom_status>Awaiting Fulfillment</custom_status>
</order>

更新订单状态

PUT: https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112

  • Header
1
2
X-Auth-Client: 55s0zc5yt0x1b70wgnq12cv2r0kid5i
X-Auth-Token: meyftuf5s36qc8ld2xbaqr46myyc0mb
  • Body
1
2
3
{
"status_id": 10
}
  • Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0"?>
<order>
<id>112</id>
<customer_id>0</customer_id>
<date_created>Thu, 28 Jan 2021 06:08:41 +0000</date_created>
<date_modified>Mon, 01 Feb 2021 09:01:43 +0000</date_modified>
<date_shipped>Mon, 01 Feb 2021 09:01:42 +0000</date_shipped>
<status_id>10</status_id>
<status>Completed</status>
<subtotal_ex_tax>225.0000</subtotal_ex_tax>
<subtotal_inc_tax>225.0000</subtotal_inc_tax>
<subtotal_tax>0.0000</subtotal_tax>
<base_shipping_cost>0.0000</base_shipping_cost>
<shipping_cost_ex_tax>0.0000</shipping_cost_ex_tax>
<shipping_cost_inc_tax>0.0000</shipping_cost_inc_tax>
<shipping_cost_tax>0.0000</shipping_cost_tax>
<shipping_cost_tax_class_id>2</shipping_cost_tax_class_id>
<base_handling_cost>0.0000</base_handling_cost>
<handling_cost_ex_tax>0.0000</handling_cost_ex_tax>
<handling_cost_inc_tax>0.0000</handling_cost_inc_tax>
<handling_cost_tax>0.0000</handling_cost_tax>
<handling_cost_tax_class_id>2</handling_cost_tax_class_id>
<base_wrapping_cost>0.0000</base_wrapping_cost>
<wrapping_cost_ex_tax>0.0000</wrapping_cost_ex_tax>
<wrapping_cost_inc_tax>0.0000</wrapping_cost_inc_tax>
<wrapping_cost_tax>0.0000</wrapping_cost_tax>
<wrapping_cost_tax_class_id>3</wrapping_cost_tax_class_id>
<total_ex_tax>225.0000</total_ex_tax>
<total_inc_tax>225.0000</total_inc_tax>
<total_tax>0.0000</total_tax>
<items_total>1</items_total>
<items_shipped>0</items_shipped>
<payment_method>LianLian Pay</payment_method>
<payment_provider_id>NULL</payment_provider_id>
<payment_status/>
<refunded_amount>0.0000</refunded_amount>
<order_is_digital>false</order_is_digital>
<store_credit_amount>0.0000</store_credit_amount>
<gift_certificate_amount>0.0000</gift_certificate_amount>
<ip_address>60.191.76.226</ip_address>
<geoip_country>China</geoip_country>
<geoip_country_iso2>CN</geoip_country_iso2>
<currency_id>1</currency_id>
<currency_code>CNY</currency_code>
<currency_exchange_rate>1.0000000000</currency_exchange_rate>
<default_currency_id>1</default_currency_id>
<default_currency_code>CNY</default_currency_code>
<staff_notes/>
<customer_message/>
<discount_amount>0.0000</discount_amount>
<coupon_discount>0.0000</coupon_discount>
<shipping_address_count>1</shipping_address_count>
<is_deleted>false</is_deleted>
<ebay_order_id>0</ebay_order_id>
<cart_id>5827fa15-3fda-4fd9-b0de-6c51bd6f0e7b</cart_id>
<billing_address>
<first_name>Joe</first_name>
<last_name>Ye</last_name>
<company>LianLianPay</company>
<street_1>&#x5251;&#x6C60;&#x8857;&#x9053;</street_1>
<street_2/>
<city>LongQuan</city>
<state>ZheJiang</state>
<zip>323700</zip>
<country>China</country>
<country_iso2>CN</country_iso2>
<phone>10086</phone>
<email>yezhou@lianlianpay.com</email>
<form_fields/>
</billing_address>
<is_email_opt_in>false</is_email_opt_in>
<credit_card_type>NULL</credit_card_type>
<order_source>www</order_source>
<channel_id>1</channel_id>
<external_source/>
<products>
<link rel="resource" href="https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112/products">/orders/112/products</link>
</products>
<shipping_addresses>
<link rel="resource" href="https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112/shipping_addresses">/orders/112/shipping_addresses</link>
</shipping_addresses>
<coupons>
<link rel="resource" href="https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112/coupons">/orders/112/coupons</link>
</coupons>
<external_id>NULL</external_id>
<external_merchant_id>NULL</external_merchant_id>
<tax_provider_id>BasicTaxProvider</tax_provider_id>
<customer_locale>en</customer_locale>
<store_default_currency_code>CNY</store_default_currency_code>
<store_default_to_transactional_exchange_rate>1.0000000000</store_default_to_transactional_exchange_rate>
<custom_status>Completed</custom_status>
</order>

订单产品列表查询

GET: https://api.bigcommerce.com/stores/sw7v0idzxq/v2/orders/112

  • Header
1
2
X-Auth-Client: 55s0zc5yt0x1b70wgnq12cv2r0kid5i
X-Auth-Token: meyftuf5s36qc8ld2xbaqr46myyc0mb
  • Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0"?>
<products>
<product>
<id>13</id>
<order_id>112</order_id>
<product_id>86</product_id>
<variant_id>66</variant_id>
<order_address_id>13</order_address_id>
<name>[Sample] Able Brewing System</name>
<name_customer>[Sample] Able Brewing System</name_customer>
<name_merchant>[Sample] Able Brewing System</name_merchant>
<sku>ABS</sku>
<upc/>
<type>physical</type>
<base_price>225.0000</base_price>
<price_ex_tax>225.0000</price_ex_tax>
<price_inc_tax>225.0000</price_inc_tax>
<price_tax>0.0000</price_tax>
<base_total>225.0000</base_total>
<total_ex_tax>225.0000</total_ex_tax>
<total_inc_tax>225.0000</total_inc_tax>
<total_tax>0.0000</total_tax>
<weight>1.0000</weight>
<width>10.0000</width>
<height>10.0000</height>
<depth>10.0000</depth>
<quantity>1</quantity>
<base_cost_price>0.0000</base_cost_price>
<cost_price_inc_tax>0.0000</cost_price_inc_tax>
<cost_price_ex_tax>0.0000</cost_price_ex_tax>
<cost_price_tax>0.0000</cost_price_tax>
<is_refunded>false</is_refunded>
<quantity_refunded>0</quantity_refunded>
<refund_amount>0.0000</refund_amount>
<return_id>0</return_id>
<wrapping_name/>
<base_wrapping_cost>0.0000</base_wrapping_cost>
<wrapping_cost_ex_tax>0.0000</wrapping_cost_ex_tax>
<wrapping_cost_inc_tax>0.0000</wrapping_cost_inc_tax>
<wrapping_cost_tax>0.0000</wrapping_cost_tax>
<wrapping_message/>
<quantity_shipped>0</quantity_shipped>
<event_name>NULL</event_name>
<event_date/>
<fixed_shipping_cost>0.0000</fixed_shipping_cost>
<ebay_item_id/>
<ebay_transaction_id/>
<option_set_id>NULL</option_set_id>
<parent_order_product_id>NULL</parent_order_product_id>
<is_bundled_product>false</is_bundled_product>
<bin_picking_number/>
<external_id>NULL</external_id>
<fulfillment_source/>
<applied_discounts/>
<product_options/>
<configurable_fields/>
</product>
</products>