HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Create Purchase Order

Function

To create purchase order
建立進貨單

URL

POST https://open.shopline.io/v1/pos/purchase_orders

Request Parameters

ParameterTypeDescriptionExample
purchase_order.type
*Required
Stringtype of PurchaseOrder
purchase
return
purchase
purchase_order.scheduled_timeDateTimePurchase Order Scheduled Arrival Date2018-01-10T06:33:45.231+00:00
purchase_order.actual_timeDateTimePurchase Order Completed Date2018-01-10T06:33:45.231+00:00
purchase_order.other_feeFloatPurchase Order Other Fee111
purchase_order.noteStringPurchase Order Remarksremark
purchase_order.issuer_idStringPurchase Order Issuer ID6095098351f9cf003e6768fe
purchase_order.executor_idStringPurchase Order Executor ID6095098351f9cf003e6768fe
purchase_order.channel_id
*Required
StringPurchase Order Channel ID6095098351f9cf003e6768fe
purchase_order.items
*Required
ArrayPurchase Order Products
ParameterTypeDescriptionExample
item.product_idStringProduct ID6095098351f9cf003e6768fe
item.variation_idStringVariation ID6095098351f9cf003e6768fe
item.total_quantityIntegerTotal Quantity1
item.current_quantityIntegerCurrent Quantity1
item.supplier_idStringProduct Supplier ID
If supplier is set in Product, then this field will be set to product's supplier ID
6095098351f9cf003e6768fe
item.purchase_priceFloatIf the type of the purchase order is return, it means refund
If the type of the purchase order is purchase, it means purchase price
111

Request Example

curl --location --request POST 'https://open.shopline.com/v1/pos/purchase_orders' \
--header 'Authorization: Bearer ${token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "purchase_order": {
        "type": "purchase",
        "channel_id": "62de16f6d7043e0047a0942e",
        "items": [
            {"product_id": "64059daa9843a6003ce3e805", "total_quantity": 1}
        ]
    }
}'

Response Body

{
    "created_at": "2023-03-21T08:54:31.806Z",
    "updated_at": "2023-03-21T08:54:31.806Z",
    "type": "purchase",
    "number": "20230321085431306",
    "custom_number": null,
    "status": "pending",
    "arrival_status": "pending_to_receive",
    "scheduled_time": null,
    "actual_time": null,
    "other_fee": {
        "cents": 0,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "",
        "dollars": 0.0
    },
    "total_amount": {
        "cents": 0,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "",
        "dollars": 0.0
    },
    "current_amount": {
        "cents": 0,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "",
        "dollars": 0.0
    },
    "total_quantity": 1,
    "current_quantity": 0,
    "note": null,
    "child_id": null,
    "group_id": null,
    "wapos_id": null,
    "id": "641970c7f5f261003f2feab8",
    "issuer": null,
    "executor": null,
    "channel": {
        "name": {
            "en": "He貓店3",
            "zh-hant": "He貓店3"
        },
        "id": "62de16f6d7043e0047a0942e",
        "warehouse_id": "60f6654a0c801333984b34c7"
    },
    "items": [
        {
            "product_id": "64059daa9843a6003ce3e805",
            "variation_id": null,
            "product_name": {
                "zh-hant": "GIF不會動"
            },
            "variation_titles": null,
            "variation_name": null,
            "image_url": "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/6405a1579843a6003ce3e815/original.gif?1678090582",
            "sku": "fku6900",
            "gtin": "64264990",
            "total_quantity": 1,
            "current_quantity": 0,
            "purchase_price": {
                "cents": 0,
                "currency_symbol": "NT$",
                "currency_iso": "TWD",
                "label": "",
                "dollars": 0.0
            },
            "supplier_id": null,
            "subtotal": {
                "cents": 0,
                "currency_symbol": "NT$",
                "currency_iso": "TWD",
                "label": "",
                "dollars": 0.0
            },
            "price": {
                "cents": 100,
                "currency_symbol": "NT$",
                "currency_iso": "TWD",
                "label": "NT$100",
                "dollars": 100.0
            },
            "product_removed": false,
            "id": "641970c7f5f261003f2feab7",
            "stocks": {
                "60f6654a0c801333984b34c7": 0
            },
            "unlimited_quantity": true,
            "same_price": false,
            "supplier_name": null
        }
    ],
    "has_removed_items": false,
    "group_purchase_orders": null
}