注文内容更新
指定した注文の価格、数量、送料、クーポン割引、金額調整を一括で設定します。
lines、shipping_lines、amounts はすべて必須です。
更新には、次の制約があります。
- 数量を
0にした明細はキャンセルされます。すべての明細を0にはできません。 - 明細ごとに送料を設定する注文では、正数の明細送料を
0に変更できません。 - 既存の金額調整は、
0に変更して解除できません。
更新すると、変更前後の注文金額が同じ場合も、ショップおよび購入者へ注文金額の変更を知らせるメールを送信します。 決済手段や注文状態によっては、決済金額の変更なども行います。
更新後の注文を取得できた場合は 200、更新は成功したものの注文を取得できない場合は 204 を返します。
204 の場合は同じリクエストを再送しないでください。
5xx の場合は更新の成否を確定できないため、再送せずに GET /api/orders/{unique_key} で状態を確認してください。
リクエスト例
curl
curl -X PUT "https://apiv2.thebase.com/api/orders/<unique_key>" \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{
"lines": [
{
"id": 0,
"price": 0,
"amount": 0,
"shipping_fee": 0,
"options": []
}
],
"shipping_lines": [
{
"order_line_ids": [],
"shipping_fee": 0
}
],
"amounts": {
"shipping_fee": 0,
"coupon_discount": {
"amount": 0
},
"adjustment": {
"amount": 0
}
}
}'
パラメータ
unique_key
OrderUniqueKey · path
必須
注文の一意キー(16 桁の半角英数字)。小文字は大文字として扱います。
リクエストボディ application/json
- linesOrderUpdateLine[]必須更新可能な注文明細の一覧。更新可能な注文明細をすべて指定する必要があります。
- idinteger必須≥ 0注文取得レスポンスの lines[].id に対応する注文明細 ID
- priceinteger必須≥ 0商品単価(円、0 以上)
- amountinteger必須≥ 0購入数量。0 を指定するとその明細をキャンセルします。注文全体を 0 件にはできません。
- shipping_feeinteger必須≥ 0明細ごとの送料(円、0 以上)。明細ごとに送料を設定する注文では、現在値が正数の場合は 0 に変更できません。
- optionsOrderUpdateLineOption[]必須この明細に紐づく注文オプションの一覧。すべての注文オプションを指定する必要があります。無い場合は空配列です。
- option_idinteger必須≥ 0注文取得レスポンスの lines[].options[].option_id に対応する注文オプション ID
- priceinteger必須≥ 0オプション単価(円、0 以上)
- shipping_linesOrderUpdateShippingLine[]必須サイズ別配送ラインの一覧。すべての配送ラインを指定する必要があります。利用しない注文は空配列です。
- order_line_idsinteger[]必須この配送ラインに含まれる注文明細 ID。注文取得レスポンスの shipping_lines[].order_line_ids に対応します。
- shipping_feeinteger必須≥ 0この配送ラインの送料(円、0 以上)
- amountsOrderUpdateAmounts必須
- shipping_feeinteger必須≥ 0注文全体の送料(円、0 以上)
- coupon_discountOrderUpdateCouponDiscount必須
- amountinteger必須≥ 0クーポン割引額(円)。割引なしは 0 です。
- adjustmentOrderUpdateAmountAdjustment必須
- amountinteger必須≤ 0金額調整(円)。値引きは負数、調整なしは 0 です。既存の金額調整は 0 に変更して解除できません。
レスポンス
200
更新成功。更新後の注文を返します。
204
更新成功。更新後の注文を取得できないため、レスポンス本文は返しません。
200 のレスポンスボディ(application/json):
- unique_keystring必須注文の一意キー。注文詳細の取得に使う識別子です。
- statusstring必須注文状態を表す文字列。値は固定された列挙ではありません。現在の仕様で返る主な値は 'ordered'(発送待ち)、'unpaid'(入金待ち)、'unshippable'(対応開始前)、'dispatched'(発送済み)、'cancelled'(キャンセル済み)、'shipping'、'arrived' です。今後の機能追加により、新しい値が返る場合があります。
- ordered_atstring (date-time)必須注文日時(RFC 3339, 秒精度 UTC)
- cancelled_atstring (date-time)必須nullableキャンセル日時(RFC 3339, 秒精度 UTC)。未キャンセルは null です。
- modified_atstring (date-time)必須注文の最終更新日時(RFC 3339, 秒精度 UTC)
- viastring必須注文経路。記録が無い場合は 'default' です。
- remarkstring必須nullable購入者が入力した備考
- add_commentstring必須nullableショップから注文者へのメッセージ
- shop_memoOrderShopMemo必須
- textstring必須ショップメモ本文。未入力の場合は空文字列です。
- mail_magazine_opt_inboolean必須nullableメールマガジン購読の同意。購入時に同意を取得していない注文は null です。
- customerOrderCustomer必須
- nameOrderCustomerName必須
- firststring必須名
- laststring必須姓
- first_kanastring必須nullable名(カナ)。未登録時は null です。
- last_kanastring必須nullable姓(カナ)。未登録時は null です。
- mail_addressstring必須購入時に登録されたメールアドレス。未登録時は空文字です。
- addressOrderCustomerAddress必須
- countrystring必須国名。日本国内であれば 'Japan' です。
- country_codestring必須nullable国コード(ISO 3166-1 alpha-2)。国コードを特定できない場合は null です。
- zip_codestring必須郵便番号。ハイフンの有無は保存時のままです。
- prefecturestring必須都道府県
- addressstring必須市区町村・番地
- address2string必須建物名・部屋番号など
- telstring必須nullable電話番号。未登録時は null です。
- shippingOrderShipping必須
- nameOrderShippingName必須
- firststring必須nullable名。配送先未登録時は null です。
- laststring必須nullable姓。配送先未登録時は null です。
- addressOrderShippingAddress必須
- countrystring必須nullable国名。配送先未登録時は null です。
- country_codestring必須nullable国コード(ISO 3166-1 alpha-2)。未登録または国コードを特定できない場合は null です。
- zip_codestring必須nullable郵便番号。配送先未登録時は null です。
- prefecturestring必須nullable都道府県。配送先未登録時は null です。
- addressstring必須nullable市区町村・番地。配送先未登録時は null です。
- address2string必須nullable建物名・部屋番号など。配送先未登録時は null です。
- telstring必須nullable電話番号。未登録時は null です。
- subscriptionOrderSubscription必須nullable定期便情報。通常注文では null です。
- unique_keystring必須nullable定期便の一意キー。未取得時は null です。
- repeat_numberinteger必須nullable何回目の配送か
- repeat_timesinteger必須nullable配送回数の総数
- referrerOrderReferrer必須nullable流入元情報。記録が無い注文は null です。
- site_domainstring必須nullable流入元ドメイン
- site_paramstring必須nullable流入元から引き継ぐ値
- item_countinteger必須注文に含まれる商品の点数(キャンセル明細を除いた各明細の数量の合計)
- amountsOrderAmounts必須
- subtotalinteger必須商品合計(円)。明細 total の合計です。
- shipping_feeinteger必須送料(円)。無料は 0 です。
- cod_feeinteger必須代引手数料(円)。対象外は 0 です。
- totalinteger必須注文合計(円)。クーポン・送料・代引手数料・金額調整を反映した値です。
- coupon_discountOrderCouponDiscount必須
- amountinteger必須クーポン割引額(円)。割引なしは 0 です。
- notestring必須nullable割引メモ(クーポンコード等)
- allocates_balance_logboolean必須売上残高ログの金額配分に含めるクーポン割引かどうか
- coin_discountOrderCoinDiscount必須
- amountinteger必須コイン割引額(円)。割引なしは 0 です。
- notestring必須nullable割引メモ
- adjustmentOrderAmountAdjustment必須
- amountinteger必須金額調整(円)。調整なしは 0 です。
- service_chargeOrderServiceCharge必須
- collected_feeinteger必須BASE 徴収手数料(円)。未徴収の注文は 0 です。
- fee_type"base" | "payid_app"必須手数料種別(base / payid_app)
- additional_chargesOrderAdditionalCharge[]必須追加料金の内訳。無い場合は空配列です。
- namestring必須nullable追加料金の種別名
- collected_feeinteger必須nullable追加料金額(円)
- linesOrderLine[]必須注文明細。古い順(id 昇順)に並びます。
- idinteger必須注文明細 ID
- item_idinteger必須商品 ID
- variation_idinteger必須nullable種類 ID。種類を持たない場合は null です。
- titlestring必須商品名。注文時点の情報です。
- variationstring必須nullable種類名。注文時点の情報です。
- item_identifierstring必須nullable商品コード
- variation_identifierstring必須nullable種類コード
- barcodestring必須nullableJAN / GTIN
- priceinteger必須単価(円)
- amountinteger必須数量
- item_totalinteger必須商品分小計(円)。商品単価と数量から算出した金額です。
- option_totalinteger必須オプション分小計(円)。オプション単価の合計に数量を掛けた金額です。
- totalinteger必須明細合計(円)。item_total と option_total の合計です。
- tax_mode"standard" | "reduced"必須税区分。standard=標準税率、reduced=軽減税率。実際の税率は consumption_tax_rate を参照してください。
- consumption_tax_rateinteger必須消費税率(%)
- consumption_total_taxinteger必須明細に含まれる消費税額(円)
- statusstring必須明細の状態。部分発送・部分キャンセルに対応するため、注文全体の状態とは別に明細ごとに保持します。
- shipping_methodstring必須nullable明細ごとの配送方法名。サイズ別配送(shipping_lines)利用時は null です。
- shipping_feeinteger必須明細ごとの送料(円)。サイズ別配送利用時は 0 です。
- shipping_start_onstring (date)必須nullable予約商品の発送予定開始日(YYYY-MM-DD)。予約商品以外は null です。
- shipping_end_onstring (date)必須nullable予約商品の発送予定終了日(YYYY-MM-DD)。未設定は null です。
- modified_atstring (date-time)必須明細の最終更新日時(RFC 3339, 秒精度 UTC)
- optionsOrderLineOption[]必須明細に紐づくオプション。無い場合は空配列です。
- option_idinteger必須オプション ID
- option_variation_idinteger必須オプション選択肢 ID
- namestring必須オプション名
- typestring必須オプションの入力形式を表す文字列。値は固定された列挙ではありません。現在の仕様では 'select'(選択式)または 'form'(自由入力式)を返します。今後の機能追加により、新しい値が返る場合があります。
- valuestring必須nullableオプションに指定された値。現在の仕様では、type が 'select' の場合は選択肢名、'form' の場合は入力内容を返します。値がない場合は null です。
- priceinteger必須オプション単価(円)
- tax_mode"standard" | "reduced"必須税区分。standard=標準税率、reduced=軽減税率
- consumption_tax_rateinteger必須消費税率(%)
- shipping_linesOrderShippingLine[]必須サイズ別配送ラインの送料配分。利用しない注文は空配列です。
- order_line_idsinteger[]必須この配送ラインに含まれる明細 ID(OrderLine.id)の配列
- shipping_methodstring必須nullable配送方法名(サイズ込み)。未設定は null です。
- shipping_feeinteger必須この配送ラインの送料(円)
- deliveryOrderDelivery必須
- shipping_methodstring必須nullable注文全体に設定された配送方法名。サイズ別配送(shipping_lines)利用時は null です。
- delivery_company_idinteger必須注文全体の配送業者 ID。未指定は 0 です。
- tracking_numberstring必須nullable注文全体の伝票番号
- delivery_datestring (date)必須nullable配送希望日(YYYY-MM-DD)。未指定は null です。
- delivery_time_zonestring必須nullable配送希望時間帯(4 桁。例: '1214' = 12 時-14 時)。未指定は null です。
- dispatched_atstring (date-time)必須nullable最終発送日時(RFC 3339, 秒精度 UTC)。未発送は null です。
- dispatchesOrderDispatch[]必須部分発送の履歴。古い順に並びます。
- idinteger必須発送履歴 ID
- delivery_company_idinteger必須nullable配送業者 ID。未指定は null です。
- tracking_numberstring必須nullable追跡番号。未指定は null です。
- commentstring必須nullable発送コメント
- dispatched_atstring (date-time)必須発送日時(RFC 3339, 秒精度 UTC)
- order_line_idsinteger[]必須この発送に含まれる明細 ID の配列。部分発送に対応するため、複数の明細 ID を含む場合があります。
- paymentOrderPayment必須
- methodstring必須nullable注文確定時の決済手段。未確定は null です。
- transactionsOrderPaymentTransaction[]必須決済トランザクション履歴
- methodstring必須決済手段(creditcard / cvs / paypal / paypay など)
- collected_feeinteger必須nullable決済で徴収された手数料(円)。取得できない場合は null です。
- statusstring必須nullable決済ステータス。取得できない場合は null です。
- transaction_idstring必須nullable外部決済の取引 ID。取得できない場合は null です。
- amountinteger必須nullable取引金額(円)。取得できない場合は null です。
- occurred_atstring (date-time)必須nullable取引発生日時(RFC 3339, 秒精度 UTC)。取得できない場合は null です。
- membership_rewardsOrderMembershipReward[]必須メンバーシップ特典。特典が無い注文では空配列です。
- namestring必須特典名
- statusstring必須特典の発送状態
- balance_logsOrderBalanceLog[]必須売上残高ログ。売上確定・キャンセル・配送料・差額・販売パートナー精算分を含みます。
- textstring必須ログの説明文
- amountinteger必須残高の増減額(円)。プラスは増加、マイナスは減少を表します。
- created_atstring (date-time)必須ログ発生日時(RFC 3339, 秒精度 UTC)
- order_groupOrderGroup必須nullable販売パートナー / セレクトショップ注文の精算情報。精算情報を表示できる注文(ブランド報酬の対象注文、またはグループ内の発送が完了したセレクトショップ注文)でのみ返します。精算対象外の販売パートナー注文や通常注文では null です。
- order_chargeOrderGroupCharge必須
- collected_feeinteger必須nullable注文グループの徴収手数料(円)
- payment_transactionOrderGroupPaymentTransaction必須
- collected_feeinteger必須nullable注文グループの決済手数料(円)
- statusstring必須nullable注文グループの決済ステータス
- brand_chargeOrderGroupBrandCharge必須nullableブランド報酬。該当しない場合は null です。
- reward_feeinteger必須ブランド報酬(円)
エラー
エラーは application/problem+json の Problem 形式で返します。
認証・スコープ・予期しない内部エラーなど、すべてのエンドポイントに共通のエラーと
構造・判別方法は エラーレスポンス を参照してください。
このエンドポイントが返すその他のエラーは次のとおりです。
400 |
/errors/request/malformed-body |
リクエストボディをこのエンドポイントが要求する形式として解釈できない場合に返します。 |
400 |
/errors/orders/invalid-body |
リクエストボディがエンドポイントのスキーマを満たさない場合に返します。 |
400 |
/errors/request/invalid-params |
1 つ以上のパスパラメータがエンドポイントのスキーマを満たさない場合に返します。 |
404 |
/errors/orders/not-found |
指定した注文が存在しない、または呼び出し元から参照できない場合に返します。 |
413 |
/errors/request/body-too-large |
JSON リクエストボディが 1 MiB の上限を超える場合に返します。 |
415 |
/errors/request/unsupported-media-type |
JSON 形式のリクエストボディを要求するエンドポイントに、対応していない Content-Type が指定された、または Content-Type が指定されていない場合に返します。 |
422 |
/errors/orders/update-rejected |
注文状態、決済手段、指定値、更新回数などの業務ルールにより、注文内容、メールアドレス、配送先、配送希望日時、またはショップメモを更新できない場合に返します。 |
502 |
/errors/internal/bad-gateway |
BASE API が処理を完了するために必要な内部処理で不整合が発生した場合に返します。 |
504 |
/errors/internal/gateway-timeout |
BASE API が処理を完了するために必要な内部処理が制限時間内に完了しなかった場合に返します。 |