Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Integrate NewebPay (藍新金流) for Taiwan e-commerce via mcp-newebpay. Use when accepting credit card / ATM / CVS / LINE Pay / periodical payments on NewebPay, handling 3DS 2.0 flows, computing TradeSha signatures, or reconciling callback webhooks. Do NOT use for comparing gateways (see tw-payment-integration) or for non-NewebPay providers (TapPay, ECPay have their own skills).
.claude/skills/asgard-ai-platform-tw-ecom-payment-newebpay/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 88% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 152% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 87% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 271% | 0% |
mcp-newebpayMPGGateway form submission failurestw-payment-integration (comparison of NewebPay / ECPay / TapPay / LINE Pay Direct)mcp-newebpay tool descriptions or the NewebPay official PDF (線上交易─幕前支付技術串接手冊_NDNF / 信用卡定期定額串接技術手冊_NDNP)tw-ecom-payment-disputeNewebPay (藍新金流) is one of the three dominant TW payment gateways (with ECPay and TapPay). It is an aggregator — one merchant contract covers credit card, ATM, CVS, and wallet rails, each with its own settlement cycle. mcp-newebpay wraps 8 official tools covering two API families:
create_mpg_payment, query_trade, cancel_authorization, close_refund, ewallet_refund.create_period_payment, alter_period_status, alter_period_content.NDNF and NDNP are separate merchant accounts with separate MerchantID + HashKey + HashIV triples. Configuring one does not enable the other.
Signature model. Every request body is AES-256-CBC-encrypted with the merchant's HashKey (32 chars) and HashIV (16 chars) into a TradeInfo blob, and a SHA-256 TradeSha is computed over HashKey=…&{TradeInfo}&HashIV=… and the result uppercased (the literal format, not a generic param sort — see Gotchas). Version is 2.0. 3DS 2.0 liability shift is handled by NewebPay's hosted MPG page; merchants never see card PAN.
Trust boundary. create_mpg_payment / create_period_payment return encrypted form data for a browser-side POST to https://ccore.newebpay.com/MPG/mpg_gateway (or core.newebpay.com in prod). The merchant backend never sees card PAN. Payment result is delivered via two channels: NotifyURL (server-to-server webhook) and ReturnURL (browser redirect). These can arrive out of order.
What is the user asking for?
│
├─ New one-time payment (credit card / ATM / CVS / wallet)?
│ → NDNF: create_mpg_payment
│ Returns {url, form_data} → merchant must render an auto-submit form
│ Result arrives via NotifyURL (trust) + ReturnURL (display only)
│
├─ Subscription / 定期定額 / recurring membership?
│ → NDNP: create_period_payment
│ Separate MerchantID from NDNF — verify both credential sets exist
│ Changes after go-live: alter_period_status (pause/resume/terminate),
│ alter_period_content (amount/cycle/expiry)
│
├─ "Did this order get paid?" / reconciliation?
│ → NDNF: query_trade (canonical source of truth for a single MerchantOrderNo)
│ Use this whenever NotifyURL was missed, duplicated, or suspect
│
├─ Refund / cancellation?
│ ├─ Credit card, before close (請款)? → cancel_authorization (NPA-B01)
│ ├─ Credit card, after close? → close_refund (NPA-B03x)
│ └─ LINE Pay / Taiwan Pay / e-wallet? → ewallet_refund (NPA-B06)
│
└─ Recurring mandate state change?
├─ Pause / resume / terminate → alter_period_status
└─ Change amount / cycle / expiry → alter_period_contentWhen mcp-newebpay reports a "tool not configured" error, the corresponding NDNF or NDNP env group was not set — see README Environment variables table.
Three flows. For each, the exact mcp-newebpay tool is named. See references/integration-flow.md for full wiring and examples/sample_scenario.md for an end-to-end subscription walkthrough.
One-time payment (NDNF)
create_mpg_payment with MerchantOrderNo (your idempotency key), Amt (integer TWD), ItemDesc, Email, NotifyURL, ReturnURL, and which payment methods to enable (CREDIT, VACC for ATM, CVS, BARCODE, LINEPAY, APPLEPAY, ...){url, form_data}. The merchant must render an auto-submit HTML form that POSTs form_data to url. Do not attempt to follow the redirect server-side — the customer must hit NewebPay's hosted page in their own browser for 3DS 2.0 to work.TradeInfo, check Status == "SUCCESS"). This is the authoritative event. The customer's browser is also redirected to ReturnURL — treat this as a UI hint only, never as the completion signal.query_trade(MerchantOrderNo, Amt) to re-confirm server-side.Recurring / 定期定額 (NDNP)
create_period_payment — establishes the mandate. Requires NDNP credentials. Returns the same {url, form_data} shape; the customer goes through one interactive auth on NewebPay's hosted page to authorize the mandate. After that, NewebPay charges on the cycle automatically and fires NotifyURL on each cycle.Status == "SUCCESS" (grant service period) and failure (card expired, insufficient funds, acquirer decline) separately — failures do not auto-retry.alter_period_status; amount/cycle/expiry via alter_period_content. Treat PeriodNo (e.g., P260403144725zl3MVV) as the canonical handle — not the merchant order number.Refund
cancel_authorization releases the hold. After close: close_refund with operation refund / cancel_refund. Close itself is also close_refund with operation close / cancel_close.ewallet_refund — the credit card close_refund tool will not work for wallet rails.query_trade first to confirm CloseStatus (3 = settled) before choosing the refund tool.SHA256("HashKey={key}&{TradeInfo blob}&HashIV={iv}").upper() — HashKey first, HashIV last, the literal encrypted TradeInfo sandwiched between, and the result in uppercase hex. Developers who treat it as "sort params alphabetically and HMAC them" build something that validates against nothing. mcp-newebpay handles this for you; if you hand-roll a verifier for NotifyURL, copy the exact format.mcp-newebpay uses separate env groups (NEWEBPAY_NDNF_* vs NEWEBPAY_NDNP_*) specifically to prevent this; do not unify them in wrapper code.alter_period_status to pause. Silent failures accumulate as unpaid subscription months.ccore.newebpay.com; production is core.newebpay.com. Both accept differently-provisioned MerchantID / HashKey pairs; a test key against the prod endpoint (or vice versa) returns "MerchantID 不存在" which looks like a bad credential but is really a wrong-endpoint bug. mcp-newebpay switches via NEWEBPAY_ENV=test|production; verify this before debugging credentials.NotifyURL is the source of truth, not ReturnURL. Never transition an order to "paid" — and never trigger downstream effects like e-invoice issuance, fulfillment, or subscription activation — based on ReturnURL parameters or the browser redirect. Two specific failure modes this prevents: (1) double-fulfillment when the customer closes the browser early and retries, arriving on ReturnURL twice; (2) ghost-open orders when NotifyURL fires but the browser never reaches ReturnURL (airplane mode, network drop). If NotifyURL has not been received and verified server-side, the order is open — regardless of what the ReturnURL page says. When in doubt, call query_trade to re-confirm; treat that server response as equivalent to a NotifyURL retry.
| "但是…" | 為什麼錯 | |---|---| | 客戶已經在感謝頁了,付款應該成功了 | ReturnURL 可以被重新整理重放、也可以在付款失敗後仍然跳轉(NewebPay 某些錯誤路徑仍會跳回 ReturnURL)| | NotifyURL 和 ReturnURL 幾乎同時到,先用 ReturnURL 更新再等 NotifyURL 確認就好 | 非同步順序無法保證;高流量期間兩者可差數分鐘,先更新會產生競態條件導致雙重履行 | | 我需要立刻給客戶看訂單確認,等 NotifyURL 太慢 | ReturnURL 完全可以用於顯示 UI(「處理中,請稍候」),訂單狀態變更必須等 NotifyURL;這兩件事不衝突 | | 我們的 NotifyURL 偶爾收不到,所以 ReturnURL 是備援 | 備援邏輯應是「若 N 分鐘內未收到 NotifyURL,呼叫 query_trade 主動查詢」,而非信任 ReturnURL |
When completing a NewebPay task, produce this structure:
markdown# NewebPay Task: {one-line summary} ## Context - API family: {NDNF one-off | NDNP recurring | mixed} - Environment: {test (ccore) | production (core)} - Payment methods enabled: {CREDIT, VACC, CVS, LINEPAY, ...} - MerchantOrderNo scheme: {…} ## Tool Plan | Step | Tool | Family | Purpose | |------|------|--------|---------| | 1 | create_mpg_payment | NDNF | Build encrypted form for browser redirect | | 2 | (browser POSTs form) | — | Customer completes 3DS 2.0 on NewebPay | | 3 | NotifyURL handler | — | Decrypt TradeInfo, verify TradeSha, update order | | 4 | query_trade | NDNF | Reconciliation on doubt | | … | … | … | … | ## Callback Handling - NotifyURL verification: TradeSha recomputed with HashKey={…}&{TradeInfo}&HashIV={…} uppercased: Y/N - ReturnURL treated as UI-only (no state mutation): Y/N - query_trade fallback on missed NotifyURL: Y/N - Idempotency key: MerchantOrderNo ## Assumptions & Open Questions - {assumption grounded in a NewebPay constraint} - TODO: {anything that needs verification against NewebPay merchant portal or NDNF/NDNP PDF} ## Deliverable {the actual integration, reconciliation report, or change summary}
mcp-newebpaytw-payment-integration (gateway comparison decision), tw-ecom-payment-dispute (chargeback / 爭議款 handling), tw-ecom-invoice-ezpay (e-invoice handoff after successful payment), tw-ecom-dtc-shopline (storefront integration)references/integration-flow.md (merchant setup → first transaction → callback → reconciliation), examples/sample_scenario.md (subscription billing with ezPay invoice and dispute handling)_Last verified: 2026-04_
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-04 | pass→pass | 27,679 | 29,268 | +6% | 1 | 1 | 0% | 3,745 | 8,459 | +126% | 0 | 0 | — |
case-05 | pass→pass | 21,743 | 30,816 | +42% | 1 | 1 | 0% | 4,400 | 6,950 | +58% | 0 | 0 | — |
case-06 | pass→fail | 20,607 | 25,873 | +26% | 1 | 1 | 0% | 2,822 | 6,818 | +142% | 0 | 0 | — |
case-01 | fail→pass | 55,194 | 60,031 | +9% | 1 | 1 | 0% | 4,948 | 9,289 | +88% | 0 | 0 | — |
case-02 | pass→pass | 50,744 | 25,955 | -49% | 1 | 1 | 0% | 8,096 | 8,665 | +7% | 0 | 0 | — |
case-03 | fail→pass | 34,040 | 29,264 | -14% | 1 | 1 | 0% | 6,581 | 8,886 | +35% | 0 | 0 | — |
case-07 | pass→pass | 22,076 | 17,577 | -20% | 1 | 1 | 0% | 3,326 | 6,084 | +83% | 0 | 0 | — |
case-08 | pass→pass | 16,188 | 13,949 | -14% | 1 | 1 | 0% | 2,166 | 5,251 | +142% | 0 | 0 | — |
case-09 | fail→pass | 15,524 | 15,171 | -2% | 1 | 1 | 0% | 2,453 | 6,183 | +152% | 0 | 0 | — |
case-10 | pass→pass | 14,588 | 27,558 | +89% | 1 | 1 | 0% | 2,053 | 4,685 | +128% | 0 | 0 | — |
case-11 | fail→pass | 17,877 | 13,740 | -23% | 1 | 1 | 0% | 2,838 | 5,301 | +87% | 0 | 0 | — |
case-12 | fail→pass | 8,213 | 10,727 | +31% | 1 | 1 | 0% | 1,451 | 5,380 | +271% | 0 | 0 | — |
case-13 | pass→pass | 15,624 | 17,259 | +10% | 1 | 1 | 0% | 2,460 | 6,029 | +145% | 0 | 0 | — |
case-14 | fail→pass | 13,860 | 13,918 | +0% | 1 | 1 | 0% | 2,128 | 5,364 | +152% | 0 | 0 | — |
case-15 | pass→pass | 20,695 | 23,042 | +11% | 1 | 1 | 0% | 2,892 | 6,710 | +132% | 0 | 0 | — |
case-16 | fail→pass | 15,778 | 12,935 | -18% | 1 | 1 | 0% | 2,532 | 5,730 | +126% | 0 | 0 | — |
case-17 | pass→pass | 17,015 | 22,016 | +29% | 1 | 1 | 0% | 2,846 | 7,679 | +170% | 0 | 0 | — |
case-18 | pass→pass | 13,899 | 20,196 | +45% | 1 | 1 | 0% | 2,300 | 6,791 | +195% | 0 | 0 | — |
case-19 | fail→pass | 36,979 | 30,083 | -19% | 1 | 1 | 0% | 5,725 | 7,985 | +39% | 0 | 0 | — |
case-20 | fail→pass | 11,647 | 13,164 | +13% | 1 | 1 | 0% | 1,952 | 5,559 | +185% | 0 | 0 | — |
case-21 | pass→pass | 13,267 | 5,854 | -56% | 1 | 1 | 0% | 1,780 | 4,438 | +149% | 0 | 0 | — |
case-22 | fail→pass | 7,625 | 9,828 | +29% | 1 | 1 | 0% | 971 | 4,994 | +414% | 0 | 0 | — |
case-23 | pass→pass | 16,661 | 19,352 | +16% | 1 | 1 | 0% | 2,872 | 6,828 | +138% | 0 | 0 | — |
case-24 | fail→pass | 17,655 | 14,828 | -16% | 1 | 1 | 0% | 2,615 | 5,350 | +105% | 0 | 0 | — |
case-25 | pass→pass | 21,254 | 19,772 | -7% | 1 | 1 | 0% | 3,376 | 6,079 | +80% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted. The headline lift of +40 percentage points is the difference between those two pass rates over the 25 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.