Shopify では、API を使用して注文を作成できるようになりました。簡単な例は次のとおりです。
/admin/orders.json への投稿
{
"order": {
"line_items": [
{
"variant_id": 447654529,
"quantity": 1
}
]
}
}
応答:
HTTP/1.1 201 Created
{
"order": {
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
"cart_token": null,
"checkout_token": null,
"closed_at": null,
"confirmed": true,
"created_at": "2014-05-23T14:17:59-04:00",
"currency": "USD",
"email": "",
"financial_status": "paid",
"fulfillment_status": null,
"gateway": "",
"id": 1073460004,
"landing_site": null,
"location_id": null,
"name": "#1002",
"note": null,
"number": 2,
"reference": null,
"referring_site": null,
"source": "api",
"source_identifier": null,
"source_name": "api",
"source_url": null,
"subtotal_price": "199.00",
"taxes_included": false,
"test": false,
"token": "c9afa7b7ecb0cc1a3e60652658c4c76c",
"total_discounts": "0.00",
"total_line_items_price": "199.00",
"total_price": "199.00",
"total_price_usd": "199.00",
"total_tax": "0.00",
"total_weight": 0,
"updated_at": "2014-05-23T14:17:59-04:00",
"user_id": null,
"browser_ip": null,
"landing_site_ref": null,
"order_number": 1002,
"discount_codes": [
],
"note_attributes": [
],
"processing_method": "",
"checkout_id": null,
"tax_lines": [
],
"tags": "",
"line_items": [
{
"fulfillment_service": "manual",
"fulfillment_status": null,
"gift_card": false,
"grams": 0,
"id": 1071823214,
"price": "199.00",
"product_id": 921728736,
"quantity": 1,
"requires_shipping": true,
"sku": null,
"taxable": true,
"title": "IPod Touch 8GB",
"variant_id": 447654529,
"variant_title": null,
"vendor": null,
"name": "IPod Touch 8GB",
"variant_inventory_management": "shopify",
"properties": [
],
"product_exists": true,
"fulfillable_quantity": 1,
"tax_lines": [
]
}
],
"shipping_lines": [
],
"fulfillments": [
],
"refunds": [
]
}
}