ECゲートウェイは、任意のECモール・ECプラットフォームとReCOREを連携するためのAPI群です。
ReCOREが直接連携に対応していないモールでも、このAPIを利用することでReCOREと統合することができます。
利用を開始する場合は、弊社営業担当を通じECアカウントとして「汎用」を追加しec_account_idを発行してください。
/ec/gateway/tasks を定期的にポーリングしてタスクを取得します/ec/gateway/tasks/{task_id}/succeeded、失敗時は /ec/gateway/tasks/{task_id}/failed を呼び出して結果を報告します/ec/gateway/order/upsert を呼び出して受注情報をReCOREに送信しますGET /ec/gateway/tasksec:gateway:task:index必要なし5 rps| key | 説明 | 制約など |
|---|---|---|
| ec_account_id | ECアカウントID | 必須 |
| type | タスクタイプで絞り込み | 任意、下記タスクタイプ参照 |
GET /ec/gateway/tasks?ec_account_id=1
[
{
"id": "01HQXYZ123ABC456DEF789GHJ",
"mall_id": "GENERAL",
"type": "CREATE_INVENTORY",
"ec_account_id": 1,
"data": {
"ec_inventory_id": 123
},
"issued_at": 1708054490
}
]
| key | type | 説明 |
|---|---|---|
| * | array<object> | タスク一覧 |
| *.id | string | タスクID |
| *.mall_id | string | モールID(常にGENERAL) |
| *.type | string | タスクタイプ |
| *.ec_account_id | int | ECアカウントID |
| *.data | object | タスク固有のデータ |
| *.issued_at | int | タスク発行日時(Unix timestamp) |
以下の10種類のタスクタイプが存在します。
ReCOREで新規出品が作成された際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
GET /ec/inventories/{ec_inventory_id} で取得してください出品情報(タイトル、説明文、画像など)が更新された際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
GET /ec/inventories/{ec_inventory_id} で取得してください出品商品の価格が更新された際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
| ec_inventory_variant_id | int | 出品バリエーションID |
GET /ec/inventories/{ec_inventory_id} で取得してくださいvariants 配列から該当の ec_inventory_variant_id の出品情報を参照してください出品商品の在庫数が更新された際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
| ec_inventory_variant_id | int | 出品バリエーションID |
GET /ec/inventories/{ec_inventory_id} で取得してくださいvariants 配列から該当の ec_inventory_variant_id の出品情報を参照してください出品が削除された際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
GET /ec/inventories/{ec_inventory_id} で取得してください出品を公開状態にする際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
GET /ec/inventories/{ec_inventory_id} で取得してください出品を終了状態にする際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_inventory_id | int | 出品ID |
GET /ec/inventories/{ec_inventory_id} で取得してください受注の入金確認を行う際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_order_id | int | 受注ID |
GET /ec/orders/{ec_order_id} で取得してください受注の出荷処理を行う際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_order_id | int | 受注ID |
| ec_fulfillment_id | int | 出荷ID |
GET /ec/orders/{ec_order_id} で取得してくださいfulfillments 配列から該当の ec_fulfillment_id の出荷情報を参照してください受注のキャンセル処理を行う際に発行されます。
| data内のkey | type | 説明 |
|---|---|---|
| ec_order_id | int | 受注ID |
| reason | string | キャンセル理由 |
GET /ec/orders/{ec_order_id} で取得してくださいPUT /ec/gateway/tasks/{task_id}/succeededec:gateway:task:succeeded:update必要なし20 rps| key | 説明 | 制約など |
|---|---|---|
| task_id | タスクID | 必須 |
| key | type | 説明 | 制約など |
|---|---|---|---|
| type | string | タスクタイプ | 必須、タスクのtypeと一致する必要がある |
| data | ?object | タスク固有の結果データ | タスクタイプにより異なる |
タスクタイプ別のdataパラメータ:
| タスクタイプ | 必須パラメータ |
|---|---|
| CREATE_INVENTORY | mall_product_code: モール側で発行された商品コード |
| UPDATE_INVENTORY | なし |
| UPDATE_PRICE | なし |
| UPDATE_STOCK | なし |
| DELETE_INVENTORY | なし |
| OPEN_INVENTORY | なし |
| CLOSE_INVENTORY | なし |
| CONFIRM_ORDER | なし |
| FULFILL_ORDER | なし |
| CANCEL_ORDER | なし |
PUT /ec/gateway/tasks/01HQXYZ123ABC456DEF789GHJ/succeeded
{
"type": "CREATE_INVENTORY",
"data": {
"mall_product_code": "SHOP-12345"
}
}
204 No Content
PUT /ec/gateway/tasks/{task_id}/failedec:gateway:task:failed:update必要なし20 rps| key | 説明 | 制約など |
|---|---|---|
| task_id | タスクID | 必須 |
| key | type | 説明 | 制約など |
|---|---|---|---|
| type | string | タスクタイプ | 必須、タスクのtypeと一致する必要がある |
| data | ?object | エラー情報 | 任意 |
| data.code | ?string | null | エラーコード | 任意 |
| data.message | ?string | null | エラーメッセージ | 任意 |
PUT /ec/gateway/tasks/01HQXYZ123ABC456DEF789GHJ/failed
{
"type": "UPDATE_STOCK",
"data": {
"code": "OUT_OF_STOCK",
"message": "モール側で在庫更新に失敗しました"
}
}
204 No Content
mall_order_id をキーとしてupsertされる(同一のmall_order_idの場合は更新)POST /ec/gateway/order/upsertec:gateway:order:upsert:store必要なし20 rps| key | type | 説明 | 制約など |
|---|---|---|---|
| mall_id | string | モールID | 必須、GENERAL固定 |
| ec_account_id | int | ECアカウントID | 必須 |
| data | object | 受注データ | 必須 |
| data.mall_order_id | string | モール受注ID | 必須、50文字以内 |
| data.status | string | 受注ステータス | 必須、下記参照 |
| data.fraud_status | string | null | 不正検知ステータス | 下記参照 |
| data.ordered_at | string | 受注日時 | 必須、ISO 8601形式 |
| data.shipped_at | string | null | 出荷日時 | ISO 8601形式 |
| data.payment_total | int | お客様支払額 | 必須、0以上 |
| data.payment_method | string | null | 支払い方法 | - |
| data.shipping_method | string | null | 配送方法 | - |
| data.buyer_name | string | null | 購入者氏名 | 100文字以内 |
| data.buyer_name_kana | string | null | 購入者かな | 100文字以内 |
| data.buyer_email | string | null | 購入者メールアドレス | 256文字以内 |
| data.shipping_postal_code | string | null | 配送先郵便番号 | 20文字以内 |
| data.shipping_country_code | string | null | 配送先国コード | ISO-3166、2文字 |
| data.shipping_state_or_region | string | null | 配送先都道府県 | 200文字以内 |
| data.shipping_city | string | null | 配送先市区町村 | 200文字以内 |
| data.shipping_address1 | string | null | 配送先住所1 | - |
| data.shipping_address2 | string | null | 配送先住所2 | - |
| data.shipping_address3 | string | null | 配送先住所3 | - |
| data.shipping_phone | string | null | 配送先電話番号 | 50文字以内 |
| data.shipping_name | string | null | 配送先宛名 | 100文字以内 |
| data.earliest_delivery_at | string | null | 配送日時指定(開始) | ISO 8601形式 |
| data.latest_delivery_at | string | null | 配送日時指定(終了) | ISO 8601形式 |
| data.comment | string | null | 受注時備考 | - |
| data.member_id | int | null | 会員ID | ReCOREの会員IDを指定 |
| data.order_adjustment | int | 受注全体調整額 | 必須 |
| data.shipping_price | int | 送料 | 必須、0以上 |
| data.shipping_tax | int | 送料消費税額 | 必須、0以上 |
| data.shipping_tax_rate_type | string | 送料税区分 | 必須、下記参照 |
| data.payment_price | int | 支払手数料 | 必須、0以上 |
| data.payment_tax | int | 支払手数料消費税額 | 必須、0以上 |
| data.payment_tax_rate_type | string | 支払手数料税区分 | 必須、下記参照 |
| data.option_price | int | サービス料 | 必須、0以上 |
| data.option_tax | int | サービス料消費税額 | 必須、0以上 |
| data.option_tax_rate_type | string | サービス料税区分 | 必須、下記参照 |
| data.earned_point | int | 獲得ポイント | 必須、0以上 |
| data.goods | array<object> | 受注明細 | 必須 |
| data.goods.*.mall_item_id | string | モール明細ID | 必須、50文字以内 |
| data.goods.*.mall_item_code | string | null | モールSKU | 50文字以内 |
| data.goods.*.unit_price | int | 単価 | 必須、0以上 |
| data.goods.*.unit_adjustment | int | 単価調整額 | 必須、0以上 |
| data.goods.*.tax | int | 消費税額 | 必須、0以上 |
| data.goods.*.tax_rate_type | string | 税区分 | 必須、下記参照 |
| data.goods.*.quantity | int | 数量 | 必須、0以上 |
| data.goods.*.title | string | null | 商品名 | - |
| data.goods.*.comment | string | null | 明細備考 | - |
| 値 | 説明 |
|---|---|
| PENDING | 代金未回収状態、発送不可 |
| UNSHIPPED | 代金回収済み、発送可 |
| SHIPPED | 出荷済み |
| CANCELED | キャンセル済み |
| OTHER | その他(予期しない状態) |
SHIPPED または CANCELED)の受注は更新できません。これらのステータスの受注に対してupsertを行った場合、リクエストは無視されます。| 値 | 説明 |
|---|---|
| SAFE | 安全 |
| PENDING | 判定中 |
| HIGH_RISK | 高リスク |
| MEDIUM_RISK | 中リスク |
| null | 未判定 |
| 値 | 説明 |
|---|---|
| GENERAL | 一般 |
| RELIEF | 軽減税率 |
| NO_TAX | 非課税 |
POST /ec/gateway/order/upsert
{
"mall_id": "GENERAL",
"ec_account_id": 1,
"data": {
"mall_order_id": "ORDER-12345",
"status": "UNSHIPPED",
"fraud_status": null,
"ordered_at": "2024-02-12T10:30:00+09:00",
"shipped_at": null,
"payment_total": 3300,
"payment_method": "クレジットカード",
"shipping_method": "宅急便",
"buyer_name": "山田 太郎",
"buyer_name_kana": "ヤマダ タロウ",
"buyer_email": "yamada@example.com",
"shipping_postal_code": "150-0001",
"shipping_country_code": "JP",
"shipping_state_or_region": "東京都",
"shipping_city": "渋谷区",
"shipping_address1": "神宮前1-2-3",
"shipping_address2": "ABCビル 5F",
"shipping_address3": null,
"shipping_phone": "03-1234-5678",
"shipping_name": "山田 太郎",
"earliest_delivery_at": "2024-02-15T09:00:00+09:00",
"latest_delivery_at": "2024-02-15T18:00:00+09:00",
"comment": "配達時に不在の場合は宅配ボックスへ",
"member_id": null,
"order_adjustment": 0,
"shipping_price": 500,
"shipping_tax": 50,
"shipping_tax_rate_type": "GENERAL",
"payment_price": 0,
"payment_tax": 0,
"payment_tax_rate_type": "GENERAL",
"option_price": 0,
"option_tax": 0,
"option_tax_rate_type": "GENERAL",
"earned_point": 0,
"goods": [
{
"mall_item_id": "ITEM-001",
"mall_item_code": "SKU-001",
"unit_price": 2500,
"unit_adjustment": 0,
"tax": 250,
"tax_rate_type": "GENERAL",
"quantity": 1,
"title": "テスト商品A",
"comment": null
}
]
}
}
204 No Content
mall_order_id で一意に識別されるため、同じIDで送信すると更新となります