检索订阅后,您可以使用 成功响应中的信息来 更改订阅的状态 或更新订阅。本页重点介绍如何检索和更新订阅。
检索订阅
如需检索已成功订购或转移的订阅,请使用以下 GET HTTP 请求:
GET https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID
替换以下内容:
CUSTOMER_ID:客户的主域名或客户的唯一标识符。SUBSCRIPTION_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&pageToken=START_DATE&maxResults=MAX_NUMBER
替换以下内容:
CUSTOMER_ID:客户的主域名或客户的唯一标识符。START_DATE:开始日期,格式为YYYY-MM-DD。MAX_NUMBER:响应页面上返回的结果数上限。
此操作在请求正文中没有参数。
成功的响应会返回 HTTP 200 状态代码,以及客户的订阅和设置列表。订阅列表可能包含在此版本的 Reseller API 中未管理的商品。
如果您不管理客户,系统会返回 403 Forbidden 错误。
检索客户的所有可转移订阅
如需检索客户的所有可能转移到转销商管理的订阅,请使用以下 GET HTTP 请求,并添加授权令牌。customerId 是必需的
,并且是
检索转售客户的账号时返回的客户唯一标识符。
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:客户的主域名或客户的唯一标识符。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:客户的主域名或客户的唯一标识符。SUBSCRIPTION_ID:每个客户独有的订阅标识符。您可以使用 “检索所有转销商订阅”方法检索此值。
以下示例更新了 subscriptionId 值为 123 的订阅。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:客户的主域名或客户的唯一标识符。SUBSCRIPTION_ID:每个客户独有的订阅标识符。您可以使用 “检索所有转销商订阅”方法检索此值。
以下示例更新了 subscriptionId 为 123 的订阅。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:客户的主域名或客户的唯一标识符。SUBSCRIPTION_ID:每个客户独有的订阅标识符。您可以使用 “检索所有转销商订阅”方法检索此值。
以下是一个示例请求正文:
{
"kind": "subscriptions#renewalSettings",
"renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
}
renewalType 属性的值可以是以下任一值:
AUTO_RENEW_YEARLY_PAY:在包年套餐的间隔结束时,自动将订阅的方案续订为ANNUAL_YEARLY_PAY,并使用相同的numberOfSeats。AUTO_RENEW_MONTHLY_PAY:在包年套餐的间隔结束时,自动将订阅的方案续订为ANNUAL_MONTHLY_PAY,并使用相同的numberOfSeats。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:客户的主域名或客户的唯一标识符。SUBSCRIPTION_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:客户的主域名或客户的唯一标识符。
此调用会终止之前的订阅并创建一个新订阅。
如需详细了解 升级和降级 ,请参阅产品和 SKU 页面。