# Import Order

`POST https://public.rcmr.io/api/v1/orders/import`

> Recustomer API — 向き: マーチャント → Recustomer

注文情報をRecustomerに送信します。

## ヘッダー

- `Authorization` (string, 必須): 管理画面の「外部サービス連携」にある「Custom Integration」で発行した API トークン。Bearer で付けて送る

## リクエストボディ

- `id` (string, 必須): 注文ID
- `order_number` (string, 必須): 注文番号
- `status` (string, 必須): 注文ステータス processing: 処理中、fulfilled: 発送済み、partial_fulfilled: 一部発送済み、canceled: キャンセル済み
  - 取りうる値: `processing`, `fulfilled`, `partial_fulfilled`, `canceled`
- `fulfillment_status` (string, 必須): 発送ステータス fulfilled: 発送済み、null: 未発送、partial: 一部発送済み、canceled: キャンセル済み
  - 取りうる値: `fulfilled`, `null`, `partial`, `canceled`
- `financial_status` (string, 必須): 支払いステータス pending: 保留中、authorized: 認証済み、partially_paid: 一部支払い済み、paid: 支払い済み、partially_refunded: 一部返金済み、refunded: 返金済み、voided: 無効
  - 取りうる値: `pending`, `authorized`, `partially_paid`, `paid`, `partially_refunded`, `refunded`, `voided`
- `order_discount_amount` (string): 注文に対してのディスカウント金額合計（モール利用の場合は、モール原資クーポン+店舗原資クーポン）
- `order_point_price` (string, 必須): 注文に対してのポイント利用
- `total_item_discount_amount` (string, 必須): 商品ディスカウント合計
- `subtotal_price` (string, 必須): 商品小計
- `total_shipping_price` (string, 必須): 注文時の送料
- `total_discount` (string, 必須): ディスカウント合計（order_discount_amount+order_point_price+total_item_discount_amount）
- `additional_fees_amount` (string): その他費用合計
- `total_price` (string, 必須): 合計金額
- `total_tax` (string, 必須): 税
- `payment_at` (string): 入金日時
- `is_tax_included` (boolean, 必須): total_priceが税を含む金額か
- `currency` (string, 必須): 通貨単位
- `quantity` (integer, 必須): 注文商品数の合計
- `created_at` (string, 必須): 注文日時
- `updated_at` (string): 更新日時
- `note` (string): 注文の補足情報
- `order_link` (string): 注文のリンク
- `customer` (object, 必須): 顧客情報
  - `customer_id` (string): カスタマーID
  - `email` (string, 必須): メールアドレス
  - `last_name` (string, null のことがある): 姓
  - `first_name` (string, null のことがある): 名
  - `full_name` (string, 必須): 姓名
  - `phone_number` (string): 電話番号
  - `is_consent_email_marketing` (boolean): emailマーケティングに同意しているか
  - `is_consent_sms_marketing` (boolean): SMSマーケティングに同意しているか
  - `purchase_times` (integer): 購入回数
  - `customer_tags` (array of strings): 顧客タグ
  - `created_at` (string, 必須): 作成日時
  - `updated_at` (string, 必須): 更新日時
  - `metafields` (array of objects): 独自で設定したいカラム情報
    - `key` (string, 必須): メタフィールドのキー
    - `value` (any, 必須): メタフィールドのキーに対する値
- `line_items` (array of objects, 必須): 注文商品
  - `id` (string, 必須): ラインアイテムID
  - `product_id` (string, 必須): 商品ID
  - `product_name` (string, 必須): 商品名
  - `variant_id` (string): バリエーションID
  - `sku` (string, 必須): SKU
  - `item_image` (string, 必須): 商品画像
  - `item_discount_price` (string, 必須): 商品に対してのディスカウント
  - `item_discount_amount` (string, 必須): 商品のディスカウント合計
  - `item_price` (string, 必須): 商品の販売価格
  - `item_compare_at_price` (string, 必須): 商品の定価
  - `item_cost` (string): 注文時点での商品原価
  - `item_quantity` (string, 必須): 商品の数量
  - `item_price_amount` (string, 必須): 商品の販売価格合計
  - `item_tax_price` (string, 必須): 税
  - `is_tax_included` (boolean, 必須): item_price_amountが税を含む金額か
  - `fulfillment_status` (string, 必須): 発送状況 null: 未発送、fulfilled: 発送済み, partial: 一部発送済み, not_eligible: 発送対象外
    - 取りうる値: `null`, `fulfilled`, `partial`, `not_eligible`
  - `variant_options` (array of objects): バリエーションのオプション
    - `name` (string, 必須): オプション名
    - `value` (string, 必須): オプションに設定されている値
  - `created_at` (string, 必須): 作成日時
  - `updated_at` (string, 必須): 更新日時
  - `metafields` (array of objects): 独自で設定したいカラム情報
    - `key` (string, 必須): メタフィールドのキー
    - `value` (any, 必須): メタフィールドのキーに対する値
- `shipping_address` (object, 必須): 配送住所
  - `first_name` (string): 名
  - `last_name` (string): 姓
  - `full_name` (string, 必須): 姓名
  - `email` (string): メールアドレス
  - `phone_number` (string): 電話番号
  - `address` (object, 必須): 住所情報
    - `country_code` (string): 国コード 日本の場合"JP" ISO-3166-2参照
    - `postal_code` (string, 必須): 郵便番号
    - `province` (string, 必須): 都道府県
    - `city` (string, 必須): 市区町村
    - `address1` (string): 住所情報1
    - `address2` (string): 住所情報2
- `billing_address` (object, 必須): 請求住所
  - `first_name` (string): 名
  - `last_name` (string): 姓
  - `full_name` (string, 必須): 姓名
  - `email` (string): メールアドレス
  - `phone_number` (string): 電話番号
  - `address` (object, 必須): 住所情報
    - `country_code` (string): 国コード 日本の場合"JP" ISO-3166-2参照
    - `postal_code` (string, 必須): 郵便番号
    - `province` (string, 必須): 都道府県
    - `city` (string, 必須): 市区町村
    - `address1` (string): 住所情報1
    - `address2` (string): 住所情報2
- `fulfillments` (array of objects, 必須): 発送情報
  - `id` (string, 必須): 発送情報ID
  - `status` (string, 必須): 発送状況 pending: 保留中、open: 処理中、success: 処理成功、cancelled: キャンセル、failure: 処理失敗
    - 取りうる値: `pending`, `open`, `success`, `cancelled`, `failure`
  - `tracking_company` (string): 配送会社 yamato: ヤマト運輸、sagawa: 佐川集荷、jp: 日本郵便、askullogist: アスクルロジスト、seino_unyu: 西濃運輸、eco_hai: エコ配、global: 国際宅配便、others: その他
    - 取りうる値: `yamato`, `sagawa`, `jp`, `askullogist`, `seino_unyu`, `eco_hai`, `global`, `others`
  - `tracking_number` (string): 追跡番号
  - `fulfillment_line_items` (array of objects): 発送商品
    - `id` (string, 必須): 発送商品ID
    - `order_line_item_id` (integer, 必須): 発送された商品のline_item_id
    - `quantity` (integer, 必須): 配送済みの商品数
  - `created_at` (string): 発送日時
  - `updated_at` (string): 更新日時
- `transactions` (array of objects): 料金情報(支払いが完了している場合必須)
  - `id` (string, 必須): トランザクションID
  - `parent_id` (integer): 紐づく親トランザクションID
  - `amount` (string, 必須): 取引金額
  - `currency` (string, 必須): 通貨単位 参考(https://en.wikipedia.org/wiki/ISO_4217)
  - `status` (string, 必須): 取引ステータス success: 成功、failure: 失敗、pending: 保留
    - 取りうる値: `success`, `failure`, `pending`
  - `gateway` (string, 必須): 取引ゲートウェイ
  - `created_at` (string): 作成日時
  - `updated_at` (string): 更新日時
- `metafields` (array of objects): 独自で設定したいカラム情報
  - `key` (string, 必須): メタフィールドのキー
  - `value` (any, 必須): メタフィールドのキーに対する値

## レスポンス

### 201 successfully.

- `results` (string)

### 400 Bad request

- `message` (string): エラー詳細が格納されます

### 401 Unauthorized

- `message` (string): エラー詳細が格納されます

### 403 API トークンが「注文の取り込み」（orders:import）の権限を持たない。または API トークンの店舗で注文を取り込めない

- `message` (string): エラー詳細が格納されます

### 422 Unprocessable Entity

- `message` (string): エラー詳細が格納されます

### 500 Internal Server Error

- `message` (string): エラー詳細が格納されます(Recustomerにエラーが発生している可能性がございます。お手数ですがお問合せください)

### 503 一時的に API トークンを確かめられない。時間をおいて再送してください

- `message` (string): エラー詳細が格納されます

## リクエスト

### curl

```bash
curl -X POST 'https://public.rcmr.io/api/v1/orders/import' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d @- <<'JSON'
{
  "id": 1234567,
  "order_number": 1001,
  "status": "processing",
  "fulfillment_status": "fulfilled",
  "financial_status": "paid",
  "order_discount_amount": 100,
  "order_point_price": 100,
  "total_item_discount_amount": 100,
  "subtotal_price": 100,
  "total_shipping_price": "string",
  "total_discount": 100,
  "additional_fees_amount": 100,
  "total_price": 100,
  "total_tax": 100,
  "payment_at": "2023-05-10T12:00:00+09:00",
  "is_tax_included": true,
  "currency": "JPY",
  "quantity": 3,
  "created_at": "2023-05-10T12:00:00+09:00",
  "updated_at": "2023-05-12T10:30:00+09:00",
  "note": "テスト注文",
  "order_link": "https://recustomer.me/order/1",
  "customer": {
    "customer_id": "1",
    "email": "test@recustomer.co",
    "last_name": "佐藤",
    "first_name": "太郎",
    "full_name": "佐藤 太郎",
    "phone_number": "000-####-####",
    "is_consent_email_marketing": false,
    "is_consent_sms_marketing": false,
    "purchase_times": 11,
    "customer_tags": [
      "test顧客",
      "一般会員"
    ],
    "created_at": "2023-05-10T12:00:00+09:00",
    "updated_at": "2023-05-12T10:30:00+09:00",
    "metafields": [
      {
        "key": "coupon_code",
        "value": null
      }
    ]
  },
  "line_items": [
    {
      "id": "1000",
      "product_id": "product_id",
      "product_name": "テスト商品",
      "variant_id": "2538974832789",
      "sku": "product_id_S_Red",
      "item_image": "https://recustomer.me/image/12345",
      "item_discount_price": 100,
      "item_discount_amount": 100,
      "item_price": 100,
      "item_compare_at_price": 100,
      "item_cost": 100,
      "item_quantity": 1,
      "item_price_amount": 100,
      "item_tax_price": 100,
      "is_tax_included": true,
      "fulfillment_status": "null",
      "variant_options": [
        {
          "name": "カラー",
          "value": "レッド"
        }
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00",
      "metafields": [
        {
          "key": "coupon_code",
          "value": null
        }
      ]
    }
  ],
  "shipping_address": {
    "first_name": "太郎",
    "last_name": "佐藤",
    "full_name": "佐藤 太郎",
    "email": "test@recustomer.co",
    "phone_number": "000-####-####",
    "address": {
      "country_code": "JP",
      "postal_code": "1010024",
      "province": "東京都",
      "city": "千代田区",
      "address1": "神田和泉町1-8-11",
      "address2": "サン・センタービル5F"
    }
  },
  "billing_address": {
    "first_name": "太郎",
    "last_name": "佐藤",
    "full_name": "佐藤 太郎",
    "email": "test@recustomer.co",
    "phone_number": "000-####-####",
    "address": {
      "country_code": "JP",
      "postal_code": "1010024",
      "province": "東京都",
      "city": "千代田区",
      "address1": "神田和泉町1-8-11",
      "address2": "サン・センタービル5F"
    }
  },
  "fulfillments": [
    {
      "id": "1",
      "status": "pending",
      "tracking_company": "yamato",
      "tracking_number": "4983892",
      "fulfillment_line_items": [
        {
          "id": "1",
          "order_line_item_id": 1,
          "quantity": 2
        }
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00"
    }
  ],
  "transactions": [
    {
      "id": "2",
      "parent_id": 1,
      "amount": 1000,
      "currency": "JPY",
      "status": "success",
      "gateway": "manual",
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00"
    }
  ],
  "metafields": [
    {
      "key": "coupon_code",
      "value": null
    }
  ]
}
JSON
```

### Node.js

```javascript
const response = await fetch("https://public.rcmr.io/api/v1/orders/import", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_TOKEN",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "id": 1234567,
    "order_number": 1001,
    "status": "processing",
    "fulfillment_status": "fulfilled",
    "financial_status": "paid",
    "order_discount_amount": 100,
    "order_point_price": 100,
    "total_item_discount_amount": 100,
    "subtotal_price": 100,
    "total_shipping_price": "string",
    "total_discount": 100,
    "additional_fees_amount": 100,
    "total_price": 100,
    "total_tax": 100,
    "payment_at": "2023-05-10T12:00:00+09:00",
    "is_tax_included": true,
    "currency": "JPY",
    "quantity": 3,
    "created_at": "2023-05-10T12:00:00+09:00",
    "updated_at": "2023-05-12T10:30:00+09:00",
    "note": "テスト注文",
    "order_link": "https://recustomer.me/order/1",
    "customer": {
      "customer_id": "1",
      "email": "test@recustomer.co",
      "last_name": "佐藤",
      "first_name": "太郎",
      "full_name": "佐藤 太郎",
      "phone_number": "000-####-####",
      "is_consent_email_marketing": false,
      "is_consent_sms_marketing": false,
      "purchase_times": 11,
      "customer_tags": [
        "test顧客",
        "一般会員"
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00",
      "metafields": [
        {
          "key": "coupon_code",
          "value": null
        }
      ]
    },
    "line_items": [
      {
        "id": "1000",
        "product_id": "product_id",
        "product_name": "テスト商品",
        "variant_id": "2538974832789",
        "sku": "product_id_S_Red",
        "item_image": "https://recustomer.me/image/12345",
        "item_discount_price": 100,
        "item_discount_amount": 100,
        "item_price": 100,
        "item_compare_at_price": 100,
        "item_cost": 100,
        "item_quantity": 1,
        "item_price_amount": 100,
        "item_tax_price": 100,
        "is_tax_included": true,
        "fulfillment_status": "null",
        "variant_options": [
          {
            "name": "カラー",
            "value": "レッド"
          }
        ],
        "created_at": "2023-05-10T12:00:00+09:00",
        "updated_at": "2023-05-12T10:30:00+09:00",
        "metafields": [
          {
            "key": "coupon_code",
            "value": null
          }
        ]
      }
    ],
    "shipping_address": {
      "first_name": "太郎",
      "last_name": "佐藤",
      "full_name": "佐藤 太郎",
      "email": "test@recustomer.co",
      "phone_number": "000-####-####",
      "address": {
        "country_code": "JP",
        "postal_code": "1010024",
        "province": "東京都",
        "city": "千代田区",
        "address1": "神田和泉町1-8-11",
        "address2": "サン・センタービル5F"
      }
    },
    "billing_address": {
      "first_name": "太郎",
      "last_name": "佐藤",
      "full_name": "佐藤 太郎",
      "email": "test@recustomer.co",
      "phone_number": "000-####-####",
      "address": {
        "country_code": "JP",
        "postal_code": "1010024",
        "province": "東京都",
        "city": "千代田区",
        "address1": "神田和泉町1-8-11",
        "address2": "サン・センタービル5F"
      }
    },
    "fulfillments": [
      {
        "id": "1",
        "status": "pending",
        "tracking_company": "yamato",
        "tracking_number": "4983892",
        "fulfillment_line_items": [
          {
            "id": "1",
            "order_line_item_id": 1,
            "quantity": 2
          }
        ],
        "created_at": "2023-05-10T12:00:00+09:00",
        "updated_at": "2023-05-12T10:30:00+09:00"
      }
    ],
    "transactions": [
      {
        "id": "2",
        "parent_id": 1,
        "amount": 1000,
        "currency": "JPY",
        "status": "success",
        "gateway": "manual",
        "created_at": "2023-05-10T12:00:00+09:00",
        "updated_at": "2023-05-12T10:30:00+09:00"
      }
    ],
    "metafields": [
      {
        "key": "coupon_code",
        "value": null
      }
    ]
  }),
});

console.log(response.status, await response.json());
```

### Python

```python
# pip install requests
import requests

response = requests.request(
    "POST",
    "https://public.rcmr.io/api/v1/orders/import",
    headers={
        "Authorization": "Bearer YOUR_API_TOKEN",
    },
    json={
        "id": 1234567,
        "order_number": 1001,
        "status": "processing",
        "fulfillment_status": "fulfilled",
        "financial_status": "paid",
        "order_discount_amount": 100,
        "order_point_price": 100,
        "total_item_discount_amount": 100,
        "subtotal_price": 100,
        "total_shipping_price": "string",
        "total_discount": 100,
        "additional_fees_amount": 100,
        "total_price": 100,
        "total_tax": 100,
        "payment_at": "2023-05-10T12:00:00+09:00",
        "is_tax_included": True,
        "currency": "JPY",
        "quantity": 3,
        "created_at": "2023-05-10T12:00:00+09:00",
        "updated_at": "2023-05-12T10:30:00+09:00",
        "note": "テスト注文",
        "order_link": "https://recustomer.me/order/1",
        "customer": {
            "customer_id": "1",
            "email": "test@recustomer.co",
            "last_name": "佐藤",
            "first_name": "太郎",
            "full_name": "佐藤 太郎",
            "phone_number": "000-####-####",
            "is_consent_email_marketing": False,
            "is_consent_sms_marketing": False,
            "purchase_times": 11,
            "customer_tags": [
                "test顧客",
                "一般会員",
            ],
            "created_at": "2023-05-10T12:00:00+09:00",
            "updated_at": "2023-05-12T10:30:00+09:00",
            "metafields": [
                {
                    "key": "coupon_code",
                    "value": None,
                },
            ],
        },
        "line_items": [
            {
                "id": "1000",
                "product_id": "product_id",
                "product_name": "テスト商品",
                "variant_id": "2538974832789",
                "sku": "product_id_S_Red",
                "item_image": "https://recustomer.me/image/12345",
                "item_discount_price": 100,
                "item_discount_amount": 100,
                "item_price": 100,
                "item_compare_at_price": 100,
                "item_cost": 100,
                "item_quantity": 1,
                "item_price_amount": 100,
                "item_tax_price": 100,
                "is_tax_included": True,
                "fulfillment_status": "null",
                "variant_options": [
                    {
                        "name": "カラー",
                        "value": "レッド",
                    },
                ],
                "created_at": "2023-05-10T12:00:00+09:00",
                "updated_at": "2023-05-12T10:30:00+09:00",
                "metafields": [
                    {
                        "key": "coupon_code",
                        "value": None,
                    },
                ],
            },
        ],
        "shipping_address": {
            "first_name": "太郎",
            "last_name": "佐藤",
            "full_name": "佐藤 太郎",
            "email": "test@recustomer.co",
            "phone_number": "000-####-####",
            "address": {
                "country_code": "JP",
                "postal_code": "1010024",
                "province": "東京都",
                "city": "千代田区",
                "address1": "神田和泉町1-8-11",
                "address2": "サン・センタービル5F",
            },
        },
        "billing_address": {
            "first_name": "太郎",
            "last_name": "佐藤",
            "full_name": "佐藤 太郎",
            "email": "test@recustomer.co",
            "phone_number": "000-####-####",
            "address": {
                "country_code": "JP",
                "postal_code": "1010024",
                "province": "東京都",
                "city": "千代田区",
                "address1": "神田和泉町1-8-11",
                "address2": "サン・センタービル5F",
            },
        },
        "fulfillments": [
            {
                "id": "1",
                "status": "pending",
                "tracking_company": "yamato",
                "tracking_number": "4983892",
                "fulfillment_line_items": [
                    {
                        "id": "1",
                        "order_line_item_id": 1,
                        "quantity": 2,
                    },
                ],
                "created_at": "2023-05-10T12:00:00+09:00",
                "updated_at": "2023-05-12T10:30:00+09:00",
            },
        ],
        "transactions": [
            {
                "id": "2",
                "parent_id": 1,
                "amount": 1000,
                "currency": "JPY",
                "status": "success",
                "gateway": "manual",
                "created_at": "2023-05-10T12:00:00+09:00",
                "updated_at": "2023-05-12T10:30:00+09:00",
            },
        ],
        "metafields": [
            {
                "key": "coupon_code",
                "value": None,
            },
        ],
    },
)
print(response.status_code, response.json())
```

### PHP

```php
<?php
$payload = <<<'JSON'
{
  "id": 1234567,
  "order_number": 1001,
  "status": "processing",
  "fulfillment_status": "fulfilled",
  "financial_status": "paid",
  "order_discount_amount": 100,
  "order_point_price": 100,
  "total_item_discount_amount": 100,
  "subtotal_price": 100,
  "total_shipping_price": "string",
  "total_discount": 100,
  "additional_fees_amount": 100,
  "total_price": 100,
  "total_tax": 100,
  "payment_at": "2023-05-10T12:00:00+09:00",
  "is_tax_included": true,
  "currency": "JPY",
  "quantity": 3,
  "created_at": "2023-05-10T12:00:00+09:00",
  "updated_at": "2023-05-12T10:30:00+09:00",
  "note": "テスト注文",
  "order_link": "https://recustomer.me/order/1",
  "customer": {
    "customer_id": "1",
    "email": "test@recustomer.co",
    "last_name": "佐藤",
    "first_name": "太郎",
    "full_name": "佐藤 太郎",
    "phone_number": "000-####-####",
    "is_consent_email_marketing": false,
    "is_consent_sms_marketing": false,
    "purchase_times": 11,
    "customer_tags": [
      "test顧客",
      "一般会員"
    ],
    "created_at": "2023-05-10T12:00:00+09:00",
    "updated_at": "2023-05-12T10:30:00+09:00",
    "metafields": [
      {
        "key": "coupon_code",
        "value": null
      }
    ]
  },
  "line_items": [
    {
      "id": "1000",
      "product_id": "product_id",
      "product_name": "テスト商品",
      "variant_id": "2538974832789",
      "sku": "product_id_S_Red",
      "item_image": "https://recustomer.me/image/12345",
      "item_discount_price": 100,
      "item_discount_amount": 100,
      "item_price": 100,
      "item_compare_at_price": 100,
      "item_cost": 100,
      "item_quantity": 1,
      "item_price_amount": 100,
      "item_tax_price": 100,
      "is_tax_included": true,
      "fulfillment_status": "null",
      "variant_options": [
        {
          "name": "カラー",
          "value": "レッド"
        }
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00",
      "metafields": [
        {
          "key": "coupon_code",
          "value": null
        }
      ]
    }
  ],
  "shipping_address": {
    "first_name": "太郎",
    "last_name": "佐藤",
    "full_name": "佐藤 太郎",
    "email": "test@recustomer.co",
    "phone_number": "000-####-####",
    "address": {
      "country_code": "JP",
      "postal_code": "1010024",
      "province": "東京都",
      "city": "千代田区",
      "address1": "神田和泉町1-8-11",
      "address2": "サン・センタービル5F"
    }
  },
  "billing_address": {
    "first_name": "太郎",
    "last_name": "佐藤",
    "full_name": "佐藤 太郎",
    "email": "test@recustomer.co",
    "phone_number": "000-####-####",
    "address": {
      "country_code": "JP",
      "postal_code": "1010024",
      "province": "東京都",
      "city": "千代田区",
      "address1": "神田和泉町1-8-11",
      "address2": "サン・センタービル5F"
    }
  },
  "fulfillments": [
    {
      "id": "1",
      "status": "pending",
      "tracking_company": "yamato",
      "tracking_number": "4983892",
      "fulfillment_line_items": [
        {
          "id": "1",
          "order_line_item_id": 1,
          "quantity": 2
        }
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00"
    }
  ],
  "transactions": [
    {
      "id": "2",
      "parent_id": 1,
      "amount": 1000,
      "currency": "JPY",
      "status": "success",
      "gateway": "manual",
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00"
    }
  ],
  "metafields": [
    {
      "key": "coupon_code",
      "value": null
    }
  ]
}
JSON;

$ch = curl_init('https://public.rcmr.io/api/v1/orders/import');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_API_TOKEN',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_RETURNTRANSFER => true,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL, $body, PHP_EOL;
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "id": 1234567,
  "order_number": 1001,
  "status": "processing",
  "fulfillment_status": "fulfilled",
  "financial_status": "paid",
  "order_discount_amount": 100,
  "order_point_price": 100,
  "total_item_discount_amount": 100,
  "subtotal_price": 100,
  "total_shipping_price": "string",
  "total_discount": 100,
  "additional_fees_amount": 100,
  "total_price": 100,
  "total_tax": 100,
  "payment_at": "2023-05-10T12:00:00+09:00",
  "is_tax_included": true,
  "currency": "JPY",
  "quantity": 3,
  "created_at": "2023-05-10T12:00:00+09:00",
  "updated_at": "2023-05-12T10:30:00+09:00",
  "note": "テスト注文",
  "order_link": "https://recustomer.me/order/1",
  "customer": {
    "customer_id": "1",
    "email": "test@recustomer.co",
    "last_name": "佐藤",
    "first_name": "太郎",
    "full_name": "佐藤 太郎",
    "phone_number": "000-####-####",
    "is_consent_email_marketing": false,
    "is_consent_sms_marketing": false,
    "purchase_times": 11,
    "customer_tags": [
      "test顧客",
      "一般会員"
    ],
    "created_at": "2023-05-10T12:00:00+09:00",
    "updated_at": "2023-05-12T10:30:00+09:00",
    "metafields": [
      {
        "key": "coupon_code",
        "value": null
      }
    ]
  },
  "line_items": [
    {
      "id": "1000",
      "product_id": "product_id",
      "product_name": "テスト商品",
      "variant_id": "2538974832789",
      "sku": "product_id_S_Red",
      "item_image": "https://recustomer.me/image/12345",
      "item_discount_price": 100,
      "item_discount_amount": 100,
      "item_price": 100,
      "item_compare_at_price": 100,
      "item_cost": 100,
      "item_quantity": 1,
      "item_price_amount": 100,
      "item_tax_price": 100,
      "is_tax_included": true,
      "fulfillment_status": "null",
      "variant_options": [
        {
          "name": "カラー",
          "value": "レッド"
        }
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00",
      "metafields": [
        {
          "key": "coupon_code",
          "value": null
        }
      ]
    }
  ],
  "shipping_address": {
    "first_name": "太郎",
    "last_name": "佐藤",
    "full_name": "佐藤 太郎",
    "email": "test@recustomer.co",
    "phone_number": "000-####-####",
    "address": {
      "country_code": "JP",
      "postal_code": "1010024",
      "province": "東京都",
      "city": "千代田区",
      "address1": "神田和泉町1-8-11",
      "address2": "サン・センタービル5F"
    }
  },
  "billing_address": {
    "first_name": "太郎",
    "last_name": "佐藤",
    "full_name": "佐藤 太郎",
    "email": "test@recustomer.co",
    "phone_number": "000-####-####",
    "address": {
      "country_code": "JP",
      "postal_code": "1010024",
      "province": "東京都",
      "city": "千代田区",
      "address1": "神田和泉町1-8-11",
      "address2": "サン・センタービル5F"
    }
  },
  "fulfillments": [
    {
      "id": "1",
      "status": "pending",
      "tracking_company": "yamato",
      "tracking_number": "4983892",
      "fulfillment_line_items": [
        {
          "id": "1",
          "order_line_item_id": 1,
          "quantity": 2
        }
      ],
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00"
    }
  ],
  "transactions": [
    {
      "id": "2",
      "parent_id": 1,
      "amount": 1000,
      "currency": "JPY",
      "status": "success",
      "gateway": "manual",
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00"
    }
  ],
  "metafields": [
    {
      "key": "coupon_code",
      "value": null
    }
  ]
}`)
	req, err := http.NewRequest("POST", "https://public.rcmr.io/api/v1/orders/import", payload)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(res.StatusCode, string(body))
}
```

### Rust

```rust
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let payload = r#"{
      "id": 1234567,
      "order_number": 1001,
      "status": "processing",
      "fulfillment_status": "fulfilled",
      "financial_status": "paid",
      "order_discount_amount": 100,
      "order_point_price": 100,
      "total_item_discount_amount": 100,
      "subtotal_price": 100,
      "total_shipping_price": "string",
      "total_discount": 100,
      "additional_fees_amount": 100,
      "total_price": 100,
      "total_tax": 100,
      "payment_at": "2023-05-10T12:00:00+09:00",
      "is_tax_included": true,
      "currency": "JPY",
      "quantity": 3,
      "created_at": "2023-05-10T12:00:00+09:00",
      "updated_at": "2023-05-12T10:30:00+09:00",
      "note": "テスト注文",
      "order_link": "https://recustomer.me/order/1",
      "customer": {
        "customer_id": "1",
        "email": "test@recustomer.co",
        "last_name": "佐藤",
        "first_name": "太郎",
        "full_name": "佐藤 太郎",
        "phone_number": "000-####-####",
        "is_consent_email_marketing": false,
        "is_consent_sms_marketing": false,
        "purchase_times": 11,
        "customer_tags": [
          "test顧客",
          "一般会員"
        ],
        "created_at": "2023-05-10T12:00:00+09:00",
        "updated_at": "2023-05-12T10:30:00+09:00",
        "metafields": [
          {
            "key": "coupon_code",
            "value": null
          }
        ]
      },
      "line_items": [
        {
          "id": "1000",
          "product_id": "product_id",
          "product_name": "テスト商品",
          "variant_id": "2538974832789",
          "sku": "product_id_S_Red",
          "item_image": "https://recustomer.me/image/12345",
          "item_discount_price": 100,
          "item_discount_amount": 100,
          "item_price": 100,
          "item_compare_at_price": 100,
          "item_cost": 100,
          "item_quantity": 1,
          "item_price_amount": 100,
          "item_tax_price": 100,
          "is_tax_included": true,
          "fulfillment_status": "null",
          "variant_options": [
            {
              "name": "カラー",
              "value": "レッド"
            }
          ],
          "created_at": "2023-05-10T12:00:00+09:00",
          "updated_at": "2023-05-12T10:30:00+09:00",
          "metafields": [
            {
              "key": "coupon_code",
              "value": null
            }
          ]
        }
      ],
      "shipping_address": {
        "first_name": "太郎",
        "last_name": "佐藤",
        "full_name": "佐藤 太郎",
        "email": "test@recustomer.co",
        "phone_number": "000-####-####",
        "address": {
          "country_code": "JP",
          "postal_code": "1010024",
          "province": "東京都",
          "city": "千代田区",
          "address1": "神田和泉町1-8-11",
          "address2": "サン・センタービル5F"
        }
      },
      "billing_address": {
        "first_name": "太郎",
        "last_name": "佐藤",
        "full_name": "佐藤 太郎",
        "email": "test@recustomer.co",
        "phone_number": "000-####-####",
        "address": {
          "country_code": "JP",
          "postal_code": "1010024",
          "province": "東京都",
          "city": "千代田区",
          "address1": "神田和泉町1-8-11",
          "address2": "サン・センタービル5F"
        }
      },
      "fulfillments": [
        {
          "id": "1",
          "status": "pending",
          "tracking_company": "yamato",
          "tracking_number": "4983892",
          "fulfillment_line_items": [
            {
              "id": "1",
              "order_line_item_id": 1,
              "quantity": 2
            }
          ],
          "created_at": "2023-05-10T12:00:00+09:00",
          "updated_at": "2023-05-12T10:30:00+09:00"
        }
      ],
      "transactions": [
        {
          "id": "2",
          "parent_id": 1,
          "amount": 1000,
          "currency": "JPY",
          "status": "success",
          "gateway": "manual",
          "created_at": "2023-05-10T12:00:00+09:00",
          "updated_at": "2023-05-12T10:30:00+09:00"
        }
      ],
      "metafields": [
        {
          "key": "coupon_code",
          "value": null
        }
      ]
    }"#;
    let response = reqwest::blocking::Client::new()
        .request(reqwest::Method::POST, "https://public.rcmr.io/api/v1/orders/import")
        .header("Authorization", "Bearer YOUR_API_TOKEN")
        .header("Content-Type", "application/json")
        .body(payload)
        .send()?;
    println!("{} {}", response.status(), response.text()?);
    Ok(())
}
```

## レスポンス (201)

```json
{
  "results": "success"
}
```
