可以使用BigCommerce的Checkout API来获取订单中的完整付款方式列表。以下是示例代码:
import requests
import json
# 获取access token
client_id = "your_client_id"
client_secret = "your_client_secret"
store_hash = "your_store_hash"
auth_url = f"https://login.bigcommerce.com/oauth2/token?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials&scope=store_v2_products store_v2_order_transactions"
auth_resp = requests.post(auth_url).json()
access_token = auth_resp['access_token']
# 获取订单付款方式列表
order_id = "12345" # 订单ID
url = f"https://api.bigcommerce.com/stores/{store_hash}/v2/checkouts/{order_id}/payment_methods"
headers = {"Content-Type": "application/json", "X-Auth-Token": access_token}
response = requests.get(url, headers=headers)
payment_methods = json.loads(response.text)
# 输出付款方式列表
print(payment_methods)
注意替换示例代码中的client_id
、client_secret
和store_hash
等参数,并传入正确的订单ID。该代码将返回完整的付款方式列表,包括所支持的所有付款方式,包括其他使用REST API无法获取的付款方式。