Agent skill
newebpay-query
Implements NewebPay transaction query functionality using QueryTradeInfo API. Use when building order status checking, transaction verification, or payment confirmation features for 藍新金流.
Install this agent skill to your Project
npx add-skill https://github.com/paid-tw/skills/tree/main/plugins/newebpay/skills/newebpay-query
SKILL.md
藍新金流交易查詢任務
你的任務是在用戶的專案中實作藍新金流交易查詢功能。
Step 1: 確認需求
用戶輸入: $ARGUMENTS
詢問用戶:
-
查詢情境:需要什麼查詢功能?
- 單筆訂單查詢(客戶查詢、客服查詢)
- 批次對帳(每日/定時對帳)
- 支付狀態確認(NotifyURL 備援)
-
專案框架:你使用什麼框架?
- 確認是否已有 NewebPay 環境設定
Step 2: 建立查詢功能
在現有的支付模組中加入查詢方法,或建立新模組。
核心功能:
generateCheckValue(orderNo, amount)- 產生 SHA256 檢核碼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 |
請求參數
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| MerchantID | String(15) | ✓ | 商店代號 |
| Version | String | ✓ | 1.3 |
| RespondType | String | ✓ | JSON |
| CheckValue | String | ✓ | SHA256 檢核碼 |
| TimeStamp | Number | ✓ | Unix timestamp |
| MerchantOrderNo | String(30) | ✓ | 商店訂單編號 |
| Amt | Number | ✓ | 訂單金額 |
CheckValue 產生規則
原始字串: IV={HashIV}&Amt={金額}&MerchantID={商店代號}&MerchantOrderNo={訂單編號}&Key={HashKey}
結果: SHA256 後轉大寫
TradeStatus 交易狀態
| 值 | 說明 |
|---|---|
| 0 | 未付款 |
| 1 | 已付款 |
| 2 | 付款失敗 |
| 3 | 已取消 |
| 6 | 退款 |
詳細參考文件
- 程式碼範例 (PHP/Node.js)
常見錯誤
| 代碼 | 說明 | 解決方式 |
|---|---|---|
| TRA10001 | 查無此筆交易 | 確認訂單編號正確 |
| TRA10002 | CheckValue 檢核錯誤 | 確認參數順序與大小寫 |
| TRA10003 | 時間戳記錯誤 | 確認伺服器時間正確 |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
kryptogo-pay-webhook
Implements KryptoGO Payment webhook/callback handling for receiving payment status notifications. Use when building webhook endpoints, handling payment callbacks, or implementing 支付狀態通知 for KryptoGO Payment.
kryptogo-pay
Provides KryptoGO Payment integration overview and guides users to the appropriate skill. Use when starting KryptoGO crypto payment integration, setting up environment, or needing general guidance about KryptoGO 穩定幣支付.
kryptogo-pay-query
Implements KryptoGO Payment query functionality for checking payment intent status and listing payment intents. Use when building order status checking, transaction verification, or payment confirmation features for KryptoGO 穩定幣支付.
kryptogo-pay-transfer
Implements KryptoGO Payment token transfer/withdrawal functionality using the Asset Pro Transfer API. Use when building withdrawal features, sending tokens to users, or implementing 穩定幣提領轉帳 for KryptoGO Payment.
kryptogo-pay-checkout
Implements KryptoGO Payment checkout integration including Payment Intent creation, React SDK usePayment hook, and Direct API integration. Use when integrating crypto payment, creating checkout flows, or building KryptoGO 穩定幣收款頁面.
payuni-webhook
Implements PAYUNi webhook handling including signature verification, replay attack prevention, and payment status updates. Use when building payment notification endpoints for 統一金流.
Didn't find tool you were looking for?