サンドボックス環境とフィクスチャ

対象: https://api.hiobuy.com(Workers ゲートウェイ)向け統合 — ベース URL は 本番と同一

プラン: 無料プランにはセルフサービスのドキュメントと Sandbox アクセスが含まれます。専任のインテグレーションおよびフルフィルメントサポートは有料プランで利用できます。

認証: 決定論フィクスチャは hio_test_* プレフィックスの API キー(key_type: test)に のみ 適用されます。hio_live_* 本番キー はこのページのルールを 一切 使用せず、常に通常どおり upstream マーケットプレイス / 倉庫にアクセスします。

関連ドキュメント:Authentication · Response format · Errors · Rate limits · Products · Orders · Fulfillment · Webhooks

重要:Warehouse Fulfillment のテスト

Sandbox API(hio_test_*)は、モックおよびフィクスチャベースの結合テスト向けです。

HIOBuy がアプリに WH-DEV Warehouse Developer Code を付与している場合、割り当てられた倉庫設定のテストに Sandbox API キーを使わないでください

次を使用してください:

Production API Key(hio_live_*)+ WH-DEV

WH-DEV は引き続きテスト倉庫設定です。WH-DEV で Production API キーを使っても、本番の倉庫フルフィルメントを行っているわけではありません。

構成目的
hio_test_*モック / フィクスチャ API テスト
hio_live_* + WH-DEVテスト倉庫データでの割当倉庫統合テスト
hio_live_* + 本番倉庫認可本番倉庫フルフィルメント

Sandbox Fulfillment エンドポイントは定義済みまたはシミュレートされたデータを返します。例えば、サンドボックスの倉庫ロケーション、残高、荷物、配送ルート、ステータスは、アプリに割り当てられた WH-DEV 設定と異なる場合があります。

WH-DEV 統合を検証する場合は、常に Production API キーを使用してください。

Public API カバレッジ(概要)

領域サンドボックス
グローバルresponse_format: upstream 拒否(standard のみ)。currency ボディフィールドは prod と同様 拒否sandbox_trigger は test キーで 許可(プラットフォームフィクスチャ)。Channel OAuth は hio_test_*認可済みとして扱うクォータと rate limits は test キーでスキップ
/v1/products/*Search、detail、parse、upload-image、search-by-image、freight estimate、batch-check、1688 analytics エンドポイントは下記どおり モック。本サイト handoff セット外の OpenAPI-only 拡張は モックなし
/v1/orders/*Preview、create、detail、pay、cancel、logistics trace、list、purchase query を magic / dynamic id で モック
/v1/fulfillment/*Balance、quotes、shipments、inbounds、packages、unclaimed、returns、locations、VAS、service-requests、finance を magic / dynamic id で モック(下記参照)。
/v1/support/ticketsList/detail/reply を tkt_* フィクスチャで モック
Webhooksサンドボックスリソースは Webhook を 自動送信しません。ポータルの テスト送信livemode: false)で受信と署名を検証してください。

設計目標

目標意味
再現性同一リクエスト → 同一レスポンス(結果にランダム性なし)。
文書化各シナリオに、このページで grep できる安定 id または keyword。
契約整合JSON は本番 standard スキーマフィールドに一致;値は異なる。
デフォルト happy path未知 id は汎用成功モックにフォールバック。
明示的失敗sb_* id または sandbox_trigger でエラー / エッジ状態を強制。

命名:sb_{domain}_{scenario}

セグメントルール
プレフィックス常に sb_sb_prod_not_found
domain小文字名詞(prodsearchordshppkgplat、…)
scenariosnake_casenot_foundpay_declined

文字:[a-z0-9_]、長さ ≤ ~48。フィクスチャ意図がない限り、実 upstream id に sb_付けない。一部の fulfillment リソースは非 sb_ の安定 id(ret_*ucp_*svc_*tkt_*inv_*)も使用します。

2 層の失敗

トランスポート/API エラーHTTP 200 ビジネス状態 を区別:

  • API 失敗 → HTTP 4xx/5xx + error.code(例:NOT_FOUNDPAYMENT_DECLINED)。
  • HTTP 200 と状態 → 例:variants[].stock = 0status: wait_payment

商品フィクスチャ(概要)

POST /v1/products/detail

Product detail を参照。サンドボックスでは upstream 形式 非対応

id, product_id、解析済み urlmi_idtao_passwordsb_* id に解決されるとトリガー。

Fixture id結果HTTP
(非 sb_ の任意 id)標準モック商品200
sb_prod_not_foundNOT_FOUND404
sb_prod_offlinePRODUCT_UNAVAILABLE422
sb_prod_no_stockDetail ok、stock: 0200
curl https://api.hiobuy.com/v1/products/detail \
  -H "Authorization: Bearer hio_test_..." \
  -H "Content-Type: application/json" \
  -d '{"channel":"1688","product_id":"sb_prod_not_found","language":"ja"}'

POST /v1/products/search

channelkeywordpagepage_sizelanguage が適用。1688 の filter / sort / 価格フィルターは 受理されるがモック行では無視

keyword(完全一致)結果
通常テキストヒット付きモックリスト
sb_search_emptyitems: []total: 0
sb_search_not_found空のエイリアス

Parse / upload-image / search-by-image / freight / analytics

Endpointサンドボックス注記
Parse URLsb_* を含む URL query/path は detail 動作を再現。
Upload image検証通過後、常に { "image_id": "img_sandbox_mock" }
Image search任意 keyword: sb_search_empty で空リスト;フローテストは upload-image と組み合わせ。
Advanced — freight estimateデフォルト国内送料モック 800 minor units、preview と整合。
Advanced — batch-checkmock mpProducts 付き upstream 形式 envelope;除外リストには mi_id/item_idsb_prod_not_found
Advanced — top keywords/list / daily-sales-trend文書化箇所で category_id / rank_idsb_search_empty で空リストまたは 404 detail。

注文・決済フィクスチャ(magic id)

POST /v1/orders/detail

order_id典型的 status備考
sb_ord_unpaidwait_payment
sb_ord_paidwait_shipment
sb_ord_shippedwait_receive
sb_ord_completedcompleted
sb_ord_cancelledcancelled
sb_ord_refundingwait_shipmentrefund_status in progress)
sb_ord_not_found404

POST /v1/orders/pay

order_id結果HTTP
sb_ord_unpaid決済成功 → 論理的 paid 状態200
sb_ord_pay_declinedPAYMENT_DECLINED402
sb_ord_pay_insufficientPAYMENT_INSUFFICIENT_FUNDS402
sb_ord_paidORDER_ALREADY_PAID409
sb_ord_cancelledORDER_CANCELLED409
sb_ord_upstream_timeoutCHANNEL_UPSTREAM_ERROR502

Preview / create

Preview は固定の illustrative 合計(サンプル行 ~4500 + 送料 ~800 minor units)。Createsbo_* プレフィックスの動的 order_id をサンドボックス storage に永続化 — offer_id: sb_prod_offline / sb_prod_no_stock の行は本番セマンティクスどおり 422

Cancel / logistics / list / purchase query

canceltracedetail list に従い:未払い sb_ord_* と動的未払い sbo_* はキャンセル可;paid/shipped 等フィクスチャは ORDER_NOT_CANCELLABLE。Logistics は sb_ord_shipped / completed モックで packages;unpaid/paid-await-shipment は packages: []。購入者リストは空モックで product_name: sb_ord_list_empty を尊重。Purchase query は upstream envelope を返す;not-found 用 pseudo id は適宜省略。

Fulfillment フィクスチャ

注記: 以下のフィクスチャは Sandbox API テスト専用です。アプリの WH-DEV 倉庫設定を表しません。WH-DEV テストには Production API キー(hio_live_*)を使用してください。

下記の全エンドポイントには hio_test_* キーが必要です。create からの動的 id(pkg_*sbs_*sbi_*、…)はキー単位でサンドボックス storage に永続化されます。

Balance · quotes · locations · VAS catalog

Endpointサンドボックス注記
GET /v1/fulfillment/balanceモック利用可能残高 500000 CNY minor units。
POST /v1/fulfillment/shipping/quotesdestination.country_code と重量または寸法が必要;レガシー …/shipments/freight/estimate も動作。
GET /v1/fulfillment/locationsloc_wh_001(威海)、loc_sz_001(深圳、paused)、loc_yw_001(義烏)。
GET /v1/fulfillment/value-added-services安定 CODE 価格表;LEGACY_PHOTO_PRINT は INACTIVE → 要求時は利用不可。

Shipments

Live warehouse Public id is the numeric PK as a string (e.g. "115"); order_sn is the warehouse order number. Sandbox create returns sbs_*; fixtures below use sb_shp_*.

Fixture / idBehavior
sb_shp_unpaidList + detail PENDING; intercept → SHIPMENT_NOT_INTERCEPTABLE
sb_shp_shippedShipped detail: split boxes, first/last-mile legs, packing files; plus international tracking events. Intercept → REQUESTED
sb_shp_not_foundDetail 404
sb_shp_pay_insufficientPOST …/shipments/sb_shp_pay_insufficient/payINSUFFICIENT_BALANCE
sb_shp_not_cancellableCancel → SHIPMENT_NOT_CANCELLABLE; intercept is allowed (WAIT_SHIP)
sb_shp_signedSigned; intercept → SHIPMENT_NOT_INTERCEPTABLE
sb_shp_interceptedDetail SHIPPED + interception.status: INTERCEPTED; intercept again → SHIPMENT_INTERCEPTION_ALREADY_REQUESTED
Dynamic sbs_*Create / pay / list / detail / cancel / intercept against sandbox storage
sb_parcel_not_foundCreate → 422 PARCEL_NOT_FOUND

List path: GET /v1/fulfillment/shipments. Tracking path: GET /v1/fulfillment/shipments/{id}/tracking (language query).

Inbounds(create / cancel)

Create は動的 package_idpkg_*)を返します — 別途の inbound_idありません

Trigger valueFieldHTTPerror.code
sb_inbound_shippedtracking_number409INBOUND_TRACKING_ALREADY_SHIPPED
sb_inbound_existstracking_number409INBOUND_TRACKING_ALREADY_EXISTS
sb_inbound_bad_trackingtracking_number422INVALID_TRACKING_NUMBER
sb_inbound_external_existsexternal_order_id409EXTERNAL_ORDER_ID_ALREADY_EXISTS
sb_vas_missingservices[].service_code422VALUE_ADDED_SERVICE_NOT_FOUND
sb_vas_unavailableservices[].service_code422VALUE_ADDED_SERVICE_UNAVAILABLE
sb_vas_outboundservices[].service_code422VALUE_ADDED_SERVICE_INVALID_STAGE
Cancel idHTTPerror.code
Dynamic sbi_*(create 後)200キャンセル済み;関連 package は破棄
同一 sbi_* の再実行409INBOUND_NOT_EDITABLE
sb_inb_not_found404INBOUND_NOT_FOUND
sb_inb_received409INBOUND_ALREADY_RECEIVED
sb_inb_shipped / sb_inb_consolidated / sb_inb_cancelled409INBOUND_NOT_EDITABLE

Packages · tracking · list

package_idDetail / tracking
Dynamic pkg_*PENDING;tracking は INBOUND_CREATED から開始
sb_pkg_pendingPENDING
sb_pkg_receivedRECEIVED + PHOTO timeline
sb_pkg_exceptionRECEIVED + condition.EXCEPTION
sb_pkg_shippedSHIPPED 完全 outbound timeline
sb_pkg_not_found404 PACKAGE_NOT_FOUND

Unclaimed packages

Id / trigger動作
ucp_01K2ABCDEF1234567890クレーム可能;実追跡番号 SF123456789012(リストはマスク)
ucp_01K2ABCDEF9876543210クレーム可能;YT738800001148
sb_ucp_not_found404 UNCLAIMED_PACKAGE_NOT_FOUND
sb_ucp_already_claimed409 PACKAGE_ALREADY_CLAIMED
sb_ucp_not_claimable409 PACKAGE_NOT_CLAIMABLE
同一 ucp で誤追跡番号 ×5429 CLAIM_ATTEMPTS_EXCEEDED

Returns

Id動作
ret_pending_001PENDING;fee=18;confirm 成功
ret_pending_002PENDING;fee=20;18 で confirm → RETURN_FEE_CHANGED
ret_returned_001RETURNED + tracking
ret_cancelled_001CANCELLED
sb_ret_not_found404 RETURN_NOT_FOUND
sb_ret_fee_not_readyConfirm → RETURN_FEE_NOT_READY
sb_ret_insufficientConfirm → INSUFFICIENT_BALANCE
sb_pkg_shipped 上で Create409 PACKAGE_NOT_RETURNABLE

Service requests

Id動作
svc_photo_completedPHOTO COMPLETED + images
svc_inspection_failedBASIC_INSPECTION FAILED
svc_video_processingVIDEO PROCESSING
svc_reinforce_pendingPACKAGE_REINFORCEMENT PENDING
svc_wooden_awaitingWOODEN_FRAME 確認待ち
sb_svc_not_found404
sb_svc_fee_not_ready / sb_svc_insufficientConfirm エッジケース

Finance(transactions / invoices)

Fixture注記
txn_01K2ABC001006TOP_UP / VAS / RETURN / SHIPPING / REFUND / STORAGE
inv_01K2ABC001ISSUED(ダウンロード可)
inv_01K2ABC002PENDING
inv_01K2ABC003REJECTED

Fulfillment finance を参照。

サポートチケットフィクスチャ

Fixture idシナリオ
tkt_01K2ABCDEF1234567890PACKAGE · NORMAL · WAITING_FOR_HIOBUY
tkt_01K2ABCDEF9876543210RETURN · URGENT · WAITING_FOR_CUSTOMER
tkt_01K2ABCDEFAPIRESOLVEDAPI · NORMAL · RESOLVED
tkt_01K2ABCDEFSHIPCLOSEDSHIPMENT · NORMAL · CLOSED(返信なし)
tkt_not_found404 TICKET_NOT_FOUND

Support tickets を参照。

プラットフォームトリガー:sandbox_trigger

hio_test_*のみ 許可;本番キーはフィールドを静かに無視。

sandbox_triggerHTTPerror.code
sb_plat_quota_exceeded429QUOTA_EXCEEDED
sb_plat_rate_limited429RATE_LIMIT_EXCEEDED
sb_plat_upstream_error502CHANNEL_UPSTREAM_ERROR

現実的な body が検証を通るよう、無害 id と組み合わせ:

{
  "channel": "1688",
  "product_id": "123456",
  "language": "ja",
  "sandbox_trigger": "sb_plat_quota_exceeded"
}

トリガーと組み合わせた特殊 auth フィクスチャ sb_auth_channel_required は、通常の「デフォルト認可済み」ルールにもかかわらず UI 回帰用に CHANNEL_AUTH_REQUIRED403)を返せる。

実装状況スナップショット

フェーズカバレッジ備考
ShippedProducts、調達注文、fulfillment(balance/quotes/shipments/inbounds/packages/unclaimed/returns/locations/VAS/service-requests/finance)、サポートチケット本サイト公開 Public API 部分集合を反映。
Not yet自動送信サンドボックス Webhook;未公開 OpenAPI-only カタログ拡張Webhook CI はポータル テスト送信 を推奨;告知まで全ライブイベントが有効とは仮定しない。

クイックコピーチートシート

sb_prod_not_found          → 404 product missing
sb_prod_offline            → 422 unavailable
sb_prod_no_stock           → 200 detail with zero stock

sb_search_empty            → empty search/items
sb_ord_list_empty          → empty buyer order list filter
img_sandbox_mock           → stable upload-image id

sb_ord_unpaid              → detail wait_payment • pay succeeds • cancel ok
sb_ord_pay_declined        → pay 402 PAYMENT_DECLINED
sb_ord_paid                → pay 409 ALREADY_PAID • trace maybe empty until shipped fixtures
sb_ord_shipped             → detail wait_receive • trace populated
sb_ord_cancelled           → cancelled state • pay conflicts

sb_shp_unpaid / sb_shp_shipped / sb_shp_signed / sb_shp_intercepted → shipment list / detail / intercept
sb_pkg_received / sb_pkg_shipped → package detail / fulfillment timeline
sb_inbound_exists          → inbound create 409 tracking exists
ret_pending_001            → return confirm happy path
ucp_01K2ABCDEF1234567890   → unclaimed claimable
svc_photo_completed        → VAS request completed
tkt_01K2ABCDEF1234567890   → support ticket open

sb_plat_quota_exceeded     → sandbox_trigger → 429 QUOTA_EXCEEDED

内部でフィクスチャ追加時は、この番号体系を回帰テストに反映 — モック内の standard JSON 形状は 決して 変更しない。

Get Support

Need integration help? Contact Developer Support at support@hiobuy.com · Response within 1–2 business days

Email support