All Products
Search
Document Center

BSS OpenAPI:GetPayAsYouGoPrice

Last Updated:Mar 01, 2024

Queries the pay-as-you-go price of an Alibaba Cloud service.

Operation description

Usage notes

  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 GetPayAsYouGoPrice operation to obtain the pay-as-you-go price 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:GetPayAsYouGoPriceREAD
  • All Resources
    *
  • bssapi:ProductCode
  • bssapi:ProductType
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProductCodestringYes

The code of the service.

ecs
ProductTypestringNo

The type of the service.

ecs
SubscriptionTypestringYes

The billing method. Set the value to PayAsYouGo.

PayAsYouGo
RegionstringNo

The ID of the region in which the instance resides.

cn-hangzhou
ModuleListobject []Yes

The details of pricing modules.

ModuleCodestringYes

The code of the Nth pricing module.

Note You can call the DescribePricingModule operation to obtain the module code.
InstanceType
PriceTypestringYes

The price type of the Nth pricing module. Valid values:

  • Hour: hourly price
  • Usage: usage price
  • Month: monthly price
  • Year: annual price
Note You can call the DescribePricingModule operation to obtain the configuration parameters of the pricing module.
Hour
ConfigstringYes

The configuration 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.

Note You can call the DescribePricingModule operation to obtain the configuration parameters of the pricing module.
InstanceType:ecs.g5.xlarge,IoOptimized:IoOptimized,ImageOs:linux

Response parameters

ParameterTypeDescriptionExample
object

The response.

Codestring

The status code.

Success
Messagestring

The message returned.

Successful
RequestIdstring

The ID of the request.

1537A007-72D7-4165-8A26-8694A38E219A
Successboolean

Indicates whether the request is successful.

true
Dataobject

The data returned.

Currencystring

The type of the currency. Valid values:

  • CNY: Chinese Yuan
  • USD: US dollar
  • JPY: Japanese Yen
CNY
ModuleDetailsobject []

The price details of the pricing module.

CostAfterDiscountfloat

The discount price.

100
InvoiceDiscountfloat

The discount that was applied.

20
UnitPricefloat

The unit price.

0
OriginalCostfloat

The original price.

1.77
ModuleCodestring

The code of the pricing module.

InstanceType
PromotionDetailsobject []

The details of the discount.

PromotionDescstring

The description of the discount.

This discount allows you to use a service at the minimum price and is provided for testing purposes only.
PromotionIdlong

The ID of the discount.

10200210
PromotionNamestring

The name of the discount.

This discount allows you to use a service at the minimum price and is provided for testing purposes only.

Examples

Sample success responses

JSONformat

{
  "Code": "Success",
  "Message": "Successful",
  "RequestId": "1537A007-72D7-4165-8A26-8694A38E219A",
  "Success": true,
  "Data": {
    "Currency": "CNY",
    "ModuleDetails": {
      "ModuleDetail": [
        {
          "CostAfterDiscount": 100,
          "InvoiceDiscount": 20,
          "UnitPrice": 0,
          "OriginalCost": 1.77,
          "ModuleCode": "InstanceType"
        }
      ]
    },
    "PromotionDetails": {
      "PromotionDetail": [
        {
          "PromotionDesc": "This discount allows you to use a service at the minimum price and is provided for testing purposes only.\n",
          "PromotionId": 10200210,
          "PromotionName": "This discount allows you to use a service at the minimum price and is provided for testing purposes only.\n"
        }
      ]
    }
  }
}

Error codes

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