OpenParable
Skip to content
← Back to skills

Newebpay Query

Apps & Automation
newebpay-query

Newebpay Query is an Agent Skill for apps & automation published in the paid-tw/skills repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Implements NewebPay transaction query functionality using QueryTradeInfo API. Use when building order status checking, transaction verification, or payment confirmation features for 藍新金流.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/paid-tw/skills/blob/HEAD/plugins/newebpay/skills/newebpay-query/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/newebpay-query, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

藍新金流交易查詢任務

你的任務是在用戶的專案中實作藍新金流交易查詢功能。

Step 1: 確認需求

用戶輸入: $ARGUMENTS

詢問用戶:

  1. 查詢情境:需要什麼查詢功能?

    • 單筆訂單查詢(客戶查詢、客服查詢)
    • 批次對帳(每日/定時對帳)
    • 支付狀態確認(NotifyURL 備援)
  2. 專案框架:你使用什麼框架?

    • 確認是否已有 NewebPay 環境設定

Step 2: 建立查詢功能

在現有的支付模組中加入查詢方法,或建立新模組。

核心功能:

  1. generateCheckValue(orderNo, amount) - 產生 SHA256 檢核碼
  2. queryTrade(orderNo, amount) - 查詢單筆交易

Step 3: 實作程式碼

根據框架加入查詢功能。

Step 4: 整合到應用

建議整合方式:

  • API 端點: GET /api/orders/:orderNo/status
  • 管理後台: 訂單詳情頁顯示即時狀態
  • 定時任務: 對帳排程

API 參考

端點

環境URL
測試https://ccore.newebpay.com/API/QueryTradeInfo
正式https://core.newebpay.com/API/QueryTradeInfo

請求參數

參數類型必填說明
MerchantIDString(15)✓商店代號
VersionString✓1.3
RespondTypeString✓JSON
CheckValueString✓SHA256 檢核碼
TimeStampNumber✓Unix timestamp
MerchantOrderNoString(30)✓商店訂單編號
AmtNumber✓訂單金額

CheckValue 產生規則

原始字串: IV={HashIV}&Amt={金額}&MerchantID={商店代號}&MerchantOrderNo={訂單編號}&Key={HashKey}
結果: SHA256 後轉大寫

TradeStatus 交易狀態

值說明
0未付款
1已付款
2付款失敗
3已取消
6退款

詳細參考文件


常見錯誤

代碼說明解決方式
TRA10001查無此筆交易確認訂單編號正確
TRA10002CheckValue 檢核錯誤確認參數順序與大小寫
TRA10003時間戳記錯誤確認伺服器時間正確