Updated on 2024-12-20 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

Payment mode. Currently, only pre_paid is available.

period_type

Yes

String

Creation type, which can be by year (year) or by month (month).

period_num

Yes

Integer

Number of created types by year or month.

is_auto_renew

No

Boolean

Whether to automatically renew the subscription after expiration. It is not renewed by default.

is_auto_pay

No

Boolean

Whether to use automatic payment. Automatic payment is not used by default.

console_url

No

String

Redirection URL.

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.