管理支援的貨幣

您目前查看的是 Apigee Edge 說明文件。
前往 Apigee X 說明文件
info

簡介

在初始設定營利功能時,Apigee Edge 設定團隊會為貴機構設定貨幣和預設貨幣。

您可以查看貴機構支援的幣別、新增支援的幣別,或刪除支援的幣別 (如果開發人員或費率方案未使用這些幣別)。

透過使用者介面管理支援的貨幣

在機構設定檔頁面的「稅金和幣別」部分,管理支援的幣別並設定預設幣別。詳情請參閱「使用 UI 管理機構設定檔」。

使用 API 管理支援的幣別

如要使用 API 管理支援的幣別,請參閱下列各節。

使用 API 查看支援的幣別

查看貴機構支援的單一幣別或所有幣別。

如要查看貴機構支援的個別幣別,請對 /mint/organizations/{org_name}/supported-currencies/{supportedCurrencyId} 發出 GET 要求,其中 {supportedCurrency_id} 是要查看的支援幣別 ID。例如:

curl -X GET -H "Accept: application/json"  \
  "https://api.enterprise.apigee.com/v1/mint/organizations/{org_name}/supported-currencies/usd" \
-u email:password

如要查看貴機構支援的所有幣別,請向 /mint/organizations/{org_name}/supported-currencies 發出 GET 要求。例如:

curl -X GET "https://api.enterprise.apigee.com/v1/mint/organizations/{org_name}/supported-currencies" \
  -H "Accept: application/json"  \
-u email:password

以下是回應範例:

{
"supportedCurrency" : [ {
    "description" : "US Dollar",
    "displayName" : "US Dollar",
    "id" : "usd",
    "name" : "USD",
    "organization" : {
      ...
    "status" : "ACTIVE",
    "virtualCurrency" : false
  }, {
    "creditLimit" : 5000.0000,
    "description" : "Euro",
    "displayName" : "Euro",
    "id" : "eur",
    "name" : "EUR",
    "organization" : {
      ...
    },
    "status" : "INACTIVE",
    "virtualCurrency" : false  
  } ],
  "totalRecords" : 2
}

使用 API 新增支援的幣別

如要新增支援的幣別,請對 /mint//organizations/{org_name}/supported-currencies 發出 POST 要求。新增每種支援的幣別時,您需要在要求主體中指定下列資訊:

  • 支援的幣別名稱。名稱是貨幣的 ISO 4217 代碼,例如美元的代碼是 USD。
  • 顯示名稱。
  • 說明:
  • 貨幣是否為虛擬貨幣。
  • 貨幣狀態,也就是貨幣是否可用。
  • 要新增支援貨幣的機構。

您可以選擇設定下列項目:

  • 支援幣別的信用額度 (僅限後付開發人員)。
  • 支援幣別的最低加值金額 (僅限預付型開發人員)。

詳情請參閱「支援的幣別設定屬性」。

舉例來說,以下指令會為機構新增支援的幣別:

curl -H "Content-Type: application/json" -X POST -d \
  '{
     "description": "US Dollar",
     "displayName": "US Dollar",
     "virtualCurrency": "false",
     "name": "USD",
     "organization": {
       "id": "{org_name}"
     },
     "status": "ACTIVE"
  }' \
  "https://api.enterprise.apigee.com/v1/mint/organizations/{org_name}/supported-currencies" \
  -u email:password

使用 API 設定預設幣別

如要設定機構的預設貨幣,請編輯機構設定檔,將 currency 值設為支援的 ISO 4217 貨幣代碼,詳情請參閱「使用 API 管理機構設定檔」。

使用 API 編輯支援的幣別

如要編輯支援的貨幣,請對 /mint/organizations/{org_name}/{supportedCurrencyId} 發出 PUT 要求,其中 {supportedCurrency_id} 是要更新的支援貨幣 ID。您需要在要求主體中指定更新後的屬性,以及支援的幣別 ID。舉例來說,下列 API 呼叫會編輯支援貨幣的說明和顯示名稱 (範例中會醒目顯示更新的屬性):

curl -H "Content-Type: application/json" -X PUT -d \
  '{
     "description": "United States Dollar",
     "displayName": "United States Dollar",
     "id": "usd",
     "name": "USD",
     "organization": {
       "id": "{org_name}"
     },
     "status" : "ACTIVE",
     "virtualCurrency": "false"
  }' \
  "https://api.enterprise.apigee.com/v1/mint/organization/{org_name}/supported-currencies/usd" -d \
  -u email:password

使用 API 刪除支援的幣別

如要刪除支援的幣別,請對 /mint/organizations/{org_name}/supported-currencies/{currency_id} 發出 DELETE 要求,其中 {currency_id} 是要刪除的支援幣別 ID。例如:

curl -X DELETE -H "Accept: application/json"  \
  "https://api.enterprise.apigee.com/v1/mint/organizations/{org_name}/supported-currencies/usd" \
  -u email:password

API 的幣別設定屬性

下表彙整可透過 API 設定的設定屬性。

名稱 說明 預設 是否必要?
creditLimit

這項屬性僅適用於後付開發人員。支援幣別的信用額度。

N/A
說明

支援的幣別說明。

N/A
displayName

支援的貨幣顯示名稱。

N/A
minimumTopupAmount

這項屬性僅適用於預付型開發人員。開發人員以指定幣別為預付帳戶餘額儲值的最低金額。

N/A
名稱

貨幣的 ISO 4217 代碼,例如美元的代碼為 USD。

N/A
組織

支援貨幣的機構。

N/A
狀態

支援幣別的狀態。有效值包括:

  • 有效:可使用支援的幣別。
  • 無效:無法使用支援的貨幣。
N/A
virtualCurrency

指出支援的貨幣是否為虛擬貨幣。有效值包括:

  • true:支援的貨幣為虛擬貨幣。
  • false:支援的貨幣不是虛擬貨幣。
N/A