管理支援的貨幣

您正在查看 Apigee Edge 說明文件。
查看 Apigee X 說明文件
資訊

引言

在進行營利程序的初始設定過程中,Apigee Edge 設定團隊會設定貴機構支援的貨幣和預設貨幣。

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

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

在「機構個人資料」頁面的「稅金和貨幣」專區中管理支援的貨幣,並在「稅金和貨幣」專區中設定預設貨幣。詳情請參閱「使用 UI 管理機構設定檔」。

使用 API 管理支援的貨幣

使用 API 管理支援的貨幣,詳情請見以下各節。

使用 API 查看支援的貨幣

查看貴機構支援的個別貨幣,或貴機構支援的所有貨幣。

如要查看貴機構支援的個別貨幣,請向 /mint/organizations/{org_name}/supported-currencies/{supportedCurrencyId} 發出 GET 要求,其中 {supportedCurrency_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 代碼,例如美元代表美元。
  • 顯示名稱。
  • 說明:
  • 是否貨幣為虛擬貨幣。
  • 貨幣狀態,顯示幣別是否可用。
  • 新增支援貨幣的機構。

您也可以設定:

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

詳情請參閱支援的貨幣設定屬性

舉例來說,下列函式會為機構新增支援的貨幣:

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 設定預設貨幣

編輯機構設定檔時,請按照使用 API 管理機構資料的說明,將 currency 值設為支援的 ISO 4217 貨幣代碼,藉此設定機構的預設貨幣。

使用 API 編輯支援的貨幣

如要編輯支援的貨幣,請向 /mint/organizations/{org_name}/{supportedCurrencyId} 發出 PUT 要求,其中 {supportedCurrency_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} 是要刪除的支援貨幣之識別。例如:

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

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

不適用
description

支援幣別的說明。

不適用
displayName

用於顯示支援貨幣的名稱。

不適用
minimumTopupAmount

這個屬性僅適用於預付型開發人員。開發人員能以指定幣別存入預付帳戶餘額的最低金額。

不適用
名稱

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

不適用
機構

支援貨幣的機構。

不適用
資格

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

  • ACTIVE:支援的貨幣。
  • 無效:不支援使用的貨幣。
不適用
virtualCurrency

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

  • true:支援的貨幣為虛擬貨幣。
  • false:支援的貨幣不是虛擬貨幣。
不適用