Yi Lin Tsai
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 綠界金流串接服務 ## 產生訂單 ### 應用場景: - 消費者在特店進行購物後送出訂單。 **Step 1.** 特店:將訂單資料以 SERVER POST(HTTP Method)傳送至綠界,取該筆訂單 SPToken。 **Step 2.** 特店:根據 MerchantID、SPToken 完成付款步驟。 - 介接路徑: 正式環境=> https://payment.ecpay.com.tw/SP/CreateTrade 測試環境=> https://payment-stage.ecpay.com.tw/SP/CreateTrade 以下為舉例待加密的字串: ``` TradeDesc=促銷方案&PaymentType=aio&MerchantTradeDate=2018/05/04 09:50:23&MerchantTradeNo=ecpay20180504110723&MerchantID=2000132&ReturnURL=https://www.ecpay.com.tw/receive.php&ItemName=Apple iphone 7 手機殼&TotalAmount=1000&ChoosePayment=ALL&EncryptType=1 ``` 1. 將傳遞參數依照第一個英文字母,由 A 到 Z 的順序來排序(遇到第一個英名字母相同時,以第二個英名字母來比較,以此類推),並且以&方式將所有參數串連。 ``` ChoosePayment=ALL&EncryptType=1&ItemName=Apple iphone 7 手機殼&MerchantID=2000132&MerchantTradeDate=2018/05/04 11:07:23&MerchantTradeNo=ecpay20180504110723&PaymentType=aio&ReturnURL=https://www.ecpay.com.tw/receive.php&TotalAmount=1000&TradeDesc=促銷方案 ``` 2. 參數最前面加上 HashKey、最後面加上 HashIV ``` HashKey=5294y06JbISpM5x9&ChoosePayment=ALL&EncryptType=1&ItemName=Apple iphone 7 手機殼&MerchantID=2000132&MerchantTradeDate=2018/05/04 11:07:23&MerchantTradeNo=ecpay20180504110723&PaymentType=aio&ReturnURL=https://www.ecpay.com.tw/receive.php&TotalAmount=1000&TradeDesc=促銷方案&HashIV=v77hoKGq4kWxNNIS ``` 3. 將整串字串進行 URL encode - [線上Url Encode / Decode](https://www.ez2o.com/App/Web/UrlEncodeDecode) ``` HashKey%3d5294y06JbISpM5x9%26ChoosePayment%3dALL%26EncryptType%3d1%26ItemName%3dApple+iphone+7+%e6%89%8b%e6%a9%9f%e6%ae%bc%26MerchantID%3d2000132%26MerchantTradeDate%3d2018%2f05%2f04+11%3a07%3a23%26MerchantTradeNo%3decpay20180504110723%26PaymentType%3daio%26ReturnURL%3dhttps%3a%2f%2fwww.ecpay.com.tw%2freceive.php%26TotalAmount%3d1000%26TradeDesc%3d%e4%bf%83%e9%8a%b7%e6%96%b9%e6%a1%88%26HashIV%3dv77hoKGq4kWxNNIS ``` 4. 轉為小寫 - [線上英文轉為小寫](https://www.ifreesite.com/abc/) ``` hashkey%3d5294y06jbispm5x9%26choosepayment%3dall%26encrypttype%3d1%26itemname%3dapple+iphone+7+%e6%89%8b%e6%a9%9f%e6%ae%bc%26merchantid%3d2000132%26merchanttradedate%3d2018%2f05%2f04+11%3a07%3a23%26merchanttradeno%3decpay20180504110723%26paymenttype%3daio%26returnurl%3dhttps%3a%2f%2fwww.ecpay.com.tw%2freceive.php%26totalamount%3d1000%26tradedesc%3d%e4%bf%83%e9%8a%b7%e6%96%b9%e6%a1%88%26hashiv%3dv77hokgq4kwxnnis ``` 5. 以 SHA256 加密方式來產生雜凑值(大寫) - [線上轉SHA256](https://www.ez2o.com/App/Coder/SHA) ``` B4A5010C622CC8710182465D1A8CFFF29B9212264E679C8468893C4A6EBB716B ``` 6. Postman 模擬訂單 :::info __<font color=#000088>POST</font>__ https://payment-stage.ecpay.com.tw/SP/CreateTrade ::: + Body parameters |Body參數|傳輸格式|描述| |:------:|:--:|:--:| |ChoosePayment<font color=red>(必填)</font>|form-data|選擇預設付款方式| |EncryptType<font color=red>(必填)</font>|form-data|CheckMacValue 加密類型| |ItemName<font color=red>(必填)</font>|form-data|商品名稱| |MerchantID<font color=red>(必填)</font>|form-data|特店編號| |MerchantTradeDate<font color=red>(必填)</font>|form-data|特店交易時間| |MerchantTradeNo<font color=red>(必填)</font>|form-data|特店交易編號| |PaymentType<font color=red>(必填)</font>|form-data|交易類型| |ReturnURL<font color=red>(必填)</font>|form-data|付款完成通知回傳網址| |TotalAmount<font color=red>(必填)</font>|form-data|交易金額| |TradeDesc<font color=red>(必填)</font>|form-data|交易描述| |CheckMacValue<font color=red>(必填)</font>|form-data|檢查碼| --- :::warning Request Content-Type: form-data |key|value| |:------:|:--| |ChoosePayment|ALL| |EncryptType|1| |ItemName|Apple iphone 7 手機殼| |MerchantID|2000132| |MerchantTradeDate|2018/05/04 11:07:23| |MerchantTradeNo|ecpay20180504110723| |PaymentType|aio| |ReturnURL|https://www.ecpay.com.tw/receive.php| |TotalAmount|1000| |TradeDesc|促銷方案| |CheckMacValue|B4A5010C622CC8710182465D1A8CFFF29B9212264E679C8468893C4A6EBB716B| ::: ![新增訂單](https://i.imgur.com/RJqHPio.png) <font color=green> #### Success 200 </font> :::success Response Content-Type: application/json ```javascript= {"RtnCode":"1","RtnMsg":"成功","SPToken":"0182A83944344D96817ABE1EF4176BB4","MerchantID":"2000132","MerchantTradeNo":"ecpay20180504110723","CheckMacValue":"262CFB85115E454900990E9C12DD1F9715340F8073006B6B896DC670FB62DA2E"} ``` ::: ## 進行交易訂單 - [交易訂單 (Demo)](https://codepen.io/andy6804tw/pen/dezpxX) - 應用場景: 根據回傳 SPToken 完成後續付款步驟,特店可利用以下程式碼,進行後續交易。 **Step 1.** 特店:依收到的特店交易識別碼 SPToken 設定到前端的 JS 交易參數中。 **Step 2.** 消費者:選擇付款方式進行付款。 - 介接路徑: 正式環境=> https://payment.ecpay.com.tw/Scripts/SP/ECPayPayment_1.0.0.js 測試環境=> https://payment-stage.ecpay.com.tw/Scripts/SP/ECPayPayment_1.0.0.js --- :::warning 前端付款按鈕 ```js <script src="https://payment-stage.ecpay.com.tw/Scripts/SP/ECPayPayment_1.0.0.js" data-MerchantID="2000132" data-SPToken="E1AEEC8F56EA4A07B49008BD1462BD2E" data-PaymentType="CREDIT " data-PaymentName="信用卡" data-CustomerBtn="0" > </script> ``` ::: ![](https://i.imgur.com/e1rLfFv.png) ![](https://i.imgur.com/aciJK7C.png) ## 查詢訂單 - 應用場景: 提供特店查詢訂單資訊,可透過此 API 來過濾是否為有效訂單。 **Step 1.** 特店:以 Server POST 方式傳送以下參數至 API 網址 **Step 2.** 綠界:接受並檢核正確後,回傳訂單資訊參數。 - 介接路徑: 正式環境:https://payment.ecpay.com.tw/Cashier/QueryTradeInfo/V5 測試環境:https://payment-stage.ecpay.com.tw/Cashier/QueryTradeInfo/V5 以下為舉例待加密的字串: ``` MerchantID=2000132&MerchantTradeNo=ecpay20180504112423&TimeStamp=1525410372 ``` 1. 將傳遞參數依照第一個英文字母,由 A 到 Z 的順序來排序(遇到第一個英名字母相同時,以第二個英名字母來比較,以此類推),並且以&方式將所有參數串連。 ``` MerchantID=2000132&MerchantTradeNo=ecpay20180504112423&TimeStamp=1525410372 ``` 2. 參數最前面加上 HashKey、最後面加上 HashIV ``` HashKey=5294y06JbISpM5x9&MerchantID=2000132&MerchantTradeNo=ecpay20180504112423&TimeStamp=1525410372&HashIV=v77hoKGq4kWxNNIS ``` 3. 將整串字串進行 URL encode - [線上Url Encode / Decode](https://www.ez2o.com/App/Web/UrlEncodeDecode) ``` HashKey%3d5294y06JbISpM5x9%26MerchantID%3d2000132%26MerchantTradeNo%3decpay20180504112423%26TimeStamp%3d1525410372%26HashIV%3dv77hoKGq4kWxNNIS ``` 4. 轉為小寫 - [線上英文轉為小寫](https://www.ifreesite.com/abc/) ``` hashkey%3d5294y06jbispm5x9%26merchantid%3d2000132%26merchanttradeno%3decpay20180504112423%26timestamp%3d1525410372%26hashiv%3dv77hokgq4kwxnnis ``` 5. 以 SHA256 加密方式來產生雜凑值(大寫) - [線上轉SHA256](https://www.ez2o.com/App/Coder/SHA) ``` 48ABB4DBF2365897B2A17C48EBCBA82274E7D7DE79F1F955115C4258482A045B ``` 6. Postman 查詢訂單 :::info __<font color=#000088>POST</font>__ https://payment-stage.ecpay.com.tw/Cashier/QueryTradeInfo/V5 ::: + Body parameters |Body參數|傳輸格式|描述| |:------:|:--:|:--:| |MerchantID<font color=red>(必填)</font>|form-data|特店編號| |MerchantTradeNo<font color=red>(必填)</font>|form-data|特店交易編號| |TimeStamp<font color=red>(必填)</font>|form-data|驗證時間| |CheckMacValue<font color=red>(必填)</font>|form-data|檢查碼| > [線上取得時間戳記](http://www.textdiff.com/) --- :::warning Request Content-Type: form-data |key|value| |:------:|:--| |MerchantID|2000132| |MerchantTradeNo|ecpay20180504112423| |TimeStamp|1525406240| |CheckMacValue|48ABB4DBF2365897B2A17C48EBCBA82274E7D7DE79F1F955115C4258482A045B| ::: ![查詢訂單](https://i.imgur.com/Lm4xaTm.png) <font color=green> #### Success 200 </font> :::success Response Content-Type: text ```javascript= CustomField1=&CustomField2=&CustomField3=&CustomField4=&HandlingCharge=1&ItemName=Apple iphone 7 手機殼&MerchantID=2000132&MerchantTradeNo=ecpay20180504112423&PaymentDate=2018/05/04 11:27:39&PaymentType=Credit_CreditCard&PaymentTypeChargeFee=1&StoreID=&TradeAmt=1000&TradeDate=2018/05/04 11:24:57&TradeNo=1805041124578172&TradeStatus=1&CheckMacValue=7FED9171711B628633FDBA39EBEE159E2E9A1A6AEB9ACD87B105778EECE2FB06 ``` :::

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully