HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Create Order

❗️

Notice

Without calculate delivery_fee and payment_fee
目前尚未支援附加費與運費的計入

Function

To create an order with open API
透過open API創建一筆新訂單

URL

POST <<api_domain>>/v1/orders

Request Parameters

ParameterTypeDescriptionExample
order.delivery_option_id
*Required
StringID of Delivery Option
出貨方式之ID
-
*Currently not allowed third party delivery providers
暫不支援第三方物流串接方式
ruby "delivery_option_id":"58d3379401cda31bfb000000"
order.payment_method_id
*Required
StringID of Payment Option
付款方式之ID
-
*Currently not allowed third party payment service
暫不支援第三方金流串接方式
ruby "payment_method_id": "58d25b9d01cda3475300002d"
order.subtotal
*Required
FloatPrice Total for all order items
訂單小計,包含所有商品總價
ruby "subtotal": 3699
order.total
*Required
FloatFinal price total, including credits and discounts deducted.
付款總金額,為訂單小計扣除購物金與折扣
-
*Delivery fee and payment fee are not calculated
目前尚未支援附加費與運費的計入
ruby "total":3199
order.items
*Required
ArrayOrder product Item Data
訂單中商品資訊
ruby "items":[ { "item_type":"Product", "item_id":"5adedc00e388094414000033", "item_price": 999, "quantity": 1, "total": 999 }
order.customer_id
*必須和order.customer_email擇一Required
StringCustomer ID
顧客ID
ruby "customer_id":"5e0047dfc4101900263b1450"
order.customer_email
*必須和order.customer_id擇一Required
StringCustomer's Email
顧客Email
ruby "customer_email":"[email protected]"
order.customer_phoneStringCustomer's Phone
顧客電話
ruby "customer_phone":"0910123456"
order.delivery_address
*Required
Order DeliveryAddressDelivery Address Information
運送地址資訊
ruby "delivery_address": { "city": "台北市", "postcode": "10560", "address_2": "松山區", "address_1": "光復北路11巷44號14樓", "recipient_name": "Flash", "recipient_phone": "0227423966" "country": "台灣", "country_code": "TW" }
order.order_remarksStringAdd order remark to the order, cannot be updated via patch
order.user_creditIntegerCredits used for the order
訂單所使用之折抵購物金
ruby "user_credit"=30
order.member_pointNumberApplied Member Point
已使用購物金
120
order.opt_in_auto_reward'Boolean'Apply "Order Reward Credits" automatically
自動發送"滿額送購物金"
-
*Default: false
ruby "opt_in_auto_reward"=true
is_registering_as_memberBooleanDo you want to set the customer as a member?
是否要將此筆訂單顧客設為會員?
-
*Default: false
ruby "is_registering_as_member": true
is_inventory_fulfillmentBooleanDo you want to deduct the inventory numbers after the order is created?
此筆訂單是否要扣掉庫存?
-
*Default:false
ruby "is_inventory_fulfillment": true
mail_notifyBooleanDo you want to notify the customer of the order creation by email ?
此筆訂單成立之後是否要通知顧客?
-
*Default:false
ruby "mail_notify": false
created_fromStringOrder created from
訂單來源
-
*Default: admin_openapi
ruby "created_from": "admin_openapi"

*出貨方式/付款方式的ID可以由編輯頁面的url得到

1040

Request Example

Create an order with items, Product, CustomProduct, CustomDiscount

curl -X POST \
  <<api_domain>>/v1/orders \
  -H 'Authorization: Bearer access_token' \
  -H 'Content-Type: application/json' \
  -d '{
    "order": {
      "delivery_option_id": "58d3379401cda31bfb000000",
      "payment_method_id": "58d25b9d01cda3475300002d",
      "subtotal": "3699",
      "total": "3199",
      "items":[
        {
          "item_type": "Product",
          "item_id": "5adedc00e388094414000033",
          "item_price": 999,
          "quantity": 1,
          "total": 999
        },{
          "item_type": "Product",
          "item_id": "5a8165fbe38809548f0000fd",
          "variation_id": "5ad5ba52d2a93e6616000010",
          "item_price": 1500,
          "quantity": 1,
          "total": 1500
        },{
          "item_type": "CustomDiscount",
          "item_price": 500,
          "total": 500,
          "item_data": {
            "name": "DDD"
          }
        },{
          "item_type": "CustomProduct",
          "item_price": 600,
          "item_data": {
            "name": "Custom Product Name",
            "price": "600"
          },
          "quantity": 2,
          "total": 1200
        }
      ],
      "customer_email": "[email protected]",
      "customer_phone": "0910123456",
      "delivery_address": {
          "city": "台北市",
          "postcode": "10560",
          "address_2": "松山區",
          "address_1": "光復北路11巷44號14樓",
          "recipient_name": "Flash",
          "recipient_phone": "0227423966",
          "country": "台灣",
          "country_code": "TW"
      },
      "order_remarks": "Create my order remark",
      "user_credit": 0,
      "opt_in_auto_reward": false,
    },
    "is_registering_as_member": false,
    "is_inventory_fulfillment": false,
    "mail_notify": false,
    "created_from": "admin_openapi"
  }'

Response Example

Also same with Get Order

{
   "affiliate_data" : {},
   "channel" : {},
   "child_order_ids" : [],
   "confirmed_at" : null,
   "created_at" : "2021-05-31T03:17:48.055+00:00",
   "created_by" : "openapi",
   "created_from" : "admin_openapi", 
   "currency_iso" : "HKD",
   "custom_data" : [],
   "custom_discount_items" : [],
   "customer_email" : "[email protected]",
   "customer_id" : "6017ac19f1231200287bd3a7",
   "customer_info" : {},
   "customer_name" : "louis",
   "customer_phone" : "2345677",
   "delivery_address" : {
      "address_1" : null,
      "address_2" : null,
      "city" : null,
      "country" : null,
      "country_code" : null,
      "district" : null,
      "key" : null,
      "layer1" : null,
      "layer2" : null,
      "layer3" : null,
      "logistic_codes" : null,
      "postcode" : null,
      "recipient_name" : "louis",
      "recipient_phone" : "13823292627",
      "remarks" : null,
      "state" : null
   },
   "delivery_data" : {
      "hk_sfplus_home_region" : null,
      "location_code" : null,
      "location_name" : null,
      "name_translations" : null,
      "scheduled_delivery_date" : null,
      "store_address" : null,
      "time_slot_key" : null,
      "time_slot_translations" : {},
      "tracking_number" : "",
      "url" : null
   },
   "ga_tracked" : false,
   "id" : "60b4555be02b9b001f421a6a",
   "invoice" : {
      "buyer_name" : "",
      "carrier_number" : "",
      "carrier_type" : "",
      "invoice_cancelled_at" : null,
      "invoice_date" : null,
      "invoice_number" : "",
      "invoice_status" : "",
      "invoice_tax_type" : "",
      "invoice_type" : "",
      "mailing_address" : "",
      "n_p_o_b_a_n" : "",
      "tax_id" : ""
   },
   "merchant_order_number" : "000036",
   "order_comments" : [],
   "order_delivery" : {
      "arrived_at" : null,
      "collected_at" : null,
      "delivery_option_id" : "5fb378e240cfc3002af35205",
      "delivery_status" : "pending",
      "exp_type" : null,
      "name_translations" : {
         "en" : "S.F. Express - EF Locker Pickup",
         "th" : "",
         "zh-hant" : "顺丰快递-顺丰智能柜"
      },
      "platform" : "custom",
      "remark" : null,
      "request_accepted_at" : null,
      "request_authorized_at" : null,
      "request_submitted_at" : null,
      "requested_fmt_at" : null,
      "require_expired_upload" : false,
      "require_storeclosed_upload" : false,
      "return_order_id" : null,
      "returned_at" : null,
      "shipped_at" : null,
      "status" : "pending",
      "store_closed_at" : null,
      "storeclosed_upload_at" : null,
      "total" : {
         "cents" : 500,
         "currency_iso" : "HKD",
         "currency_symbol" : "HK$",
         "dollars" : 5,
         "label" : "HK$5.00"
      }
   },
   "order_discount" : {
      "cents" : 0,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 0,
      "label" : ""
   },
   "order_notes" : [],
   "order_number" : "000036",
   "order_payment" : {
      "created_at" : "2021-05-31T03:17:48.047+00:00",
      "id" : "60b4555ce02b9b001f421a6e",
      "last_four_digits" : "",
      "name_translations" : {
         "en" : "Cash on Delivery",
         "zh-hant" : "貨到付款"
      },
      "paid_at" : null,
      "payment_data" : {},
      "payment_fee" : {
         "cents" : 0,
         "currency_iso" : "HKD",
         "currency_symbol" : "HK$",
         "dollars" : 0,
         "label" : ""
      },
      "payment_method_id" : "5fcf32781bafc100471ae19c",
      "payment_type" : "cash_on_delivery",
      "ref_payment_id" : null,
      "status" : "temp",
      "total" : {
         "cents" : 3010,
         "currency_iso" : "HKD",
         "currency_symbol" : "HK$",
         "dollars" : 30.1,
         "label" : "HK$30.10"
      },
      "updated_at" : "2021-05-31T03:17:48.047+00:00"
   },
   "order_points" : 200,
   "order_points_to_cash" : {
      "cents" : 20,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 0.2,
      "label" : "HK$0.20"
   },
   "order_remarks" : null,
   "parent_order_id" : "",
   "payment_slips" : [],
   "promotion_items" : [],
   "ref_customer_id" : "test_id",
   "ref_order_id" : "",
   "skip_fulfillment" : true,
   "split_at" : null,
   "status" : "pending",
   "subtotal" : {
      "cents" : 5010,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 50.1,
      "label" : "HK$50.10"
   },
   "subtotal_items" : [
      {
         "cost" : {
            "cents" : 0,
            "currency_iso" : "HKD",
            "currency_symbol" : "HK$",
            "dollars" : 0,
            "label" : ""
         },
         "created_by" : "admin",
         "discounted_price" : null,
         "fields_translations" : {},
         "id" : "60b4555ce02b9b001f421a6d",
         "is_preorder" : false,
         "item_data" : {},
         "item_id" : "5fd1e2671bafc178701ae195",
         "item_price" : {
            "cents" : 5010,
            "currency_iso" : "HKD",
            "currency_symbol" : "HK$",
            "dollars" : 50.1,
            "label" : "HK$50.10"
         },
         "item_type" : "Product",
         "item_variation_id" : "",
         "item_variation_key" : "",
         "media" : {
            "_id" : "5fd1e2551bafc178701ae194",
            "alt_translations" : {},
            "images" : {
               "favicon" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "favicon_large" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "favicon_small" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "original" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "source" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "thumb" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "transparent_large" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "transparent_thumb" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               },
               "transparent_xlarge" : {
                  "height" : 1920,
                  "url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fd1e2551bafc178701ae194/original.jpg?1607590485",
                  "width" : 1920
               }
            }
         },
         "object_data" : {
            "adult" : "no",
            "age_group" : "all_ages",
            "barcode_type" : "Code 128",
            "condition" : "new",
            "gender" : "unisex",
            "gtin" : "",
            "max_order_quantity" : -1,
            "mpn" : ""
         },
         "order_discounted_price" : null,
         "price" : {
            "cents" : 5010,
            "currency_iso" : "HKD",
            "currency_symbol" : "HK$",
            "dollars" : 50.1,
            "label" : "HK$50.10"
         },
         "product_subscription_id" : null,
         "quantity" : 1,
         "ref_data" : null,
         "sku" : "",
         "title_translations" : {
            "en" : "pencil1"
         },
         "total" : {
            "cents" : 5010,
            "currency_iso" : "HKD",
            "currency_symbol" : "HK$",
            "dollars" : 50.1,
            "label" : "HK$50.10"
         }
      }
   ],
   "system_order_number" : "20210531031747230",
   "tags" : [],
   "total" : {
      "cents" : 3010,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 30.1,
      "label" : "HK$30.10"
   },
   "total_tax_fee" : {
      "cents" : 0,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 0,
      "label" : ""
   },
   "updated_at" : "2021-05-31T03:17:48.204+00:00",
   "user_credit" : {
      "cents" : 0,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 0,
      "label" : ""
   },
   "utm_data" : {}
}