公開串接文件
快速開始
PayCore 串接先取得 PayCore API Key,決定 Direct Gateway 或 All-in-One 收款專案,再呼叫建立付款 API。可用上方搜尋框依金流、付款方式、欄位或 endpoint 搜尋。
1. API 認證X-API-KEY
2. gateway_credentials每家金流各自填憑證
3. 建立付款POST /api/paycore/pay/{gateway}/{method}
X-API-KEY
API 認證
PayCore API 使用 X-API-KEY Header 驗證呼叫方;各金流商店憑證放在 request body 的 gateway_credentials。
Direct / All-in-One
串接模式
Direct Gateway 適合商戶直接帶金流憑證建立付款;All-in-One 收款專案則由 PayCore 專案 API Key 統一管理付款頁與付款方式。
Webhook
Webhook 概念
金流回調會先更新 PayCore 付款狀態;若商戶有提供 payok_url,PayCore 會在付款成功後通知商戶系統。付款頁也會背景查詢狀態,降低使用者手動刷新需求。
COMMON
共用 API
所有金流共用的查詢、同步、首頁概況。
商戶可呼叫 API
GET
/api/paycore/payments/{paymentNo}
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
X-API-KEY |
header |
必填 |
string |
PayCore API Key。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
paymentNo |
path |
必填 |
string |
PayCore payment_no。 |
PAY202606220001ABCDEFGH |
Request / Response 範例
curl -X GET "https://api-core.cc/api/paycore/payments/{paymentNo}" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY"
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->get('https://api-core.cc/api/paycore/payments/{paymentNo}');
return $response->json();
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | smilepay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款狀態。 | pending|paid|failed|expired |
data.payment_url | string|null | PayCore 付款頁網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | 金流取號資訊或前端付款資訊。 | {...} |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "smilepay",
"method": "atm",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"bank_code": "809",
"bank_name": "凱基銀行",
"virtual_account": "8011773423689453",
"expire_at": "2026-06-28 23:59:59"
}
},
"message": "Payment found"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
POST
/api/paycore/payments/{paymentNo}/sync
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
paymentNo |
path |
必填 |
string |
PayCore payment_no。 |
PAY202606220001ABCDEFGH |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/payments/{paymentNo}/sync" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/payments/{paymentNo}/sync', []);
return $response->json();
成功回應重點
PaymentSyncResult + transaction data
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | smilepay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款狀態。 | pending|paid|failed|expired |
data.payment_url | string|null | PayCore 付款頁網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | 金流取號資訊或前端付款資訊。 | {...} |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "smilepay",
"method": "atm",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"bank_code": "809",
"bank_name": "凱基銀行",
"virtual_account": "8011773423689453",
"expire_at": "2026-06-28 23:59:59"
}
},
"message": "Payment synced"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
gateway_sync_not_supported
PAYMENT_NOT_FOUND
GET
/api/paycore/home/overview
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
X-PayCore-Timezone |
header |
選填 |
IANA timezone |
瀏覽器時區,例如 Asia/Taipei。 |
Asia/Taipei |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
timezone |
query |
選填 |
IANA timezone |
時區 query 參數。 |
Asia/Taipei |
Request / Response 範例
curl -X GET "https://api-core.cc/api/paycore/home/overview" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY"
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->get('https://api-core.cc/api/paycore/home/overview');
return $response->json();
成功回應重點
today_amount
month_amount
recent_transactions
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "home",
"method": "overview",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
此 API 沒有額外列出的專屬錯誤碼;仍可能回傳通用驗證錯誤。
ECPAY
綠界 ECPay
支援綠界 AIO 導轉付款與 ATM / CVS / BARCODE 背景取號。
商戶可呼叫 API
POST
/api/paycore/pay/ecpay/aio
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/aio" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/aio', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
merchant_order_no
gateway=ecpay
method=all
status=pending
payment_url
redirect_form
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "aio",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ORDER_CONFLICT
INVALID_ARGUMENT
Payment gateway error
AIO 取號成功仍為 pending,不等於付款成功。
POST
/api/paycore/pay/ecpay/aio/credit
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/aio/credit" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/aio/credit', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
merchant_order_no
gateway=ecpay
method=credit
status=pending
payment_url
redirect_form
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "aio",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ORDER_CONFLICT
INVALID_ARGUMENT
Payment gateway error
POST
/api/paycore/pay/ecpay/aio/atm
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/aio/atm" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/aio/atm', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
merchant_order_no
gateway=ecpay
method=atm
status=pending
payment_url
redirect_form
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "aio",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ORDER_CONFLICT
ECPAY amount mismatch
AIO ATM 需要先導到綠界頁面,回站後由 token 付款頁顯示取號資訊。
POST
/api/paycore/pay/ecpay/aio/cvs
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/aio/cvs" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/aio/cvs', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
merchant_order_no
gateway=ecpay
method=cvs
status=pending
payment_url
redirect_form
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "aio",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ECPAY amount mismatch
POST
/api/paycore/pay/ecpay/aio/barcode
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/aio/barcode" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/aio/barcode', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
merchant_order_no
gateway=ecpay
method=barcode
status=pending
payment_url
redirect_form
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | barcode |
data.payment_url | string|null | PayCore 條碼繳費頁網址。付款人到超商時開啟此網址掃描三段條碼。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info.*.barcode_user_copy_url | string | 建議複製給付款人的繳費頁網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info.*.barcode_segments_copyable | boolean | 固定為 false;Barcode1/2/3 僅供畫面轉條碼掃描,不作為主要複製項目。 | false |
data.payment_info.*.barcode_intro_url | string|null | 對應金流的官方條碼繳費介紹連結。綠界顯示綠界,速買配顯示速買配。 | https://... |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "barcode",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"ecpay": {
"selected_payment_method": "barcode",
"barcode1": "150630A1F",
"barcode2": "6763618191673429",
"barcode3": "00000980000000000000",
"barcode_user_copy_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"barcode_segments_copyable": false,
"barcode_user_action": "copy_payment_page_url_and_scan_rendered_barcodes",
"barcode_intro_url": "https://www.ecpay.com.tw/introcvs",
"expire_at": "2026-06-28 23:59:59"
}
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ECPAY amount mismatch
台灣條碼繳費只建議複製繳費頁網址,讓付款人到超商掃描頁面上的三段條碼;付款頁只顯示綠界條碼繳費介紹連結。
POST
/api/paycore/pay/ecpay/atm
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/atm" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/atm', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
bank_code
virtual_account
expire_at
payment_url
status=pending
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "bg",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ORDER_CONFLICT
ECPAY_BACKGROUND_CODE_FAILED
POST
/api/paycore/pay/ecpay/cvs
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/cvs" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/cvs', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_code
payment_code_url
expire_at
payment_url
status=pending
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "bg",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ORDER_CONFLICT
ECPAY_BACKGROUND_CODE_FAILED
POST
/api/paycore/pay/ecpay/barcode
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_id |
gateway_credentials |
必填 |
string |
綠界特店編號。亦相容 MerchantID。 |
2000132 |
hash_key |
gateway_credentials |
必填 |
string |
綠界 HashKey。亦相容 HashKey。 |
5294y06JbISpM5x9 |
hash_iv |
gateway_credentials |
必填 |
string |
綠界 HashIV。亦相容 HashIV。 |
v77hoKGq4kWxNNIS |
environment |
gateway_credentials |
選填 |
stage|production |
環境。支援 stage/staging/test/testing 或 production/prod。 |
stage |
platform_id |
gateway_credentials |
選填 |
string |
綠界 PlatformID,只有特定平台商情境需要。 |
|
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/ecpay/barcode" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"merchant_id": "YOUR_ECPAY_MERCHANT_ID",
"hash_key": "YOUR_HASH_KEY",
"hash_iv": "YOUR_HASH_IV",
"environment": "stage"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/ecpay/barcode', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
barcode1
barcode2
barcode3
expire_at
payment_url
status=pending
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | barcode |
data.payment_url | string|null | PayCore 條碼繳費頁網址。付款人到超商時開啟此網址掃描三段條碼。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info.*.barcode_user_copy_url | string | 建議複製給付款人的繳費頁網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info.*.barcode_segments_copyable | boolean | 固定為 false;Barcode1/2/3 僅供畫面轉條碼掃描,不作為主要複製項目。 | false |
data.payment_info.*.barcode_intro_url | string|null | 對應金流的官方條碼繳費介紹連結。綠界顯示綠界,速買配顯示速買配。 | https://... |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "ecpay",
"method": "barcode",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"ecpay": {
"selected_payment_method": "barcode",
"barcode1": "150630A1F",
"barcode2": "6763618191673429",
"barcode3": "00000980000000000000",
"barcode_user_copy_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"barcode_segments_copyable": false,
"barcode_user_action": "copy_payment_page_url_and_scan_rendered_barcodes",
"barcode_intro_url": "https://www.ecpay.com.tw/introcvs",
"expire_at": "2026-06-28 23:59:59"
}
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPAY_CREDENTIAL_INVALID
ORDER_CONFLICT
ECPAY_BACKGROUND_CODE_FAILED
台灣條碼繳費只建議複製繳費頁網址,不提供 Barcode1/2/3 字串複製;付款頁只顯示綠界條碼繳費介紹連結。
Webhook / Return 說明
POST
/api/paycore/webhooks/ecpay
參數表
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
MerchantID |
body |
選填 |
string |
綠界特店編號。AIO 或背景取號 JSON callback 都可能出現。 |
2000132 |
RqHeader |
body |
選填 |
object |
綠界背景取號 JSON callback 的傳輸標頭。 |
{"Timestamp":1782144000} |
Data |
body |
選填 |
string |
綠界背景取號 JSON callback 的 AES 加密資料;PayCore 會容錯處理 base64 + 被轉成空白的情況。 |
encrypted-data |
TransCode |
body |
選填 |
integer |
綠界背景取號 JSON callback 的傳輸結果。 |
1 |
MerchantTradeNo |
body |
選填 |
string |
綠界交易編號,對應 gateway_order_no。 |
PC202606220001 |
CustomField1 |
body |
選填 |
string |
PayCore payment_no。 |
PAY202606220001ABCDEFGH |
TradeAmt |
body |
選填 |
integer |
綠界回傳金額,PayCore 會比對交易金額。 |
980 |
RtnCode |
body |
選填 |
string |
綠界狀態碼。取號成功不等於付款成功。 |
2 |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/webhooks/ecpay" \
-H "Content-Type: application/json" \
-d '{
"event_type": "example.event",
"resource": {
"payment_no": "PAY202606220001ABCDEFGH"
}
}'
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | application/json |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | {"success":true} |
成功 Response 範例
{
"success": true,
"message": "Webhook received"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
ECPay MerchantID mismatch.
ECPay amount mismatch.
ECPay CheckMacValue verification failed.
ECPay encrypted background callback transaction not found.
SMILEPAY
速買配 SmilePay
支援 ATM 虛擬帳號、CVS 超商代碼與獨立超商條碼付款。
商戶可呼叫 API
POST
/api/paycore/pay/smilepay/atm
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
dcvc |
gateway_credentials |
必填 |
string |
速買配商家代號。亦相容 Dcvc。 |
2109 |
rvg2c |
gateway_credentials |
必填 |
string |
速買配 Rvg2c。通常為 1。亦相容 Rvg2c。 |
1 |
verify_key |
gateway_credentials |
必填 |
string |
速買配檢查碼 Verify_key。 |
YOUR_VERIFY_KEY |
validation_token |
gateway_credentials |
選填 |
string |
PayCore 額外自訂的回調驗證 token,可用於模擬與防誤打。 |
optional-token |
default_cvs_type |
gateway_credentials |
選填 |
ibon|fami|famiport|barcode |
未傳 cvs_type 時的預設超商類型。 |
ibon |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/smilepay/atm" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"dcvc": "YOUR_SMILEPAY_DCVC",
"rvg2c": "1",
"verify_key": "YOUR_VERIFY_KEY"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/smilepay/atm', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
SmilePayNO
AtmBankNo
AtmNo
PayEndDate
status
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "smilepay",
"method": "atm",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
SMILEPAY_CREDENTIAL_INVALID
SmilePay amount mismatch.
SmilePay Dcvc mismatch.
Amount 必須與建立付款 amount 一致。
POST
/api/paycore/pay/smilepay/cvs
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
cvs_type |
body |
選填 |
ibon|fami|famiport|family |
超商代碼類型。family 會正規化為 fami。條碼請改用 /api/paycore/pay/smilepay/barcode。 |
ibon |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
dcvc |
gateway_credentials |
必填 |
string |
速買配商家代號。亦相容 Dcvc。 |
2109 |
rvg2c |
gateway_credentials |
必填 |
string |
速買配 Rvg2c。通常為 1。亦相容 Rvg2c。 |
1 |
verify_key |
gateway_credentials |
必填 |
string |
速買配檢查碼 Verify_key。 |
YOUR_VERIFY_KEY |
validation_token |
gateway_credentials |
選填 |
string |
PayCore 額外自訂的回調驗證 token,可用於模擬與防誤打。 |
optional-token |
default_cvs_type |
gateway_credentials |
選填 |
ibon|fami|famiport|barcode |
未傳 cvs_type 時的預設超商類型。 |
ibon |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/smilepay/cvs" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"cvs_type": "ibon",
"gateway_credentials": {
"dcvc": "YOUR_SMILEPAY_DCVC",
"rvg2c": "1",
"verify_key": "YOUR_VERIFY_KEY"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/smilepay/cvs', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
SmilePayNO
payment_code
PayEndDate
status
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "smilepay",
"method": "cvs",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
SMILEPAY_CREDENTIAL_INVALID
SmilePay amount mismatch.
SmilePay validation token mismatch.
POST
/api/paycore/pay/smilepay/barcode
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
dcvc |
gateway_credentials |
必填 |
string |
速買配商家代號。亦相容 Dcvc。 |
2109 |
rvg2c |
gateway_credentials |
必填 |
string |
速買配 Rvg2c。通常為 1。亦相容 Rvg2c。 |
1 |
verify_key |
gateway_credentials |
必填 |
string |
速買配檢查碼 Verify_key。 |
YOUR_VERIFY_KEY |
validation_token |
gateway_credentials |
選填 |
string |
PayCore 額外自訂的回調驗證 token,可用於模擬與防誤打。 |
optional-token |
default_cvs_type |
gateway_credentials |
選填 |
ibon|fami|famiport|barcode |
未傳 cvs_type 時的預設超商類型。 |
ibon |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/smilepay/barcode" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"dcvc": "YOUR_SMILEPAY_DCVC",
"rvg2c": "1",
"verify_key": "YOUR_VERIFY_KEY"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/smilepay/barcode', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
SmilePayNO
barcode1
barcode2
barcode3
barcode_user_copy_url
barcode_intro_url
PayEndDate
status
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.gateway | string | 金流代號。 | smilepay |
data.method | string | 付款方式。 | barcode |
data.payment_url | string|null | PayCore 條碼繳費頁網址。付款人到超商時開啟此網址掃描三段條碼。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info.*.barcode_user_copy_url | string | 建議複製給付款人的繳費頁網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info.*.barcode_segments_copyable | boolean | 固定為 false;Barcode1/2/3 僅供畫面轉條碼掃描,不作為主要複製項目。 | false |
data.payment_info.*.barcode_intro_url | string|null | 對應金流的官方條碼繳費介紹連結。綠界顯示綠界,速買配顯示速買配。 | https://... |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "smilepay",
"method": "barcode",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"smilepay": {
"selected_payment_method": "barcode",
"barcode1": "150630A1F",
"barcode2": "6763618191673429",
"barcode3": "00000980000000000000",
"barcode_user_copy_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"barcode_segments_copyable": false,
"barcode_user_action": "copy_payment_page_url_and_scan_rendered_barcodes",
"barcode_intro_url": "https://www.smilepay.net/es/index_gz_index.asp",
"expire_at": "2026-06-28 23:59:59"
}
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
SMILEPAY_CREDENTIAL_INVALID
SMILEPAY_BARCODE_SERVICE_NOT_ENABLED
SmilePay amount mismatch.
SmilePay validation token mismatch.
付款頁只顯示速買配條碼繳費介紹連結,不混用綠界說明。
若速買配回覆 Can not use this Pay_zg service(Store),PayCore 會回 422 與 SMILEPAY_BARCODE_SERVICE_NOT_ENABLED,不建立付款單、不回 502。
Webhook / Return 說明
POST
/api/paycore/webhooks/smilepay
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
選填 |
form/json |
速買配可能以表單或 PayCore 模擬 JSON 傳入。 |
application/x-www-form-urlencoded |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Dcvc |
body |
必填 |
string |
商家代號,PayCore 會與交易憑證比對。 |
2109 |
Data_id |
body |
必填 |
string |
商戶訂單號,對應 merchant_order_no。 |
ORDER202606220202111 |
SmilePayNO |
body |
選填 |
string |
速買配交易號,PayCore 優先用它匹配 gateway_trade_no。 |
062223689453 |
Amount |
body |
必填 |
integer|string |
付款金額。必須與原建立付款的 amount 一致。 |
980 |
Status |
body |
必填 |
string|integer |
狀態。Status=1 代表成功。 |
1 |
AtmBankNo |
body |
選填 |
string |
ATM 銀行代碼。 |
809 |
AtmNo |
body |
選填 |
string |
ATM 虛擬帳號。 |
8011773423689453 |
PayEndDate |
body |
選填 |
datetime|string |
繳費期限。 |
2026/06/28 23:59:59 |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/webhooks/smilepay" \
-H "Content-Type: application/json" \
-d '{
"event_type": "example.event",
"resource": {
"payment_no": "PAY202606220001ABCDEFGH"
}
}'
成功回應重點
plain text acknowledgement
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | text/plain |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | OK |
成功 Response 範例
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
OK
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
SmilePay Dcvc mismatch.
SmilePay amount mismatch.
SmilePay validation token mismatch.
若回 SmilePay amount mismatch,請查 paycore.log 的 SmilePay amount mismatch detail:expected_amount、received_amount、matched_by、payload_data_id、payload_smilepay_no。
PAYPAL
PayPal
支援 PayPal Checkout 建立訂單、Return Capture 與 Webhook。
商戶可呼叫 API
POST
/api/paycore/pay/paypal/checkout
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
client_id |
gateway_credentials |
必填 |
string |
PayPal REST API client_id。 |
PAYPAL_CLIENT_ID |
client_secret |
gateway_credentials |
必填 |
string |
PayPal REST API client_secret。 |
PAYPAL_CLIENT_SECRET |
environment |
gateway_credentials |
選填 |
sandbox|live|production |
PayPal 環境。production 會正規化為 live。 |
sandbox |
webhook_id |
gateway_credentials |
選填 |
string |
PayPal webhook 驗證用 webhook_id。正式環境建議設定。 |
WH-xxxxxxxx |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/paypal/checkout" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"client_id": "PAYPAL_CLIENT_ID",
"client_secret": "PAYPAL_CLIENT_SECRET",
"webhook_id": "PAYPAL_WEBHOOK_ID",
"environment": "sandbox"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/paypal/checkout', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url / approval_url
status
created
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "paypal",
"method": "checkout",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
PAYPAL_CLIENT_ID_REQUIRED
PAYPAL_CLIENT_SECRET_REQUIRED
PAYPAL_ENVIRONMENT_INVALID
PAYPAL_REQUEST_REJECTED
PayPal 正式上線通常需要 PayPal Business account。
Webhook / Return 說明
GET
/{locale}/payment/paypal/return/{paymentNo}
參數表
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
paymentNo |
path |
必填 |
string |
PayCore payment_no。 |
PAY202606220001ABCDEFGH |
token |
query |
選填 |
string |
PayPal return token / order id。 |
PAYPAL_ORDER_ID |
Request / Response 範例
curl -X GET "https://api-core.cc/{locale}/payment/paypal/return/{paymentNo}" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY"
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | application/json |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | {"success":true} |
成功 Response 範例
{
"type": "html",
"description": "PayCore result page"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
POST
/api/paycore/webhooks/paypal
參數表
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
event_type |
body |
必填 |
string |
PayPal webhook 事件類型。 |
CHECKOUT.ORDER.APPROVED |
resource |
body |
必填 |
object |
PayPal 事件資源。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
webhook_id |
gateway_credentials |
選填 |
string |
正式環境建議設定用於 webhook 驗證。 |
WH-xxxx |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/webhooks/paypal" \
-H "Content-Type: application/json" \
-d '{
"event_type": "example.event",
"resource": {
"payment_no": "PAY202606220001ABCDEFGH"
}
}'
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | application/json |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | {"success":true} |
成功 Response 範例
{
"success": true,
"message": "Webhook received"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
PAYPAL_WEBHOOK_VERIFY_FAILED
STRIPE
Stripe
支援信用卡、支付寶、微信支付與東南亞本地付款方式,採 Stripe PaymentIntent / Payment Element 流程。
商戶可呼叫 API
POST
/api/paycore/pay/stripe/credit
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/credit" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/credit', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=card
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "credit",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_SECRET_KEY_INVALID
STRIPE_PUBLISHABLE_KEY_INVALID
STRIPE_AUTH_FAILED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
POST
/api/paycore/pay/stripe/alipay
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/alipay" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/alipay', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=alipay
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "alipay",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_PAYMENT_METHOD_CURRENCY_UNSUPPORTED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
STRIPE_AUTH_FAILED
目前限制幣別:CNY、AUD、CAD、EUR、GBP、HKD、JPY、MYR、NZD、SGD、USD。若商戶 Stripe 帳號所在地尚未啟用 Alipay,Stripe 仍可能拒絕建立。
POST
/api/paycore/pay/stripe/wechat-pay
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/wechat-pay" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/wechat-pay', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=wechat_pay
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "wechat",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_PAYMENT_METHOD_CURRENCY_UNSUPPORTED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
STRIPE_AUTH_FAILED
目前限制幣別:CNY、AUD、CAD、EUR、GBP、HKD、JPY、SGD、USD、DKK、NOK、SEK、CHF;仍需商戶 Stripe 帳號可使用 WeChat Pay。
POST
/api/paycore/pay/stripe/grabpay
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/grabpay" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/grabpay', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=grabpay
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "grabpay",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_PAYMENT_METHOD_CURRENCY_UNSUPPORTED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
STRIPE_AUTH_FAILED
POST
/api/paycore/pay/stripe/paynow
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/paynow" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/paynow', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=paynow
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "paynow",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_PAYMENT_METHOD_CURRENCY_UNSUPPORTED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
STRIPE_AUTH_FAILED
POST
/api/paycore/pay/stripe/promptpay
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/promptpay" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/promptpay', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=promptpay
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "promptpay",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_PAYMENT_METHOD_CURRENCY_UNSUPPORTED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
STRIPE_AUTH_FAILED
POST
/api/paycore/pay/stripe/fpx
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
secret_key |
gateway_credentials |
必填 |
string |
Stripe Secret Key,必須以 sk_test_ 或 sk_live_ 開頭。 |
sk_test_xxxxx |
publishable_key |
gateway_credentials |
必填 |
string |
Stripe Publishable Key,必須以 pk_test_ 或 pk_live_ 開頭。 |
pk_test_xxxxx |
webhook_secret |
gateway_credentials |
選填 |
string |
Stripe webhook secret,若提供必須以 whsec_ 開頭。 |
whsec_xxxxx |
callback_secret |
gateway_credentials |
選填 |
string |
PayCore 自訂 callback secret。 |
optional-secret |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/stripe/fpx" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"secret_key": "sk_test_xxxxx",
"publishable_key": "pk_test_xxxxx",
"webhook_secret": "whsec_xxxxx"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/stripe/fpx', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
status
payment_info.stripe_payment_method=fpx
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "stripe",
"method": "fpx",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_PAYMENT_METHOD_CURRENCY_UNSUPPORTED
STRIPE_PAYMENT_INTENT_CREATE_FAILED
STRIPE_AUTH_FAILED
FPX 目前限制幣別:MYR;Stripe 也可能要求商戶提供 Business Registration Number。
Webhook / Return 說明
POST
/api/paycore/webhooks/stripe
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Stripe-Signature |
header |
選填 |
string |
Stripe webhook 簽章標頭。 |
t=...,v1=... |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
type |
body |
必填 |
string |
Stripe event type。 |
payment_intent.succeeded |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
webhook_secret |
gateway_credentials |
選填 |
string |
如果提供會用於驗證 Stripe webhook。 |
whsec_xxxxx |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/webhooks/stripe" \
-H "Content-Type: application/json" \
-d '{
"event_type": "example.event",
"resource": {
"payment_no": "PAY202606220001ABCDEFGH"
}
}'
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | application/json |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | {"success":true} |
成功 Response 範例
{
"success": true,
"message": "Webhook received"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
STRIPE_WEBHOOK_SIGNATURE_INVALID
PLUS
PLUS
目前程式只支援 PLUS ATM 付款、PLUS balance action、Return / Webhook。
商戶可呼叫 API
POST
/api/paycore/pay/plus/atm
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
merchant_order_no |
body |
必填 |
string|max:100 |
商戶訂單號。建議唯一;若同一訂單已有未完成或已付款交易,PayCore 會回傳既有付款或訂單衝突。 |
ORDER202606220001 |
amount |
body |
必填 |
integer|min:1 |
付款金額。ECPay / SmilePay / PLUS 以 TWD 整數元處理;Stripe 使用最小貨幣單位;PayPal 使用主要金額字串,TWD / JPY / HUF 不帶小數。 |
980 |
currency |
body |
選填 |
string|max:10 |
幣別。ECPay / SmilePay 限 TWD;PLUS 預設 TWD;PayPal 不由 PayCore 限制,由 PayPal 回應。 |
TWD |
payer_account |
body |
選填 |
string|max:100 |
付款者或會員識別,可協助 PLUS pay_name 或商戶端追蹤。 |
uid811118A |
success_url |
body |
選填 |
url |
付款成功後可導回商戶的網址。 |
https://merchant.example/success |
return_url |
body |
選填 |
url |
相容欄位;部分付款方式會當作 success_url 使用。 |
https://merchant.example/return |
cancel_url |
body |
選填 |
url |
付款取消或未完成時導回商戶的網址。 |
https://merchant.example/cancel |
payok_url |
body |
選填 |
url |
PayCore 付款成功後通知商戶系統的 URL。 |
https://merchant.example/paycore/payok |
item_name |
body |
選填 |
string|max:200 |
商品名稱。ECPay 使用上限 200;SmilePay 會依金流限制裁切到安全長度。 |
PayCore 測試商品 |
description |
body |
選填 |
string|max:200 |
付款描述。可作為商品名稱或交易描述 fallback。 |
Order payment |
buyer_name |
body |
選填 |
string|max:100 |
買家姓名,主要供 SmilePay 等離線付款使用。 |
王小明 |
buyer_mobile |
body |
選填 |
string|max:30 |
買家手機。 |
0912345678 |
buyer_phone |
body |
選填 |
string|max:30 |
買家電話;可作為 buyer_mobile / buyer_tel fallback。 |
0912345678 |
buyer_tel |
body |
選填 |
string|max:30 |
買家市話。 |
02-12345678 |
buyer_email |
body |
選填 |
email|max:150 |
買家 Email。 |
[email protected] |
expire_days |
body |
選填 |
integer|min:1|max:60 |
離線付款繳費有效天數。SmilePay / ECPay ATM / CVS 可使用。 |
7 |
gateway_credentials |
body |
必填 |
object |
金流商店憑證。依 gateway 不同,欄位不同。 |
{...} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
appid |
gateway_credentials |
必填 |
string |
PLUS App ID。 |
PLUS_APPID |
secret_key |
gateway_credentials |
必填 |
string |
PLUS secret_key。 |
PLUS_SECRET_KEY |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/pay/plus/atm" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"merchant_order_no": "ORDER202606220001",
"amount": 980,
"currency": "TWD",
"description": "PayCore test order",
"success_url": "https://merchant.example/success",
"cancel_url": "https://merchant.example/cancel",
"payok_url": "https://merchant.example/payok",
"gateway_credentials": {
"appid": "PLUS_APPID",
"secret_key": "PLUS_SECRET_KEY"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/pay/plus/atm', [
'merchant_order_no' => 'ORDER202606220001',
'amount' => 980,
'currency' => 'TWD',
'gateway_credentials' => [
// Fill the credentials shown in this section.
],
]);
return $response->json();
成功回應重點
payment_no
payment_url
account_code
plat_no
status
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.payment_no | string | PayCore 付款編號。 | PAY202606220001ABCDEFGH |
data.merchant_order_no | string | 商戶訂單號。 | ORDER202606220001 |
data.gateway | string | 金流代號。 | ecpay |
data.method | string | 付款方式。 | atm |
data.amount | integer | 交易金額。 | 980 |
data.currency | string | 幣別。 | TWD |
data.status | string | 付款建立後狀態。離線付款多為 pending。 | pending |
data.payment_url | string|null | PayCore 付款頁或金流導轉網址。 | https://pay-core.app/zh-tw/pay/PAY... |
data.payment_info | object | ATM / 超商代碼 / 前端付款必要資訊。 | {...} |
data.created | boolean | 是否本次新建立。若回傳既有付款則為 false。 | true |
成功 Response 範例
{
"success": true,
"data": {
"payment_no": "PAY202606220001ABCDEFGH",
"merchant_order_no": "ORDER202606220001",
"gateway": "plus",
"method": "atm",
"amount": 980,
"currency": "TWD",
"status": "pending",
"payment_url": "https://pay-core.app/zh-tw/pay/PAY202606220001ABCDEFGH?token=...",
"payment_info": {
"payment_code": "A12345678901234",
"expire_at": "2026-06-28 23:59:59"
},
"created": true
},
"message": "Payment created successfully"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
PLUS appid is required.
PLUS secret_key is required.
PLUS money mismatch.
POST
/api/paycore/gateways/plus/balance
參數表
Header 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
Content-Type |
header |
必填 |
string |
建立付款時使用 application/json。 |
application/json |
X-API-KEY |
header |
必填 |
string |
PayCore API 身分驗證 Key。這不是金流商店金鑰。 |
pc_live_xxxxx |
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
gateway_credentials |
body |
必填 |
object |
PLUS appid / secret_key。 |
{"appid":"...","secret_key":"..."} |
gateway_credentials 可填欄位
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
appid |
gateway_credentials |
必填 |
string |
PLUS App ID。 |
PLUS_APPID |
secret_key |
gateway_credentials |
必填 |
string |
PLUS secret_key。 |
PLUS_SECRET_KEY |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/gateways/plus/balance" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY" \
-d '{
"gateway_credentials": {
"appid": "PLUS_APPID",
"secret_key": "PLUS_SECRET_KEY"
}
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => env('PAYCORE_API_KEY'),
])->post('https://api-core.cc/api/paycore/gateways/plus/balance', [
'gateway_credentials' => [
'appid' => 'PLUS_APPID',
'secret_key' => 'PLUS_SECRET_KEY',
],
]);
return $response->json();
成功回應重點
gateway=plus
balance
raw_response
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
success | boolean | 是否成功。 | true |
data.gateway | string | 金流代號。 | plus |
data.balance | integer|string|null | PLUS 回傳餘額。依 PLUS 原始回應而定。 | 10000 |
message | string | PayCore 回應訊息。 | Gateway action completed |
成功 Response 範例
{
"success": true,
"data": {
"gateway": "plus",
"balance": 10000,
"raw_response": {
"status": "ok"
}
},
"message": "Gateway action completed"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
Unsupported gateway action
Gateway action failed
Webhook / Return 說明
GET
/{locale}/payment/plus/return/{paymentNo}
參數表
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
paymentNo |
path |
必填 |
string |
PayCore payment_no。 |
PAY202606220001ABCDEFGH |
Request / Response 範例
curl -X GET "https://api-core.cc/{locale}/payment/plus/return/{paymentNo}" \
-H "X-API-KEY: YOUR_PAYCORE_API_KEY"
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | application/json |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | {"success":true} |
成功 Response 範例
{
"type": "html",
"description": "PayCore result page"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
正式可用
PLUS Webhook
接收 PLUS callback_url 回調。
POST
/api/paycore/webhooks/plus
參數表
Path / Query / Body 參數
| 欄位 |
位置 |
必填 |
型別 |
說明 |
範例 |
appid |
body |
必填 |
string |
PLUS appid。 |
PLUS_APPID |
money |
body |
必填 |
integer|string |
回調金額,PayCore 會比對交易金額。 |
980 |
Request / Response 範例
curl -X POST "https://api-core.cc/api/paycore/webhooks/plus" \
-H "Content-Type: application/json" \
-d '{
"event_type": "example.event",
"resource": {
"payment_no": "PAY202606220001ABCDEFGH"
}
}'
成功回應重點
Response 欄位表
| 欄位 | 型別 | 說明 | 範例 |
|---|
HTTP status | integer | HTTP 狀態碼。SmilePay 成功時為 200。 | 200 |
Content-Type | string | 回覆內容格式。SmilePay 為 text/plain。 | application/json |
body | string|object | 金流要求的 ACK 或 PayCore 結果頁。 | {"success":true} |
成功 Response 範例
{
"success": true,
"message": "Webhook received"
}
錯誤 Response 範例
{
"success": false,
"message": "Validation failed",
"error": {
"error_code": "VALIDATION_FAILED",
"fields": {
"amount": [
"The amount field is required."
]
}
}
}
錯誤碼與注意事項
PLUS appid mismatch.
PLUS money mismatch.
已經到底囉
Pico 陪你看到這裡了。
需要重新找 API、回到目錄,或再確認串接流程嗎?可以一鍵回到上方搜尋,也可以回到 API 目錄繼續瀏覽。