|
1 | | -PAYUNi 統一金流 .NET SDK |
2 | | -=============== |
| 1 | +# 目錄 |
| 2 | +* [環境需求](#環境需求) |
| 3 | +* [安裝](#安裝) |
| 4 | +* [使用方式](#使用方式) |
| 5 | +# 環境需求 |
| 6 | +* .NET Framework 4.7.2 |
| 7 | +# 安裝 |
| 8 | +* 請加入PayuniSDK參考至專案 |
| 9 | +* 請至NuGet安裝Newtonsoft.Json |
| 10 | +```clike |
| 11 | +NuGet\Install-Package Newtonsoft.Json -Version 13.0.1 |
| 12 | +``` |
| 13 | +* 請至NuGet安裝Portable.BouncyCastle |
| 14 | +```clike |
| 15 | +NuGet\Install-Package Portable.BouncyCastle -Version 1.9.0 |
| 16 | +``` |
| 17 | + |
| 18 | +# 使用方式 |
| 19 | +* 正式區 |
| 20 | +```csharp |
| 21 | +payuniAPI payuniapi = new payuniAPI(key, iv); |
| 22 | +``` |
| 23 | +* 測試區 |
| 24 | +```csharp |
| 25 | +payuniAPI payuniapi = new payuniAPI(key, iv, type); |
| 26 | +``` |
| 27 | +* API串接 |
| 28 | +```csharp |
| 29 | +string result = payuniApi.UniversalTrade(encryptInfo, mode); |
| 30 | +``` |
| 31 | +* upp ReturnURL、NotifyURL接收到回傳參數後處理方式 |
| 32 | +```csharp |
| 33 | +string result = payuniApi.ResultProcess(requestData); |
| 34 | +``` |
| 35 | +* 參數說明 |
| 36 | + * EncryptInfoModel encryptInfo |
| 37 | + * 參數詳細內容請參考[統一金流API串接文件](https://www.payuni.com.tw/docs/web/#/7/34)對應功能請求參數的EncryptInfo |
| 38 | +```csharp= |
| 39 | +EncryptInfoModel encryptInfo = new EncryptInfoModel(); |
| 40 | +encryptInfo.MerID = "ABC"; |
| 41 | +encryptInfo.Timestamp= DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(); |
| 42 | +``` |
| 43 | + * string merKey |
| 44 | + * 請登入PAYUNi平台檢視商店串接資訊取得 Hash Key |
| 45 | + * string merIV |
| 46 | + * 請登入PAYUNi平台檢視商店串接資訊取得 Hash IV |
| 47 | + * string type (非必填) |
| 48 | + * 連線測試區 => t |
| 49 | + * 連線正式區 => 不給該參數或給空值 |
| 50 | + * string mode |
| 51 | + * 整合式支付頁 => upp |
| 52 | + * 虛擬帳號幕後 => atm |
| 53 | + * 超商代碼幕後 => cvs |
| 54 | + * 信用卡幕後 => credit |
| 55 | + * 交易查詢 => trade_query |
| 56 | + * 交易請退款 => trade_close |
| 57 | + * 交易取消授權 => trade_cancel |
| 58 | + * 信用卡Token(約定) => credit_bind_query |
| 59 | + * 信用卡Token取消(約定/記憶卡號) => credit_bind_cancel |
| 60 | + * 愛金卡退款(ICASH) => trade_refund_icash |
| 61 | +* 其餘請參考[範例](https://github.com/payuni/PHP_SDK/tree/main/examples) |
| 62 | + |
| 63 | +* 原生C# |
| 64 | +```csharp= |
| 65 | +using PayuniSDK; |
| 66 | +string merKey = "12345678901234567890123456789012"; |
| 67 | +string merIV = "1234567890123456"; |
| 68 | +payuniAPI payuni = new payuniAPI(key, iv); |
| 69 | +EncryptInfoModel encryptInfo = new EncryptInfoModel(); |
| 70 | +encryptInfo.MerID = "ABC"; |
| 71 | +encryptInfo.TradeNo = "16614190477810373246"; |
| 72 | +encryptInfo.Timestamp= DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(); |
| 73 | +string result = payuniApi.UniversalTrade(encryptInfo, "trade_query"); |
| 74 | +``` |
| 75 | +# LICENSE |
| 76 | +```text |
| 77 | +Copyright 2022 PRESCO. All rights reserved. |
| 78 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 79 | +you may not use this file except in compliance with the License. |
| 80 | +You may obtain a copy of the License at |
| 81 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 82 | +Unless required by applicable law or agreed to in writing, software |
| 83 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 84 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 85 | +See the License for the specific language governing permissions and |
| 86 | +limitations under the License. |
| 87 | +``` |
0 commit comments