create_shipment
Create a Taiwan shipment via ECPay 綠界 Logistics — either 超商取貨 (CVS convenience-store pickup: 7-11 / 全家 FamilyMart / 萊爾富 Hi-Life / OK) or 宅配 (home delivery: 黑貓 TCAT / 中華郵政 POST). Bring your own ECPay credentials via headers x-ecpay-merchant-id, x-ecpay-hash-key, x-ecpay-hash-iv (+ x-ecpay-mode: production to hit the live host). With NO credential headers it runs in DEMO mode on ECPay stage using the official public test merchant — a real test AllPayLogisticsID is returned but nothing ships. logistics_type CVS needs receiver_store_id (a store code from ECPay電子地圖; the stage demo defaults to test store 131386). logistics_type HOME needs sender/receiver address + zip. Set is_collection=true for cash-on-delivery (代收貨款) — collection_amount defaults to goods_amount. Returns AllPayLogisticsID (as shipment_id) used by query_shipment and print_label.
Parameters19
| logistics_type | string | required | CVS = 超商取貨 (store pickup); HOME = 宅配 (home delivery). Must match sub_type. |
| sub_type | string | required | Carrier/flow. CVS C2C (individual seller): UNIMARTC2C(7-11) / FAMIC2C / HILIFEC2C / OKMARTC2C. CVS B2C (business): UNIMART / FAMI / HILIFE. HOME: TCAT(黑貓) / POST(郵局). |
| goods_amount | integer | required | Declared goods value in TWD (integer). Also the COD amount when is_collection=true. |
| goods_name | string | optional | Goods description (<=50 chars). Default "商品一批". |
| is_collection | boolean | optional | true = cash-on-delivery 代收貨款 (buyer pays at pickup). Default false. collection_amount defaults to goods_amount. |
| collection_amount | integer | optional | COD amount in TWD (only when is_collection=true). Defaults to goods_amount. |
| sender_name | string | required | Sender name (寄件人, <=10 chars, no digits/symbols). |
| sender_phone | string | optional | Sender landline or mobile (擇一必填 with sender_cellphone). |
| sender_cellphone | string | optional | Sender mobile 09xxxxxxxx. |
| receiver_name | string | required | Receiver name (收件人, <=10 chars, no digits/symbols). |
| receiver_phone | string | optional | Receiver landline. |
| receiver_cellphone | string | optional | Receiver mobile 09xxxxxxxx (required for CVS pickup SMS notification). |
| receiver_email | string | optional | Optional receiver email. |
| receiver_store_id | string | optional | CVS only: pickup store code from ECPay電子地圖. Demo/stage defaults to test store 131386. |
| sender_zip | string | optional | HOME only: sender postal code. |
| sender_address | string | optional | HOME only: sender full address. |
| receiver_zip | string | optional | HOME only: receiver postal code. |
| receiver_address | string | optional | HOME only: receiver full address. |
| server_reply_url | string | optional | Optional server-to-server status callback URL (ECPay posts logistics updates here). A placeholder is used if omitted. |
Raw schema
{
"type": "object",
"properties": {
"logistics_type": {
"type": "string",
"enum": [
"CVS",
"HOME"
],
"description": "CVS = 超商取貨 (store pickup); HOME = 宅配 (home delivery). Must match sub_type."
},
"sub_type": {
"type": "string",
"enum": [
"UNIMARTC2C",
"FAMIC2C",
"HILIFEC2C",
"OKMARTC2C",
"UNIMART",
"FAMI",
"HILIFE",
"TCAT",
"POST"
],
"description": "Carrier/flow. CVS C2C (individual seller): UNIMARTC2C(7-11) / FAMIC2C / HILIFEC2C / OKMARTC2C. CVS B2C (business): UNIMART / FAMI / HILIFE. HOME: TCAT(黑貓) / POST(郵局)."
},
"goods_amount": {
"type": "integer",
"description": "Declared goods value in TWD (integer). Also the COD amount when is_collection=true."
},
"goods_name": {
"type": "string",
"description": "Goods description (<=50 chars). Default \"商品一批\"."
},
"is_collection": {
"type": "boolean",
"description": "true = cash-on-delivery 代收貨款 (buyer pays at pickup). Default false. collection_amount defaults to goods_amount."
},
"collection_amount": {
"type": "integer",
"description": "COD amount in TWD (only when is_collection=true). Defaults to goods_amount."
},
"sender_name": {
"type": "string",
"description": "Sender name (寄件人, <=10 chars, no digits/symbols)."
},
"sender_phone": {
"type": "string",
"description": "Sender landline or mobile (擇一必填 with sender_cellphone)."
},
"sender_cellphone": {
"type": "string",
"description": "Sender mobile 09xxxxxxxx."
},
"receiver_name": {
"type": "string",
"description": "Receiver name (收件人, <=10 chars, no digits/symbols)."
},
"receiver_phone": {
"type": "string",
"description": "Receiver landline."
},
"receiver_cellphone": {
"type": "string",
"description": "Receiver mobile 09xxxxxxxx (required for CVS pickup SMS notification)."
},
"receiver_email": {
"type": "string",
"description": "Optional receiver email."
},
"receiver_store_id": {
"type": "string",
"description": "CVS only: pickup store code from ECPay電子地圖. Demo/stage defaults to test store 131386."
},
"sender_zip": {
"type": "string",
"description": "HOME only: sender postal code."
},
"sender_address": {
"type": "string",
"description": "HOME only: sender full address."
},
"receiver_zip": {
"type": "string",
"description": "HOME only: receiver postal code."
},
"receiver_address": {
"type": "string",
"description": "HOME only: receiver full address."
},
"server_reply_url": {
"type": "string",
"description": "Optional server-to-server status callback URL (ECPay posts logistics updates here). A placeholder is used if omitted."
}
},
"required": [
"logistics_type",
"sub_type",
"goods_amount",
"sender_name",
"receiver_name"
]
}