擷取訂閱項目後,您可以使用成功回應中的資訊變更訂閱狀態或更新訂閱項目。本頁重點為說明擷取及更新訂閱項目的不同方式。
擷取訂閱項目
如要擷取已成功訂購或轉移的訂閱項目,請使用下列 GET
HTTP 要求。
GET https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。SUBSCRIPTION_ID
:每位客戶專屬的訂閱 ID。您可以使用擷取所有經銷商訂閱項目的方法來擷取這個值。
此作業在要求主體中沒有參數。
成功的回應會傳回 HTTP 200
狀態碼和訂閱設定。在以下範例回應中,isInTrial
屬性為 false
,但沒有 trialEndTime
屬性,表示這位客戶從未使用過這個方案的 30 天免費試用方案。
{
"kind": "reseller#subscription",
"customerId": "C0123456",
"subscriptionId": "123",
"skuId": "1010020028",
"billingMethod": "ONLINE",
"creationTime": "1331647980142",
"plan": {
"planName": "ANNUAL",
"isCommitmentPlan": true,
"commitmentInterval": {
"startTime": "1331647980142",
"endTime": "1363183980142"
}
},
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 10,
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "RENEW_CURRENT_USERS_MONTHLY_PAY"
},
"purchaseOrderId": "example.com_annual_1",
"status": "ACTIVE",
"resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
"skuName": "Google Workspace Business Standard"
}
擷取客戶的所有訂閱項目
如要擷取特定經銷商客戶已成功訂購或轉移的所有訂閱項目,請使用下列 GET
HTTP 要求,並附上授權權杖:
GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerId=CUSTOMER_ID value&pageToken=START_DATE&maxResults=MAX_NUMBER
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。START_DATE
:開始日期,格式為YYYY-MM-DD
。MAX_NUMBER
:回應頁面傳回的結果數量上限。
此作業在要求主體中沒有參數。
成功的回應會傳回 HTTP 200
狀態碼,以及客戶的訂閱項目和設定清單。訂閱項目清單可能包含未在這個版本的 Reseller API 中管理的產品。
如果您未管理這位客戶,系統會傳回 403 "Forbidden"
錯誤。
擷取客戶的所有可轉移訂閱項目
如要擷取所有可能轉移至經銷商管理的客戶訂閱項目,請使用下列 GET
HTTP 要求,並附上授權權杖。customerId
是必要參數,也是擷取經銷商客戶帳戶時傳回的客戶專屬 ID。customerAuthToken
是客戶提供的轉移權杖,專屬於您的經銷商 ID。客戶產生後,有效期限為 30 天。如要進一步瞭解客戶如何產生憑證,請參閱「將 Google Workspace 帳戶轉移給經銷商」。
GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerId=CUSTOMER_ID&customerAuthToken=AUTH_TOKEN&pageToken=START_DATE&maxResults=MAX_NUMBER
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。AUTH_TOKEN
:客戶提供的轉移權杖,專屬於您的經銷商 ID。由客戶產生後,有效期限為 30 天。如要進一步瞭解客戶如何產生權杖,請參閱「將 Google Workspace 帳戶轉移給經銷商」。如果這個值無效或已過期,API 回應會傳回403 "Forbidden"
錯誤。START_DATE
:開始日期,格式為YYYY-MM-DD
。MAX_NUMBER
:回應頁面傳回的結果數量上限。
此作業在要求主體中沒有參數。
成功的回應會傳回 HTTP 200
狀態碼,以及客戶可轉移訂閱項目的清單,其中包含轉移憑證的到期日,以及轉移訂單中所需的最低座位數量。客戶可能擁有其他無法轉移的訂閱項目。
{
"kind": "reseller#subscriptions",
"subscriptions": [
{
"kind": "subscriptions#subscription",
"customerId": "custId-6543",
"subscriptionId": "432",
"skuId": "1010020028",
"billingMethod": "ONLINE",
"creationTime": "1331647980142",
"plan": {
"planName": "ANNUAL",
"isCommitmentPlan": true,
"commitmentInterval": {
"startTime": "1331647980142",
"endTime": "1363183980142"
}
},
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 10,
"maximumNumberOfSeats": 500,
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
},
"transferInfo": {
"transferabilityExpirationTime": "1333183980142",
"minimumTransferableSeats": "20"
},
"purchaseOrderId": "PO_890",
"status": "ACTIVE",
"resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
"skuName": "Google Workspace Business Standard"
},
{
"kind": "subscriptions#subscription",
"customerId": "custId-6543",
"subscriptionId": "140",
"skuId": "1010020028",
"creationTime": "1329389322728",
"plan": {
"planName": "FLEXIBLE",
"isCommitmentPlan": false
},
"seats": {
"kind": "subscriptions#seats",
"maximumNumberOfSeats": 50
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false,
"trialEndTime": "1331877480016"
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
},
"transferInfo": {
"transferabilityExpirationTime": "1333183780159",
"minimumTransferableSeats": "10"
},
"purchaseOrderId": "",
"status": "ACTIVE",
"resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
"skuName": "Google Workspace Business Standard"
},
],
"nextPageToken": "token"
}
如果您打算使用批次作業轉移這些訂閱項目,請轉移所有訂閱項目。逐一轉移每個訂閱項目會導致錯誤。此外,批次作業只會轉移狀態為 ACTIVE
的訂閱項目。詳情請參閱「轉移訂閱項目」。
擷取所有經銷商訂閱項目
如要擷取經銷商成功訂購或轉移的所有訂閱項目,請使用下列 GET
HTTP 要求,並附上授權權杖。
GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerNamePrefix=PREFIX &pageToken=TOKEN&maxResults=MAX_NUMBER
更改下列內容:
PREFIX
:要查詢訂閱項目的客戶名稱開頭。TOKEN
:用於識別伺服器應傳回的特定結果頁面的符記。MAX_NUMBER
:回應頁面傳回的結果數量上限。
這項作業可使用 OAuth 唯讀存取範圍。customerNamePrefix
、pageToken
和 maxResults
是選用的查詢字串。
以下範例會擷取所有經銷商的訂閱項目,這些訂閱項目的客戶名稱以「exam」開頭:
GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerNamePrefix=exam
{
"kind": "reseller#subscriptions",
"subscriptions": [
{
"kind": "subscriptions#subscription",
"customerId": "C0123456",
"subscriptionId": "123",
"skuId": "1010020028",
"creationTime": "1331647980142",
"billingMethod": "ONLINE",
"plan": {
"planName": "ANNUAL",
"isCommitmentPlan": true,
"commitmentInterval": {
"startTime": "1331647980142",
"endTime": "1363183980142"
}
},
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 10,
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
},
"purchaseOrderId": "PO_135",
"status": "ACTIVE",
"resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
"skuName": "Google Workspace Business Standard"
},
{
"kind": "subscriptions#subscription",
"customerId": "custId-5678",
"subscriptionId": "1404686",
"skuId": "1010020028",
"billingMethod": "ONLINE",
"creationTime": "1329389322728",
"plan": {
"planName": "FLEXIBLE",
"isCommitmentPlan": false
},
"seats": {
"kind": "subscriptions#seats",
"maximumNumberOfSeats": 50,
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false,
"trialEndTime": "1331877480016"
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "AUTO_RENEW"
},
"purchaseOrderId": "",
"status": "ACTIVE",
"resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
"skuName": "Google Workspace Business Standard"
},
],
"nextPageToken": "token"
}
更新訂閱方案
更新 Google Workspace 方案的方式因方案而異。更新企劃書前,請考量下列事項:
建立訂閱項目時,如果客戶符合資格,訂閱方案可以是 30 天的試用方案。彈性付款方案和年約付款方案都提供 30 天的免費試用期。在試用期間,您可以視需要變更訂閱的付款方案,改為彈性方案或年約方案。不過,在試用期結束且方案生效後,更新方案時會遵循其他訂閱方案有效期內的規則。如要立即將試用訂閱方案轉移至有效期內的方案,請從 30 天免費試用訂閱方案開始付費服務。如需進一步瞭解 30 天試用方案的相關資訊和客戶資格規則,請前往管理說明中心。
您可以將彈性方案更新為年約方案。
您無法更新年約方案。
部分方案不適用於所有產品。如要進一步瞭解這些方案使用的產品,請參閱「產品與 SKU」。
如要將 30 天試用方案或彈性訂閱方案更新為年約方案,請使用下列 POST
HTTP 要求:
POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/changePlan
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。SUBSCRIPTION_ID
:每位客戶專屬的訂閱 ID。您可以使用擷取所有經銷商訂閱項目的方法來擷取這個值。
以下範例會使用值為 123 的 subscriptionId
更新訂閱項目。customerId
為 C0123456。
POST https://reseller.googleapis.com/apps/reseller/v1/customers/C0123456/subscriptions/123/changePlan
要求主體包含以下內容:
{
"kind": "reseller#changePlanRequest",
"planName": "ANNUAL_MONTHLY_PAY",
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 10
},
"purchaseOrderId": "123_March2012"
}
成功的回應會傳回 HTTP 201
狀態碼,並傳回更新的訂閱方案設定:
{
"kind": "reseller#subscription",
"customerId": "C0123456",
"subscriptionId": "123",
"skuId": "1010020028",
"creationTime": "1331647980142",
"plan": {
"planName": "ANNUAL",
"isCommitmentPlan": true,
"commitmentInterval": {
"startTime": "1331647980142",
"endTime": "1363183980142"
}
},
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 10,
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
},
"purchaseOrderId": "123_March2012",
"status": "ACTIVE",
"skuName": "Google Workspace Business Standard"
}
更新訂閱項目的座位
更新年約方案訂閱項目時,使用的訂閱屬性與更新 Google Workspace 彈性方案訂閱項目時不同。
更新年約方案的座位數
如要更新年繳方案訂閱者的使用者授權設定,請使用下列 POST
HTTP 要求:
POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/changeSeats
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。SUBSCRIPTION_ID
:每位客戶專屬的訂閱 ID。您可以使用擷取所有經銷商訂閱項目的方法來擷取這個值。
以下範例會使用 123 subscriptionId
更新訂閱項目。customerId
為 C0123456。要求的內容會因方案類型而異:
POST https://reseller.googleapis.com/apps/reseller/v1/customers/C0123456/subscriptions/123/changeSeats
Google Workspace 年約方案的訂閱項目會使用這個要求本文體來更新使用者授權數。numberOfSeats
值是總和。舉例來說,如果您先前有 10 個使用者授權,且有 5 個新授權的客戶訂單,則要求內文中 numberOfSeats
的總數為 15,如以下範例所示:
{
"kind": "subscriptions#seats",
"numberOfSeats": 15
}
更新彈性方案訂閱的座位
Google Workspace 彈性方案的訂閱方案會使用要求主體更新使用者授權。maximumNumberOfSeats
值是現有授權和新授權的總數。這是帳戶可配置的使用者授權數量上限。
{
"kind": "subscriptions#seats",
"maximumNumberOfSeats": 15
}
成功的回應會傳回 HTTP 201
狀態碼和更新的訂閱授權設定:
{
"kind": "reseller#subscription",
"customerId": "C0123456",
"subscriptionId": "123",
"skuId": "1010020028",
"creationTime": "1331647980142",
"plan": {
"planName": "FLEXIBLE",
"isCommitmentPlan": false
},
"seats": {
"kind": "subscriptions#seats",
"maximumNumberOfSeats": 15,
"licensedNumberOfSeats": 10
},
"trialSettings": {
"isInTrial": false
},
"skuName": "Google Workspace Business Standard"
}
更新訂閱項目的續約設定
如要更新年度承諾訂閱項目的續約設定,請使用下列 POST
HTTP 要求:
POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/changeRenewalSettings
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。SUBSCRIPTION_ID
:每位客戶專屬的訂閱 ID。您可以使用擷取所有經銷商訂閱項目的方法來擷取這個值。
以下是要求主體範例:
{
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
}
renewalType
屬性的值可以是下列任一項目:
AUTO_RENEW_YEARLY_PAY
:在年約方案間隔期結束時,自動以相同的numberOfSeats
續訂訂閱方案為ANNUAL_YEARLY_PAY
。AUTO_RENEW_MONTHLY_PAY
:在年繳承諾方案的間隔期結束時,自動以相同的numberOfSeats
續約訂閱方案為ANNUAL_MONTHLY_PAY
。RENEW_CURRENT_USERS_YEARLY_PAY
:在年約方案的間隔期結束時,請以ANNUAL_YEARLY_PAY
續訂訂閱方案,但使用目前活躍使用者授權的總數。這是有效年約方案 (按年付費) 的預設設定。RENEW_CURRENT_USERS_MONTHLY_PAY
:在年約方案的間隔期結束時,請以ANNUAL_MONTHLY_PAY
續訂訂閱方案,但使用目前活躍使用者授權的總數。這是有效年約方案 (按月付款) 的預設設定。RENEW_ON_PROPOSED_OFFER
:在目前承諾方案的間隔期結束時,根據最新的續約提案續約,其中 numberOfSeats 為目前活躍使用者授權數或提案的優惠承諾數量 (以較高者為準)。SWITCH_TO_PAY_AS_YOU_GO
:在年約方案間隔期結束時,將年約方案變更為彈性方案。CANCEL
:在年約方案間隔期結束時,系統會暫停訂閱。如要瞭解如何解除停權,請參閱管理說明中心。
成功的回應會傳回 HTTP 201
狀態碼和更新的訂閱續約設定:
{
"kind": "reseller#subscription",
"customerId": "C0123456",
"subscriptionId": "123",
"skuId": "1010020028",
"creationTime": "1331647980142",
"plan": {
"planName": "ANNUAL",
"isCommitmentPlan": true,
"commitmentInterval": {
"startTime": "1331647980142",
"endTime": "1363183980142"
}
},
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 15,
"licensedNumberOfSeats": 15
},
"trialSettings": {
"isInTrial": false
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
},
"skuName": "Google Workspace Business Standard"
}
從免費試用訂閱開始使用付費服務
如要立即將 30 天免費試用訂閱方案轉換為付費服務訂閱方案,如果已為試用訂閱方案設定付款方案,請使用下列 POST
HTTP 要求。
POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/startPaidService
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。SUBSCRIPTION_ID
:每位客戶專屬的訂閱 ID。您可以使用擷取所有經銷商訂閱項目的方法來擷取這個值。
以下範例的 customerId
為 C0123456,subscriptionId
值為 123:
POST https://reseller.googleapis.com/apps/reseller/v1/customers/C0123456/subscriptions/123/startPaidService
此作業在要求主體中沒有參數。
成功的回應會傳回 HTTP 201
狀態碼和更新後的訂閱設定:
{
"kind": "reseller#subscription",
"customerId": "C0123456",
"subscriptionId": "123",
"skuId": "1010020028",
"creationTime": "1331647980142",
"plan": {
"planName": "ANNUAL",
"isCommitmentPlan": true,
"commitmentInterval": {
"startTime": "1331647980142",
"endTime": "1363183980142"
}
},
"seats": {
"kind": "subscriptions#seats",
"numberOfSeats": 15,
"licensedNumberOfSeats": 15
},
"trialSettings": {
"isInTrial": false
},
"renewalSettings": {
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
},
"skuName": "Google Workspace Business Standard"
}
將訂閱項目升級或降級
您無法在年約期中降級方案,也無法使用續訂設定安排降級。建議您將續約設定切換為 FLEXIBLE
,然後在續約時間過後降級。
如要將訂閱項目升級或降級,請使用您要升級或降級的 skuId
建立新訂閱項目。
POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions
更改下列內容:
CUSTOMER_ID
:客戶的主網域名稱或專屬 ID。
這項呼叫會終止先前的訂閱,並建立新的訂閱。
如要進一步瞭解升級和降級,請前往「產品與 SKU」頁面。