调用TransformDBInstancePayType接口变更RDS实例的计费方式。
说明
- 包年包月变更为按量付费时,会扣除手续费后退还余款。详情请参见包年包月转按量付费。
- 账号余额不足时无法按量付费转包年包月。
- 不支持存在未完成变配订单的实例。
- 不支持专属集群。
RDS实例支持包年包月和按量付费两种计费方式:
- 包年包月:也称为预付费,即在新建实例时支付费用。适合长期需求,价格比按量付费更实惠,且购买时长越长,折扣越多。
- 按量付费:也称为后付费,即每小时生成一个收费订单,并按照生成订单时的实例规格从阿里云账号扣费。适合短期需求,用完可立即释放实例,节省费用。
更多计费方式的介绍请参见价格、收费项与计费方式。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | TransformDBInstancePayType |
系统规定参数。取值:TransformDBInstancePayType。 |
| ClientToken | String | 否 | ETnLKlblzczshOTUbOCzxxxxxxxxxx |
用于保证请求的幂等性,防止重复提交请求。由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过64个ASCII字符,且该参数值中不能包含非ASCII字符。 |
| DBInstanceId | String | 是 | rm-uf6wjk5xxxxxx |
实例ID。 |
| UsedTime | Integer | 否 | 1 |
指定购买时长。取值:
说明 若PayType=Prepaid,需要传入该参数。
|
| PayType | String | 是 | Prepaid |
实例的付费类型。取值:
|
| Period | String | 否 | Month |
指定预付费实例为包年或者包月类型。取值:
说明 若PayType=Prepaid,需要传入该参数。
|
| BusinessInfo | String | 否 | 无 |
业务扩展参数。 |
| AutoRenew | String | 否 | true |
是否开启自动续费。取值:
说明
|
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| DBInstanceId | String | rm-uf6wjk5xxxxxx |
实例ID。 |
| RequestId | String | 5E6E09DE-5B12-4BFF-A55E-1C86EDE06D9A |
请求ID。 |
| ExpiredTime | String | 2020-04-20T10:00:00Z |
到期时间。 说明 如果变更为按量付费,该参数不返回。
|
| OrderId | Long | 205157600280623 |
订单ID。 |
| ChargeType | String | Prepaid |
付费类型。 |
示例
请求示例
http(s)://rds.aliyuncs.com/?Action=TransformDBInstancePayType
&DBInstanceId=rm-uf6wjk5xxxxxx
&PayType=Prepaid
&UsedTime=3
&Period=Month
&<公共请求参数>
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<TransformDBInstancePayTypeResponse>
<ChargeType>Prepaid</ChargeType>
<DBInstanceId>rm-uf6wjk5xxxxxx</DBInstanceId>
<ExpiredTime>2020-04-20T10:00:00Z</ExpiredTime>
<OrderId>205157600280623</OrderId>
<RequestId>5E6E09DE-5B12-4BFF-A55E-1C86EDE06D9A</RequestId>
</TransformDBInstancePayTypeResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"ChargeType" : "Prepaid",
"DBInstanceId" : "rm-uf6wjk5xxxxxx",
"ExpiredTime" : "2020-04-20T10:00:00Z",
"OrderId" : 205157600280623,
"RequestId" : "5E6E09DE-5B12-4BFF-A55E-1C86EDE06D9A"
}
错误码
| HttpCode | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
| 400 | InvalidDBInstanceName.NotFound | The specified DB instance name does not exist. | 数据库实例名称不存在,请检查。 |
| 400 | InvalidInstanceUseType.NotSupport | Specified instanceUseType does not support in RDS. | 操作失败,RDS中不支持指定的instanceUseType。 |
| 400 | InvalidOrderCharge.NotSupport | The specified order charge does not support in RDS. | 操作失败,RDS支持Prepaid(包年包月)和Postpaid(按量付费)两种计费方式,请设置正确的实例PayType(付费类型)。 |
| 400 | InvalidOrderTask.NotSupport | The Current InstanceId exist Order Task in RDS. | 当前实例存在未执行完成的订单任务,请稍后重试。 |
| 400 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | 操作失败,该实例状态下不支持此操作。 |
| 400 | IncompleteAccountInfo | Your information is incomplete. Complete your information before the operation. | 操作失败,账号信息中带*为必填项,请补充填写。路径:账号中心-基本信息。 |
| 400 | IncompleteTaxInfo | Your tax information is incomplete. Complete your information before the operation. | 操作失败,税务信息尚未完善。请补充信息。 |
| 400 | InvalidPaymentMethod.Incomplete | No payment method is specified for your account. We recommend that you add a payment method. | 您的账户暂无有效支付方式,请添加支付方式。 |
| 400 | InvalidPaymentMethod.Missing | Your payment method is incomplete. We recommend that you add a payment method. | 当前账户暂无有效支付方式,请添加支付方式。 |
| 400 | InsuffcientBalanceOrBankAccount | Add a payment method or add funds to the prepayment balance. Get started by creating an instance. | 当前账户暂无有效支付方式,请添加支付方式或给预付款充值。 |
| 400 | InvalidPaymentMethod.Missing | No payment method is specified for your account. We recommend that you add a payment method. | 您的账户暂无有效支付方式,请添加支付方式。 |
| 400 | OrderTaskAlreadyExists | Order task already exists. | 操作失败,当前订单任务已存在。 |
| 400 | InvalidOldInstanceType.NotSupport | Specified oldInstanceType does not support in RDS. | 当前实例版本不支持该操作。 |
| 400 | OperationDenied.TimeLimit | The interval between the two conversion operations must be greater than 15 minutes. | 操作失败,两次支付类型转换操作的时间间隔应大于15分钟。 |
| 400 | InvalidResource.Format | The specified parameter Resource is not valid. | 资源无效。 |
| 400 | InvalidPayType.Format | The specified parameter PayType is not valid. | 操作失败,付款类型无效。 |
| 400 | InvalidUsedTime.Format | The specified parameter UsedTime is not valid. | UsedTime未定义。 |
| 403 | OperationDenied.LockMode | The operation is not permitted when the instance locked. | 操作失败,实例锁定中。可能账户余额不足,请续费后解锁实例。 |
访问错误中心查看更多错误码。