shopline-payments — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited shopline-payments (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
此技能提供 SHOPLINE Payments 金流串接的完整文檔與程式碼範例。
SHOPLINE Payments 提供兩種串接方式:
| 串接方式 | 說明 | 適用場景 |
|---|---|---|
| 導轉式 | 透過 API 取得付款頁 URL,導轉顧客至 SHOPLINE 付款頁 | 串接簡單,適合快速整合 |
| 內嵌式 | 透過 SDK + API 將付款表單內嵌於特店網站(詳見 references/embedded.md) | 支援綁卡/快捷/定期交易等進階功能 |
| 環境 | Base URL |
|---|---|
| 沙盒環境 | https://api-sandbox.shoplinepayments.com |
| 正式環境 | https://api.shoplinepayments.com |
| 金鑰 | 用途 |
|---|---|
merchantId | 特店 ID |
apiKey | Server API 串接認證 |
clientKey | SDK 串接認證(內嵌式使用) |
signKey | Webhook Event 通知簽章驗證 |
根據用戶需求,參考以下文檔:
| 需求 | 文檔 | 說明 |
|---|---|---|
| 建立結帳交易 | references/redirect.md | 導轉式結帳交易 API |
| 內嵌式串接 | references/embedded.md | SDK + API 內嵌式串接指南 |
| 查詢交易 | references/query.md | 查詢結帳/付款交易狀態 |
| 退款 | references/refund.md | 建立退款交易 |
| 請款/取消 | references/capture-cancel.md | 信用卡請款與取消授權 |
| Webhook | references/webhook.md | 事件通知與簽章驗證 |
| 錯誤碼 | references/error-codes.md | 錯誤碼完整參考 |
| 沙盒測試 | references/sandbox.md | 測試卡號與測試規則 |
| 付款方式 | references/payment-methods.md | 支援的付款方式說明 |
1. 特店後端呼叫「建立結帳交易」API
2. 取得 sessionUrl
3. 前端導轉顧客至 sessionUrl(SHOPLINE 付款頁)
4. 顧客完成付款後自動導回 returnUrl
5. 特店透過 Webhook 接收付款結果
6. (建議)主動查詢交易狀態二次確認1. 前端引入 JS SDK(NPM 或 CDN)
2. 初始化 SDK 並呈現收銀台
3. 顧客填寫付款資訊並點擊結帳
4. SDK 建立 paySession
5. 後端呼叫「建立付款交易」API(帶入 paySession)
6. 前端呼叫 payment.pay(nextAction) 發起付款
7. 完成 3D 驗證(如需要)後導回 returnUrl
8. 透過 Webhook 接收付款結果完整內嵌式串接說明請參考 references/embedded.md所有 Server-API 請求必須包含以下 HTTP Header:
Content-Type: application/json
merchantId: <YOUR-MERCHANT-ID>
apiKey: <YOUR-API-KEY>
requestId: <UNIQUE-REQUEST-ID>補充:若為平台特店(Platform Connect)請另外帶入platformId;建議在「建立結帳交易」等具冪等需求的請求帶入idempotentKey,避免重複下單。
async function createCheckoutSession(orderData) {
const response = await fetch('https://api-sandbox.shoplinepayments.com/api/v1/trade/sessions/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'merchantId': process.env.SHOPLINE_MERCHANT_ID,
'apiKey': process.env.SHOPLINE_API_KEY,
'requestId': Date.now().toString()
},
body: JSON.stringify({
referenceId: orderData.orderId,
amount: { value: orderData.amount * 100, currency: 'TWD' },
returnUrl: orderData.returnUrl,
mode: 'regular',
allowPaymentMethodList: ['CreditCard', 'LinePay'],
customer: {
personalInfo: {
firstName: orderData.name,
email: orderData.email,
phone: orderData.phone
}
},
client: { ip: orderData.clientIp }
})
});
return await response.json();
}完整的程式碼範例請參考:
scripts/checkout.js - Node.js 建立結帳交易scripts/webhook.js - Webhook 簽章驗證scripts/gas-integration.js - Google Apps Script 整合referenceId 不可重複apiKey 和 signKey 不可暴露在前端問題:收到 1004 Param error 原因:金額未轉換為「分」 解決:amount.value = 實際金額 * 100(如 100 元傳 10000)
問題:收到 1001 Order exist 原因:referenceId 已被使用 解決:確保每筆訂單使用唯一的 referenceId
問題:收到 ACCESS_DENIED 原因:
apiKey 或 merchantId 錯誤解決:確認金鑰正確且環境對應
問題:付款完成後未收到 Webhook 原因:
解決:確認 URL 可公開存取並回應 200
問題:簽章比對不符 原因:
signKey 錯誤timestamp.bodyString)解決:使用原始 body 字串進行簽章計算
問題:測試交易都失敗 原因:金額不符合測試規則 解決:
問題:收到「無可退款金額」或「退款金額超過可退金額」 原因:
解決:查詢原交易確認可退款金額
問題:收到「交易已請款,無法取消」 原因:已請款的交易無法取消授權 解決:請款後只能使用「退款」功能
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.