Help Center/ Elastic IP/ API Reference/ APIs/ Bandwidth (V2.0)/ Changing Bandwidth Billing Mode from Pay-per-Use to Yearly/Monthly
Updated on 2023-12-25 GMT+08:00

Changing Bandwidth Billing Mode from Pay-per-Use to Yearly/Monthly

Function

This API is used to change the bandwidth billing mode from pay-per-use to yearly/monthly.

URI

POST /v2.0/{project_id}/bandwidths/change-to-period

Table 1 Path parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

bandwidth_ids

Yes

Array

List of pay-per-use bandwidths to be changed to yearly/monthly

extendParam

Yes

CreatePrePaidPublicipExtendParamOption object

Change billing mode from pay-per-use to yearly/monthly.

Table 3 CreatePrePaidPublicipExtendParamOption

Parameter

Mandatory

Type

Description

charge_mode

No

String

  • Billing mode.
  • The value can be:
    • prePaid: yearly/monthly, which is prepayment.
    • postPaid: pay-per-use, which is postpayment.
  • In the postpayment mode, fields in extendParam will be ignored.

Default value: postPaid

Enumerated values:

  • prePaid
  • postPaid

period_type

No

String

  • Subscription unit.
  • The value can be:
    • month: indicates that the subscription is in the unit of month.
    • year: indicates that the subscription is in the unit of year.
  • If you specify the shared bandwidth ID when you assign an EIP that is billed on a yearly/monthly basis, this parameter is optional. This parameter is mandatory if an EIP is billed on a yearly/monthly basis and is not assigned together with a shared bandwidth. If an EIP is assigned together with a shared bandwidth, the expiration time of the bandwidth is the same as that of the EIP.

Enumerated values:

  • month
  • year

period_num

No

Integer

  • Subscription period.
  • Value range: (The value will change with the operation policy.)
    • If period_type is set to month, the value ranges from 1 to 9.
    • If period_type is set to year, the value ranges from 1 to 13.
  • The constraints for period_num are the same as those for period_type.

Minimum value: 1

Maximum value: 9

is_auto_renew

No

Boolean

  • Whether to automatically renew the subscription.
  • false: The subscription will not be automatically renewed. true: The subscription will be automatically renewed.
  • After the subscription expires, the system automatically renews the subscription for one month by default (the automatic renewal period may change). For details, contact customer service.

Default value: false

is_auto_pay

No

Boolean

  • Whether the payment will be automatically deducted from your account balance when an order is submitted.
  • The value can be:
    • true: indicates automatic payment. The system will automatically deduct fees from your account balance after an order is submitted.
    • false: indicates non-automatic payment. You need to pay manually.
  • If you use automatic payment, only your account balance can be used. If you want to use a voucher, do not use automatic payment, and select the voucher for the payment in the Billing Center.

Default value: false

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

bandwidth_ids

Array

List of bandwidths with billing mode changed to yearly/monthly

order_id

String

Order ID

request_id

String

Request ID

Example Request

POST /v2.0/{project_id}/bandwidths/change-to-period

{
  "bandwidth_ids" : [ "fe2a11c7-c880-49f7-b1e0-e151df2cc836" ],
  "extendParam" : {
    "charge_mode" : "prePaid",
    "period_type" : "month",
    "period_num" : 1,
    "is_auto_renew" : false,
    "is_auto_pay" : true
  }
}

Example Response

Status code: 200

OK

{
  "bandwidth_ids" : [ "fe2a11c7-c880-49f7-b1e0-e151df2cc836" ],
  "order_id" : "CS2212141741L0QZG",
  "request_id" : "8bcadb5d-1bf4-42e8-909f-1606ecf781ce"
}

Status Code

See Status Codes.

Error Code

See Error Codes.