DDPay Create Online Order
Description
建立 DDPay 線上付款訂單,回傳付款頁面網址(payment_url),供前端將客人導向完成付款。僅適用線上付款情境(LINE Pay、街口支付、全支付等由 DDPay 代為處理付款服務時)。若已知要導向的付款服務與類型,可選填帶入 payment_service、payment_type 直接導向該服務;未帶入時,付款頁面會顯示所有可用的付款服務供客人自行選擇。
若同一筆訂單編號已建立過付款中或已完成付款的 DDPay 訂單,將回傳現有訂單狀態,不會重複建立。
Resource
POST /v1/payment/ddpay/orders
Authorization
採用 OAuth 2.0 Bearer Token,詳細使用流程請參考 Auth Login。
Request Body Parameters
| Name | Type | Description |
|---|---|---|
| merchant_order_id | string | 我方訂單編號 |
| store_id | string | 門市編號 |
| payment_service | string | 指定付款服務,如 linepay、jko、pxpayplus;未帶入時由付款頁面顯示所有可用方式供客人自選(option) |
| payment_type | string | 指定付款類型,須配合 payment_service 一併帶入(option) |
| result_url | string | 付款完成後導向的前端頁面網址 (option) |
| cancel_url | string | 取消付款後導向的前端頁面網址 (option) |
Request Example
{
"merchant_order_id": "STORE001-20260616-001",
"store_id": "STORE001",
"payment_service": "linepay",
"payment_type": "linepay",
"result_url": "https://wixgo.example.com/result",
"cancel_url": "https://wixgo.example.com/cancel"
}
Response Body Parameters
| Name | Type | Description |
|---|---|---|
| ddpayOrderId | string | DDPay 訂單編號 |
| paymentUrl | string | 付款頁面網址,將客人瀏覽器導向此網址完成付款 |
Response Example
{
"ddpayOrderId": "250610154305QjDVpx",
"paymentUrl": "https://sandbox-web-pay.line.me/..."
}
Error Response
| HTTP Status | Description |
|---|---|
| 400 | 缺少必填欄位(merchant_order_id、store_id)或格式不符、訂單不存在、門市與訂單不符 |
| 401 | Authorization token 無效或過期 |
| 409 | 該訂單已建立過 DDPay 付款訂單,回傳既有訂單狀態 |
| 500 | 伺服器內部錯誤 |
{ "message": "錯誤說明文字" }