Help Center> Elastic IP > API Reference> APIs> EIP> Changing EIP Billing Mode from Pay-per-Use to Yearly/Monthly
Updated on 2023-12-25 GMT+08:00

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

Function

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

URI

POST /v2.0/{project_id}/publicips/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

publicip_ids

Yes

Array

List of pay-per-use EIPs 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

publicip_ids

Array

List of EIPs with billing mode changed to yearly/monthly

order_id

String

Order ID

request_id

String

Request ID

Example Request

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

{
  "publicip_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

{
  "publicip_ids" : [ "2c3b404b-d595-4ab5-a333-69f3ff937dc2" ],
  "order_id" : "CS2212141730K2FGR",
  "request_id" : "9d5bc34c-810f-48f2-95c4-9c48d02f2a33"
}

Status Code

See Status Codes.

Error Code

See Error Codes.