Updated on 2024-12-02 GMT+08:00

Change the Billing Mode of an Instance

Function

Changing the billing mode of an IoTDA instance. The pay-per-use billing mode can be changed to yearly/monthly.

Available only when the instance specifications support the yearly/monthly billing mode. For details about the supported instance specifications, see Specifications.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v5/iot/{project_id}/iotda-instances/{instance_id}/change-charge-mode

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description: project ID. For details, see Obtaining a Project ID.

instance_id

Yes

String

Parameter description: instance ID.

Value: Enter up to 36 characters, including lowercase letters (a-f), digits, and hyphens (-).

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. In the returned response header, X-Subject-Token is the desired user token. For details about how to obtain the token, see Token Authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

period_type

Yes

String

Parameter description: period type of the subscribed IoTDA instance. This parameter is valid and mandatory only when charge_mode is set to prePaid.

Options:

  • month

  • year

period_num

Yes

Integer

Parameter description: number of periods for subscribing to an IoTDA instance. This parameter is valid and mandatory only when charge_mode is set to prePaid.

Value: 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 3.

is_auto_renew

No

Boolean

Parameter description: whether to automatically renew the subscription, specified during yearly/monthly instance creation. The renewal period is the same as the original period, and the payment is automatically made during the renewal.

Options:

  • true

  • false (default value)

is_auto_pay

No

Boolean

Parameter description: whether to automatically pay from the customer's account. This parameter can be specified when a yearly/monthly instance is created. This parameter does not affect the payment mode of automatic renewal.

Value: true: automatic payment. Fees are automatically deducted from the account balance. false: default value. Orders are submitted but not paid.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

order_id

String

Parameter description: order ID. For details about how to check the order details, see [Querying Order Details]. (tag:hws)

Example Requests

Changing the billing mode of the instance to yearly. After the order expires, the instance is automatically renewed.

POST https://{endpoint}/v5/iot/{project_id}/iotda-instances/{instance_id}/change-charge-mode

{
  "period_type" : "year",
  "period_num" : 1,
  "is_auto_renew" : true
}

Example Responses

Status code: 200

OK

{
  "order_id" : "CS22121614500ABCD"
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

Error Codes

See Error Codes.