Call UpdateInstanceChargeType to change the billing method of a pay-as-you-go instance to subscription.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request header

This operation uses common request parameters only. For more information, see Common parameters.

Request syntax

POST /openapi/instances/[InstanceId]/actions/convert-pay-type HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
InstanceId String Yes es-cn-0pp1jxvcl000z****

The ID of the instance.

clientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF****

A unique token generated by the client to guarantee the idempotency of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

RequestBody

You must also specify the following parameters in RequestBody to specify the billing information for the instance after the billing method is converted to subscription.

Parameter

Type

Required

Example

Description

paymentInfo

Array

Yes

The billing information of the instance after conversion.

└duration

Integer

Yes

1

The payment duration of the instance. 1 to 3 if the pricingCycle parameter is set to Year. 1 to 9 if the pricingCycle parameter is set to Month.

└pricingCycle

String

Yes

Year

The billing cycle of the instance. Valid values: Year and Month.

paymentType

String

Yes

prepaid

The billing method of the instance. Only the functions of pay-as-you-go instances can be converted to subscription instances. Therefore, this parameter is set to prepaid.

Note └ indicates a child parameter.

Example:


{
  "paymentInfo":{ 
       "duration":1,
       "pricingCycle":"Month"
    },
  "paymentType":"prepaid"
}
            

Response parameters

Parameter Type Example Description
RequestId String 5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1D****

The ID of the request.

Result Boolean true

Return results:

  • true: conversion successful
  • false: conversion failed

Examples

Sample requests

POST /openapi/instances/es-cn-0pp1jxvcl000z****/actions/convert-pay-type HTTP/1.1
Common request parameters
{
  "paymentInfo":{ 
       "duration":1,
       "pricingCycle":"Month"
    },
  "paymentType":"prepaid"
}

Sample success responses

JSON format

{
    "Result":true,
    "RequestId":"3760F67B-691D-4663-B4E5-6783554F****"
}

Error codes

HttpCode Error code Error message Description
400 InstanceNotFound The instanceId provided does not exist. The error message returned because the specified instance cannot be found. Check the instance status.

For a list of error codes, visit the API Error Center.