FAQ知識庫
金流FAQ | 如何避免訂單編號重覆而交易失敗 |
---|---|
如何避免訂單編號重覆而交易失敗(For English version please see below) 呼叫API將[廠商交易編號MerchantTradeNo]傳給綠界建立訂單 若遇消費者在付款過程中網路連線問題、想更改付款方式而回上一頁、 關閉頁面後又回到商城繼續付款等情境,將出現交易失敗訊息,如下圖:
因為此API設計[廠商交易編號MerchantTradeNo]為唯一值無法被重覆使用, 所以貴司資料送出後就已經被綠界系統記錄了。 若再次使用同一組[廠商交易編號MerchantTradeNo]付款時將出現訂單編號重覆訊息。
解決方法:每次呼叫API前,由貴司[訂單編號]+[一組n碼]不重覆編號生成[廠商交易編號], 並記錄[訂單編號]與[廠商交易編號]關聯於貴司資料庫中,再傳入生成[廠商交易編號]給綠界, 可確保使用者順利完成交易。 注意事項: 1.API參數[廠商交易編號]長度限制20碼,由[訂單編號]+[一組n碼]生成時,留意不可超出。 2.[廠商交易編號]僅限中英文數字混合,無法使用特殊字元(例:#@&...)
How to Avoid Duplicate Order Numbers Leading to Transaction FailureWhen calling the API, transmit the [MerchantTradeNo] to ECPay to create the order. If consumers encounter network connection issues during payment, wish to change payment method and go back to the previous page, or close the page and then return to the store to continue payment, a transaction failure message will appear, as shown below (Image A): Due to that the [MerchantTradeNo] in the API is designed to be unique and cannot be reused, once the data is sent, it is already recorded in the ECPay system. If the same [MerchantTradeNo] is used again for payment, a message indicating a duplicate order number will appear(Image B).
SolutionBefore each API call, please generate a unique [MerchantTradeNo] by combining the [Order Number] with [a set of n digits]. Record the association between the [Order Number] and [MerchantTradeNo] in your database before transmitting the generated [MerchantTradeNo] to ECPay. This ensures that users complete transactions successfully (Image C). Important Notes1. The length of the API parameter [MerchantTradeNo] is limited to 20 characters. Ensure that it does not exceed this length when generating it from the [Order Number] and [a set of n digits]. 2. The [MerchantTradeNo] must consist of a combination of letters and numbers in Chinese and English. Special characters (e.g., #, @, &) are not permitted.
|