mcpField
N
newebpay-refund

newebpay-refund

github.com/paid-twDevelopment28451 installsUpdated 34w ago
Repository

About newebpay-refund

A skill for implementing NewebPay refunds in a project. It covers credit card and e-wallet refunds, with API parameter references and suggested application integration points.

Key features

  1. 01Implements credit card refunds
  2. 02Implements e-wallet refunds
  3. 03Covers full and partial refund scenarios
  4. 04Documents API parameters and common errors

Use cases

  1. 01Processing order refunds in an admin panel
  2. 02Issuing refunds through an API endpoint
  3. 03Recording and tracking refund activity

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/paid-tw/skills --skill newebpay-refund

After installing, type/newebpay-refundin Claude Code to confirm it loaded.

Bundled filesreferences/code-examples.md

Details

From the project README

藍新金流退款任務

你的任務是在用戶的專案中實作藍新金流退款功能。

Step 1: 確認退款類型

用戶輸入: $ARGUMENTS

詢問用戶:

  1. 退款類型:需要處理什麼類型的退款?

    • 信用卡退款 (CreditCard/Close API)
    • 電子錢包退款 - LINE Pay, 台灣 Pay 等 (EWallet/Refund API)
    • 兩者都需要
  2. 退款情境:

    • 全額退款
    • 部分退款
    • 自動退款(與訂單系統整合)

Step 2: 確認環境

確認專案已設定 NewebPay 環境變數:

  • NEWEBPAY_MERCHANT_ID
  • NEWEBPAY_HASH_KEY
  • NEWEBPAY_HASH_IV

Step 3: 建立退款模組

根據退款類型建立對應的功能。

信用卡退款核心功能:

  • refundCreditCard(orderNo, amount) - 信用卡退款

電子錢包退款核心功能:

  • refundEWallet(tradeNo, orderNo, amount) - 電子錢包退款

Step 4: 整合到應用

建議整合方式:

  • 管理後台: 訂單詳情頁加入退款按鈕
  • API 端點: POST /api/orders/:orderNo/refund
  • 退款記錄: 建立退款記錄表追蹤

信用卡退款

API 端點
環境URL
測試https://ccore.newebpay.com/API/CreditCard/Close
正式https://core.newebpay.com/API/CreditCard/Close
PostData_ 內容
參數類型必填說明
RespondTypeString✓JSON
VersionString✓1.1
AmtNumber✓退款金額
MerchantOrderNoString✓原訂單編號
TimeStampNumber✓Unix timestamp
IndexTypeNumber✓1 (使用訂單編號)
CloseTypeNumber✓2 (退款)

電子錢包退款

API 端點
環境URL
測試https://ccore.newebpay.com/API/EWallet/Refund
正式https://core.newebpay.com/API/EWallet/Refund
PostData_ 內容
參數類型必填說明
RespondTypeString✓JSON
VersionString✓1.0
TimeStampNumber✓Unix timestamp
TradeNoString✓藍新交易序號
MerchantOrderNoString✓原訂單編號
AmtNumber✓退款金額

詳細參考文件


常見錯誤

代碼說明解決方式
CRE10001無此交易紀錄確認訂單編號/交易序號正確
CRE10002已退款或取消交易已被處理過
CRE10003退款金額錯誤退款金額不可大於原交易金額
CRE10004超過可退款期限信用卡一般為 180 天內

注意事項

  1. 退款期限: 信用卡一般為交易後 180 天內
  2. 部分退款: 可退款金額 ≤ 原交易金額
  3. 退款次數: 同一筆交易可多次部分退款
  4. 電子錢包: 需使用藍新交易序號 (TradeNo)

Comments

Markdown supported