You can call this operation to modify the billing method of an ApsaraDB for RDS instance.

Note
  • When the subscription billing method is changed to pay-as-you-go, the balance will be refunded after the formality fee is deducted. For more information about the refund, see Switch from subscription billing to pay-as-you-go billing.
  • If your account balance is insufficient, you cannot change the billing method of an instance from pay-as-you-go to subscription.
  • Instance with unfinished configuration change orders do not support this operation.
  • Dedicated clusters do not support this operation.

ApsaraDB for RDS supports the following billing methods:

  • Subscription: You must pay the subscription fee when you create an instance. We recommend that you choose subscription billing for long-term use because it is more cost-effective than pay-as-you-go billing. You receive larger discounts for longer subscription periods.
  • Pay-as-you-go: A pay-as-you-go instance is charged based on the actual usage. Bill statements are generated on an hourly basis, and fees are deducted from the balance of your Alibaba Cloud account. We recommend that you choose pay-as-you-go billing for short-term use. You can release your pay-as-you-go instance to reduce costs when you no longer need it.

For more information about billing methods, see Pricing, billing items, and billing methods.

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 parameters

Parameter Type Required Example Description
Action String Yes TransformDBInstancePayType

The operation that you want to perform. Set the value to TransformDBInstancePayType.

DBInstanceId String Yes rm-uf6wjk5xxxxxx

The ID of the instance whose type or storage space is modified.

PayType String Yes Prepaid

The billing method of the instance. Valid values:

  • Postpaid: specifies to use pay-as-you-go billing.
  • Prepaid: specifies to use subscription billing.
ClientToken String No ETnLKlblzczshOTUbOCzxxxxxxxxxx

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

UsedTime Integer No 1

The duration of the instance if the instance uses subscription billing. Valid values:

  • If you set the Period parameter to Year, the value of the UsedTime parameter ranges from 1 to 5.
  • If you set the Period parameter to Month, the value of the UsedTime parameter ranges from 1 to 9.
Note If you set the PayType parameter to Prepaid, you must also specify the UsedTime parameter.
Period String No Month

The renewal period of the instance if the instance uses subscription billing. Valid values:

  • Year
  • Month
Note If you set the PayType parameter to Prepaid, you must also specify the Period parameter.
BusinessInfo String No None.

The extended business information of the instance.

Response parameters

Parameter Type Example Description
ChargeType String Prepaid: subscription

The billing method of the instance.

DBInstanceId String rm-uf6wjk5xxxxxx

The ID of the PolarDB-X instance.

ExpiredTime String 2020-04-20T10:00:00Z

The expiration time of the instance.

Note If you change the billing method to pay-as-you-go, this parameter is ignored.
OrderId Long 205157600280623

The ID of the order.

RequestId String 5E6E09DE-5B12-4BFF-A55E-1C86EDE06D9A

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com? Action=TransformDBInstancePayType
&DBInstanceId=rm-uf6wjk5xxxxxx
&PayType=Prepaid
&UsedTime=3
&Period=Month
&<Common request parameters>

Sample success responses

XML format

<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 format

{
    "ChargeType":"Prepaid",
    "DBInstanceId":"rm-uf6wjk5xxxxxx",
    "ExpiredTime":"2020-04-20T10:00:00Z",
    "OrderId":205157600280623,
    "RequestId":"5E6E09DE-5B12-4BFF-A55E-1C86EDE06D9A"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidDBInstanceName.NotFound The specified DB instance name does not exist. The error message returned because the specified DBInstanceId value does not exist. Enter a valid instance ID and try again.
400 InvalidOrderCharge.NotSupport The specified order charge does not support in RDS. The error message returned because ApsaraDB for RDS does not support the order payment type. Submit a ticket.
400 InvalidOrderTask.NotSupport The Current InstanceId exist Order Task in RDS. The error message returned because the current instance has unfinished orders. Try again later.
400 InvalidPaymentMethod.Incomplete No payment method is specified for your account. We recommend that you add a payment method. The error message returned because your account does not have a valid payment method. Add a valid payment method and try again.
400 InvalidOldInstanceType.NotSupport Specified oldInstanceType does not support in RDS. The previous instance does not support this conversion operation.

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