棒棒玛特 API Reference

Read endpoints are HTTP GET with query string params. Mutating/auth endpoints (/shop/checkout, /shop/orders) are HTTP POST with a JSON body.

常见问题 / FAQ

读接口和写接口有什么区别? 只读接口(GET /shop/productsGET /shop/searchGET /shop/productGET /shop/payGET /shop/order)通过 URL 查询参数传参。写/鉴权接口(POST /shop/checkoutPOST /shop/orders)使用 JSON body 传参,并需要 api_key 字段。

API Key 是什么? API Key 是一个以 sk_ 开头的字符串,用于在结账和订单列表接口中识别用户身份。请访问 /human/account 登录并生成 API Key。

Can I place a multi-item order in a single checkout call? Yes. Pass a items field in the POST /shop/checkout JSON body as a comma-separated string: product_id:qty,product_id:qty (e.g. p_snacks_0001:2,p_snacks_0014:1). Alternatively use product_id + qty for single-item orders.

/shop/products 和 /shop/search 有什么区别? /shop/products 返回完整商品目录,q 为可选过滤,支持按标签、价格、促销筛选,默认按销量排序。/shop/searchq(关键词)为必填参数,专为全文语义搜索设计,支持自动重排序。

如何获取某个分类的所有商品? 使用 GET /shop/products?q=坚果GET /shop/search?q=牛肉干 按关键词搜索,或直接访问分类页面:零食饮品坚果牛肉干特价


GET /shop/products

Browse the product catalog. All params optional.

Example: /shop/products?on_sale=true&price_max=40&sort=price_asc

GET /shop/search

Keyword search across product title, variant, and tags.

Example: /shop/search?q=坚果&price_max=60&on_sale=true

GET /shop/product

Fetch details for a single product.

Example: /shop/product?product_id=p_snacks_0001

POST /shop/checkout

Create an order and get a payment link. Requires api_key.

Request body (JSON or form-encoded):

Examples:

POST /shop/checkout
{"api_key":"sk_...","product_id":"p_snacks_0001","qty":2}

POST /shop/checkout
{"api_key":"sk_...","items":"p_snacks_0001:2,p_snacks_0014:1","note":"办公室分享"}

On success, returns order ID and a payment link (/shop/pay?order_id=ORDER_ID). Present the payment link to the user so they can click it.

GET /shop/pay

Payment page for an order. Present this link to the user after checkout.

Example: /shop/pay?order_id=ord_1a2b3c4d

GET /shop/order

Look up status of any order.

Example: /shop/order?order_id=ord_1a2b3c4d

POST /shop/orders

List all orders for the authenticated viewer. Requires api_key.

Request body (JSON or form-encoded):

Example:

POST /shop/orders
{"api_key":"sk_..."}