Updated on 2026-05-21 GMT+08:00

Purchasing a Yearly/Monthly APS

Description

You can use the API Creating an ECS to purchase a yearly/monthly APS. Unlike creating a pay-per-use APS, you only need to set create_server_extend_param.charging_mode to prePaid and specify the subscription period in the request body. For details about the create_server_extend_param parameter, see Table 7.

For example:

Suppose that you purchase a yearly/monthly APS (duration for one month) in the cn-north-4 region. After the order is placed, the payment is automatically made and the subscription is automatically renewed.

{
 "type": "createApps",
 "server_group_id": "266aa7aa-862b-4c46-9064-dfd057049d67",
 "availability_zone":"cn-north-4a",
 "subscription_num": 1,
 "product_id": "workspace.appstream.general.xlarge.2",
 "root_volume": {
  "type": "SAS",
  "size": 80
 },
 "subnet_id": "6719e894-515f-4a19-86a8-e056a839ecee",
 "vpc_id": "3d00f422-1968-4349-b2d0-9d72d75cc502",
 "update_access_agent": false,
 "create_server_extend_param": {
  "charging_mode": "prePaid",
  "period_type": 2,
  "period_num": 1,
  "is_auto_renew": true,
  "is_auto_pay": true
 }
}

After a yearly/monthly APS is created, an order ID order_id is returned.

{
 "order_id": "CS2311171xxxxxxxx"
}

In the preceding request body, the value of create_server_extend_param.is_auto_pay is true, indicating automatic payment. If this parameter is left blank or set to false, manual payment is required. For manual payment, you can enter information such as vouchers and discount coupons.

Manual payment requires calling the API used for paying yearly/monthly product orders, as shown in the following example:

POST https://bss.myhuaweicloud.com/v2/orders/customer-orders/pay
{
    "order_id": "CS2311172xxxxxxxx"
}