All Products
Search
Document Center

BSS OpenAPI:GetSubscriptionPrice

Last Updated:Mar 01, 2024

Queries the subscription price of an Alibaba Cloud service.

Operation description

  1. Call the QueryProductList operation to obtain the code of the service. For more information, see QueryProductList .
  2. Call the DescribePricingModule operation to obtain the configuration parameters of the service. For more information, see DescribePricingModule .
  3. Call the GetSubscriptionPrice operation to obtain the pricing of the service based on the returned configuration parameters.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
bssapi:GetSubscriptionPriceREAD
  • All Resources
    *
  • bssapi:ProductCode
  • bssapi:ProductType
none

Request parameters

ParameterTypeRequiredDescriptionExample
ServicePeriodUnitstringNo

The unit of the service duration. Valid values:

  • Year
  • Month
Year
SubscriptionTypestringYes

The billing method. Set the value to Subscription.

Subscription
ProductCodestringYes

The code of the service. For more information about the service code, see Codes of Alibaba Cloud Services.

ecs
OrderTypestringYes

The type of the order. Valid values:

  • NewOrder: purchases an instance of an Alibaba Cloud service.
  • Renewal: renews an instance of an Alibaba Cloud service.
  • Upgrade: upgrades an instance of an Alibaba Cloud service.
NewOrder
ServicePeriodQuantityintegerNo

The service duration.

1
ProductTypestringNo

The type of the service. Specify the parameter based on the pricing document of the specific service.

ecs
RegionstringNo

The ID of the region in which the instance resides.

cn-hangzhou
InstanceIdstringNo

The ID of the instance for which the price is queried. This parameter is required if you upgrade an instance. You can specify this parameter to obtain the pre-upgrade configurations of the instance.

i-khkjhxxxxxxxxx
QuantityintegerNo

The quantity.

1
ModuleListobject []Yes

The information about the pricing module.

ModuleStatusintegerNo

The status of the pricing module. This parameter is required only if the order type is Upgrade. Valid values:

  • 1: adds one or more instances.
  • 2: modifies the configurations of an instance. In the upgrade scenario, if the configurations of the pricing module change, you must specify this value for the parameter.

Default value: 1.

1
ModuleCodestringYes

The identifier of the Nth pricing module.

PackageCode
TagstringNo

The tag of the specified resource. This parameter is required only if you upgrade or modify the configurations of an Alibaba Cloud service. For example, if you want to modify the configurations of a disk, you can use a tag to identify the ID of the disk.

213213123
ConfigstringYes

The configurations of the Nth pricing module. Valid values of N: 1 to 50. Format: AA:aa,BB:bb. The values of AA and BB are the property IDs of the pricing module. The values of aa and bb are the property values of the pricing module.

PackageCode:version_1

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The status code.

InvalidConfigCod
Messagestring

The message returned.

Successful
RequestIdstring

The ID of the request.

30E7066E-AE6F-4E59-AFE6-11386CE3AFA7
Successboolean

Indicates whether the request is successful.

true
Dataobject

The information about the service price.

OriginalPricefloat

The original price of the service.

900
DiscountPricefloat

The discount that was applied.

100
Currencystring

The type of currency. Valid values:

  • CNY: Chinese Yuan
  • USD: US dollar
  • JPY: Japanese Yen
CNY
Quantityinteger

The quantity.

1
TradePricefloat

The discount price.

0
ModuleDetailsobject []

The price details of the pricing module.

CostAfterDiscountfloat

The discount price.

0
InvoiceDiscountfloat

The discount that was applied.

100
UnitPricefloat

The unit price.

0
OriginalCostfloat

The original price of the service.

200
ModuleCodestring

The identifier of the pricing module.

PackageCode
PromotionDetailsobject []

The details of the discount.

PromotionDescstring

The description of the discount.

test
PromotionIdlong

The ID of the discount.

1021199213
PromotionNamestring

The name of the discount.

test

Examples

Sample success responses

JSONformat

{
  "Code": "InvalidConfigCod",
  "Message": "Successful",
  "RequestId": "30E7066E-AE6F-4E59-AFE6-11386CE3AFA7",
  "Success": true,
  "Data": {
    "OriginalPrice": 900,
    "DiscountPrice": 100,
    "Currency": "CNY",
    "Quantity": 1,
    "TradePrice": 0,
    "ModuleDetails": {
      "ModuleDetail": [
        {
          "CostAfterDiscount": 0,
          "InvoiceDiscount": 100,
          "UnitPrice": 0,
          "OriginalCost": 200,
          "ModuleCode": "PackageCode"
        }
      ]
    },
    "PromotionDetails": {
      "PromotionDetail": [
        {
          "PromotionDesc": "test",
          "PromotionId": 1021199213,
          "PromotionName": "test"
        }
      ]
    }
  }
}

Error codes

For a list of error codes, visit the Service error codes.