taiwan-payment-skill 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +197 -0
  2. package/assets/taiwan-payment/CLAUDE.md +297 -0
  3. package/assets/taiwan-payment/EXAMPLES.md +1425 -0
  4. package/assets/taiwan-payment/README.md +306 -0
  5. package/assets/taiwan-payment/SKILL.md +857 -0
  6. package/assets/taiwan-payment/data/error-codes.csv +20 -0
  7. package/assets/taiwan-payment/data/field-mappings.csv +15 -0
  8. package/assets/taiwan-payment/data/operations.csv +8 -0
  9. package/assets/taiwan-payment/data/payment-methods.csv +24 -0
  10. package/assets/taiwan-payment/data/providers.csv +4 -0
  11. package/assets/taiwan-payment/data/reasoning.csv +32 -0
  12. package/assets/taiwan-payment/data/troubleshooting.csv +18 -0
  13. package/assets/taiwan-payment/references/ecpay-payment-api.md +880 -0
  14. package/assets/taiwan-payment/references/newebpay-payment-api.md +677 -0
  15. package/assets/taiwan-payment/references/payuni-payment-api.md +997 -0
  16. package/assets/taiwan-payment/scripts/core.py +288 -0
  17. package/assets/taiwan-payment/scripts/recommend.py +269 -0
  18. package/assets/taiwan-payment/scripts/search.py +185 -0
  19. package/assets/taiwan-payment/scripts/test_payment.py +358 -0
  20. package/assets/templates/base/quick-reference.md +370 -0
  21. package/assets/templates/base/skill-content.md +851 -0
  22. package/assets/templates/platforms/antigravity.json +25 -0
  23. package/assets/templates/platforms/claude.json +26 -0
  24. package/assets/templates/platforms/codebuddy.json +25 -0
  25. package/assets/templates/platforms/codex.json +25 -0
  26. package/assets/templates/platforms/continue.json +25 -0
  27. package/assets/templates/platforms/copilot.json +25 -0
  28. package/assets/templates/platforms/cursor.json +25 -0
  29. package/assets/templates/platforms/gemini.json +25 -0
  30. package/assets/templates/platforms/kiro.json +25 -0
  31. package/assets/templates/platforms/opencode.json +25 -0
  32. package/assets/templates/platforms/qoder.json +25 -0
  33. package/assets/templates/platforms/roocode.json +25 -0
  34. package/assets/templates/platforms/trae.json +25 -0
  35. package/assets/templates/platforms/windsurf.json +25 -0
  36. package/dist/index.js +17095 -0
  37. package/package.json +58 -0
@@ -0,0 +1,306 @@
1
+ # Taiwan Payment Gateway Integration Toolkit
2
+
3
+ **Professional payment gateway integration solution for Taiwan market**
4
+
5
+ Supporting ECPay (綠界科技), NewebPay (藍新金流), and PAYUNi (統一金流) with comprehensive API documentation, intelligent tools, and production-ready code examples.
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This toolkit provides enterprise-grade integration capabilities for Taiwan's major payment gateways, featuring:
12
+
13
+ - **Complete API Documentation**: Detailed specifications for all three providers
14
+ - **Intelligent Search Engine**: BM25-powered search across 7 domains (API docs, error codes, field mappings, payment methods)
15
+ - **Smart Recommendation System**: AI-driven provider selection based on business requirements
16
+ - **Production-Ready Examples**: 9 comprehensive TypeScript/Python implementations
17
+ - **Data-Driven Architecture**: 7 CSV datasets for easy maintenance and updates
18
+ - **Multi-Platform Support**: Compatible with 14 AI coding assistants
19
+
20
+ ---
21
+
22
+ ## Supported Payment Gateways
23
+
24
+ | Provider | Encryption | API Style | Market Share | Status |
25
+ |----------|-----------|-----------|--------------|--------|
26
+ | **ECPay (綠界科技)** | SHA256 | Form POST | High | ✅ Full Support |
27
+ | **NewebPay (藍新金流)** | AES-256-CBC + SHA256 | Form POST + AES | High | ✅ Full Support |
28
+ | **PAYUNi (統一金流)** | AES-256-GCM + SHA256 | RESTful JSON | Medium | ✅ Full Support |
29
+
30
+ ### Technical Comparison
31
+
32
+ | Feature | ECPay | NewebPay | PAYUNi |
33
+ |---------|-------|----------|---------|
34
+ | **Encryption Method** | URL Encode + SHA256 | Dual-layer (AES-256-CBC + SHA256) | AES-256-GCM + SHA256 |
35
+ | **Content Type** | application/x-www-form-urlencoded | application/x-www-form-urlencoded | application/json |
36
+ | **Payment Methods** | 11 types (including BNPL, TWQR) | 13 types (including LINE Pay, Apple Pay) | 8 types (including AFTEE, iCash) |
37
+ | **API Design** | Traditional Form POST | MPG Integration, Form POST | Modern RESTful JSON |
38
+ | **Best For** | High-volume e-commerce, Traditional industries | Multi-payment scenarios, Mobile apps | API-first startups, Modern tech stacks |
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ ### NPM Global Installation
45
+
46
+ ```bash
47
+ npm install -g taiwan-payment-skill
48
+ ```
49
+
50
+ ### Initialize in Project
51
+
52
+ ```bash
53
+ # Auto-detect AI assistant
54
+ taiwan-payment init
55
+
56
+ # Specify AI assistant type
57
+ taiwan-payment init --ai claude # Claude Code
58
+ taiwan-payment init --ai cursor # Cursor
59
+ taiwan-payment init --ai windsurf # Windsurf
60
+ ```
61
+
62
+ ### Supported AI Platforms (14)
63
+
64
+ Claude Code · Cursor · Windsurf · GitHub Copilot · Antigravity · Kiro · Codex · Qoder · Roo Code · Gemini CLI · Trae · OpenCode · Continue · CodeBuddy
65
+
66
+ ---
67
+
68
+ ## Intelligent Tools
69
+
70
+ ### 1. BM25 Search Engine
71
+
72
+ Fast semantic search across payment gateway documentation and error codes.
73
+
74
+ ```bash
75
+ # Search error codes
76
+ python scripts/search.py "10100058" --domain error
77
+
78
+ # Search payment methods
79
+ python scripts/search.py "信用卡" --domain payment_method
80
+
81
+ # Search field mappings
82
+ python scripts/search.py "MerchantTradeNo" --domain field
83
+
84
+ # JSON output
85
+ python scripts/search.py "ATM" --format json
86
+ ```
87
+
88
+ **Search Domains:**
89
+ - `provider` - Provider comparison
90
+ - `operation` - API endpoints
91
+ - `error` - Error code lookup
92
+ - `field` - Field name mappings
93
+ - `payment_method` - Payment method specifications
94
+ - `troubleshoot` - Troubleshooting guides
95
+ - `reasoning` - Recommendation logic
96
+
97
+ ### 2. Smart Recommendation System
98
+
99
+ AI-powered provider recommendation based on business requirements.
100
+
101
+ ```bash
102
+ # High-volume e-commerce
103
+ python scripts/recommend.py "高交易量 電商 穩定"
104
+ # → Recommends ECPay (highest market share, proven stability)
105
+
106
+ # Multi-payment requirements
107
+ python scripts/recommend.py "多元支付 LINE Pay Apple Pay"
108
+ # → Recommends NewebPay (supports 13 payment methods)
109
+
110
+ # API-first design
111
+ python scripts/recommend.py "API RESTful JSON"
112
+ # → Recommends PAYUNi (modern RESTful design)
113
+ ```
114
+
115
+ ### 3. Connection Testing Tool
116
+
117
+ Verify API connectivity and credentials.
118
+
119
+ ```bash
120
+ # Test specific provider
121
+ python scripts/test_payment.py ecpay
122
+ python scripts/test_payment.py newebpay
123
+ python scripts/test_payment.py payuni
124
+
125
+ # Test all providers
126
+ python scripts/test_payment.py all
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Architecture
132
+
133
+ ```
134
+ taiwan-payment/
135
+ ├── SKILL.md # Main documentation (857 lines)
136
+ ├── EXAMPLES.md # Code examples (1425 lines)
137
+ ├── references/ # API specifications
138
+ │ ├── ECPAY_PAYMENT_REFERENCE.md
139
+ │ ├── NEWEBPAY_PAYMENT_REFERENCE.md
140
+ │ └── PAYUNI_PAYMENT_REFERENCE.md
141
+ ├── scripts/ # Python intelligent tools
142
+ │ ├── core.py # BM25 search engine (311 lines)
143
+ │ ├── recommend.py # Recommendation system (373 lines)
144
+ │ ├── search.py # Search CLI (150+ lines)
145
+ │ └── test_payment.py # Connection testing (359 lines)
146
+ └── data/ # Data-driven architecture (7 CSV files)
147
+ ├── providers.csv # Provider details
148
+ ├── operations.csv # API operations
149
+ ├── error-codes.csv # Error code mappings
150
+ ├── field-mappings.csv # Field name mappings
151
+ ├── payment-methods.csv # Payment method specs
152
+ ├── reasoning.csv # Recommendation rules (30+ scenarios)
153
+ └── troubleshooting.csv # Common issues (16 cases)
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Payment Methods
159
+
160
+ ### Credit Card
161
+ - One-time payment, Installments (3/6/12/18/24/30 periods)
162
+ - Recurring billing, Credit card tokenization
163
+
164
+ ### E-Wallets
165
+ - Apple Pay, Google Pay, Samsung Pay
166
+ - LINE Pay, Taiwan Pay
167
+
168
+ ### Bank Transfer
169
+ - WebATM, Virtual account (ATM)
170
+
171
+ ### Convenience Store
172
+ - CVS payment code, CVS barcode
173
+
174
+ ### Others
175
+ - TWQR, BNPL (Buy Now Pay Later), AFTEE, iCash
176
+
177
+ ---
178
+
179
+ ## Code Examples
180
+
181
+ ### ECPay Credit Card Payment
182
+
183
+ ```typescript
184
+ import { createPayment } from './ecpay-service';
185
+
186
+ const order = {
187
+ merchantId: '3002607',
188
+ orderId: `ORDER${Date.now()}`,
189
+ amount: 1050,
190
+ description: 'Product Purchase',
191
+ returnUrl: 'https://example.com/callback',
192
+ paymentMethod: 'Credit'
193
+ };
194
+
195
+ const form = await createPayment(order);
196
+ // Returns HTML form ready for submission
197
+ ```
198
+
199
+ ### NewebPay MPG Integration
200
+
201
+ ```typescript
202
+ import { createPayment } from './newebpay-service';
203
+
204
+ const order = {
205
+ merchantId: 'YOUR_MERCHANT_ID',
206
+ orderId: `ORDER${Date.now()}`,
207
+ amount: 2500,
208
+ description: 'E-commerce Order',
209
+ returnUrl: 'https://example.com/notify',
210
+ paymentMethod: 'CREDIT,VACC,CVS' // Multiple methods
211
+ };
212
+
213
+ const form = await createPayment(order);
214
+ ```
215
+
216
+ ### PAYUNi RESTful API
217
+
218
+ ```typescript
219
+ import axios from 'axios';
220
+ import { encryptPayUni } from './encryption';
221
+
222
+ const order = {
223
+ MerID: 'YOUR_MERCHANT_ID',
224
+ MerTradeNo: `ORDER${Date.now()}`,
225
+ TradeAmt: 3000,
226
+ ProdDesc: 'Subscription Service',
227
+ ReturnURL: 'https://example.com/callback',
228
+ PayType: 'Credit'
229
+ };
230
+
231
+ const { encryptInfo, hashInfo } = encryptPayUni(order);
232
+ const response = await axios.post('https://sandbox-api.payuni.com.tw/api/upp', {
233
+ MerID: order.MerID,
234
+ EncryptInfo: encryptInfo,
235
+ HashInfo: hashInfo
236
+ });
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Data-Driven Architecture
242
+
243
+ All business logic is stored in CSV files for easy maintenance:
244
+
245
+ - **providers.csv**: Provider configurations (encryption, test accounts, API endpoints)
246
+ - **operations.csv**: API operations (create, query, refund, recurring)
247
+ - **error-codes.csv**: Error code mappings with solutions
248
+ - **field-mappings.csv**: Field name translations across providers
249
+ - **payment-methods.csv**: Payment method specifications
250
+ - **reasoning.csv**: Recommendation rules (30+ business scenarios)
251
+ - **troubleshooting.csv**: Common issues and solutions (16 cases)
252
+
253
+ ---
254
+
255
+ ## Development Requirements
256
+
257
+ - **Node.js** >= 18.0.0 (CLI tool)
258
+ - **Python** >= 3.x (intelligent scripts, no external dependencies)
259
+
260
+ ---
261
+
262
+ ## Documentation
263
+
264
+ - [SKILL.md](./SKILL.md) - Complete skill documentation (857 lines)
265
+ - [EXAMPLES.md](./EXAMPLES.md) - 9 production-ready code examples (1425 lines)
266
+ - [CLAUDE.md](./CLAUDE.md) - Development guide for Claude Code
267
+
268
+ ### API References
269
+
270
+ - [ECPay Payment API](./references/ECPAY_PAYMENT_REFERENCE.md)
271
+ - [NewebPay Payment API](./references/NEWEBPAY_PAYMENT_REFERENCE.md)
272
+ - [PAYUNi Payment API](./references/PAYUNI_PAYMENT_REFERENCE.md)
273
+
274
+ ---
275
+
276
+ ## License
277
+
278
+ [MIT License](https://opensource.org/licenses/MIT)
279
+
280
+ ---
281
+
282
+ ## Related Projects
283
+
284
+ - [taiwan-invoice-skill](https://github.com/Moksa1123/taiwan-invoice) - Taiwan E-Invoice integration
285
+ - [taiwan-logistics-skill](https://github.com/Moksa1123/taiwan-logistics) - Taiwan logistics integration
286
+
287
+ ---
288
+
289
+ ## Support
290
+
291
+ - **Official Documentation**: See `references/` directory
292
+ - **Technical Support**:
293
+ - ECPay: techsupport@ecpay.com.tw
294
+ - NewebPay: 02-2655-8938
295
+ - PAYUNi: 02-2747-5100
296
+
297
+ ---
298
+
299
+ <p align="center">
300
+ <sub>Professional toolkit by <strong>Moksa</strong></sub><br>
301
+ <sub>service@moksaweb.com</sub>
302
+ </p>
303
+
304
+ <p align="center">
305
+ <sub>Last updated: 2026-01-29</sub>
306
+ </p>