Updated on 2025-08-25 GMT+08:00

Changing the Payment Mode

Function

This API is used to change the billing mode of a resource. Currently, only pay-per-use resources can be changed to yearly/monthly resources.

This API is in the open beta test (OBT) phase and may be unavailable in some regions.

Debugging

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

URI

POST /v3/{project_id}/vaults/change-charge-mode

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

charging_mode

No

String

Billing mode. Currently, only pre_paid is available, indicating yearly/monthly billing.

period_type

Yes

String

The unit of the subscription term. This parameter is mandatory only when charging_mode is pre_paid.

The options are as follows:

  • month: monthly subscription

  • year: yearly subscription

period_num

Yes

Integer

Subscription term. This parameter is mandatory only when charging_mode is pre_paid.

Value range: [1-9]

is_auto_renew

No

Boolean

Specifies whether to automatically renew the subscription upon expiration. The default value is false.

The options are as follows:

  • true: The subscription is automatically renewed upon expiration.

  • false: The subscription is not automatically renewed upon expiration.

is_auto_pay

No

Boolean

Specifies whether to automatically pay for the order. The default value is false.

The options are as follows:

  • true: The payment is automatically made after the order is placed.

  • false: The payment is not automatically made after the order is placed.

console_url

No

String

Cloud service console URL. The URL used to switch to the cloud service console to view information after the subscription is complete. (This parameter is used only for manual payment.)

vault_ids

Yes

Array of strings

Resource list.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

orderId

String

Order ID

retCode

String

Change status code

retMsg

String

Change information

Example Requests

Changing the billing mode of a pay-per-use vault to yearly/monthly

https://{endpoint}/v3/{project_id}/orders/change-to-period

{
  "vault_ids" : [ "9dd8f8db-a926-440b-9af5-81b643618898" ],
  "charging_mode" : "pre_paid",
  "period_type" : "year",
  "period_num" : 2,
  "is_auto_renew" : true,
  "is_auto_pay" : true,
  "console_url" : "https://www.{endpoint}/v3/"
}

Example Responses

Status code: 200

OK

{
  "orderId" : "CS2305291628MSG5A",
  "retCode" : 0,
  "retMsg" : "success"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.