Changes the billing method of an ApsaraDB for Redis instance from pay-as-you-go to subscription.

For more information about how to change the billing method in the ApsaraDB for Redis console, see Switch to subscription.

Note You cannot change the billing method of an ApsaraDB for Redis instance from subscription to pay-as-you-go.

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 TransformToPrePaid

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

InstanceId String Yes r-bp1zxszhcgatnx****

The ID of the instance. You can call the DescribeInstances operation to query the IDs of instances.

Period Long Yes 12

The subscription duration of the instance. Unit: months. Valid values: 1 to 9, 12, 24, and 36.

AutoPay Boolean No true

Specifies whether to enable automatic payment. Valid values:

  • true: Automatic payment is enabled.
  • false: Automatic payment is disabled. This is the default value.
Note If you set this parameter to false, you must manually renew the instance in the ApsaraDB for Redi sconsole before the instance expires. For more information, see Manual renewal.
RegionId String No cn-hangzhou

The region ID of the instance.

Response parameters

Parameter Type Example Description
EndTime String 2019-01-18T16:00:00Z

The time when the instance expires after the billing method of the instance is changed from pay-as-you-go to subscription.

OrderId String 111111111111111

The ID of the order.

RequestId String 426F1356-B6EF-4DAD-A1C3-DE53B9DAF586

The ID of the request.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/?Action=TransformToPrePaid
&InstanceId=r-bp1zxszhcgatnx****
&Period=12
&<Common request parameters>

Sample success responses

XML format

<TransformToPrePaidResponse>
      <OrderId>111111111111111</OrderId>
      <RequestId>426F1356-B6EF-4DAD-A1C3-DE53B9DAF586</RequestId>
      <EndTime>2019-01-18T16:00:00Z</EndTime>
</TransformToPrePaidResponse>

JSON format

{
    "OrderId": "111111111111111",
    "RequestId": "426F1356-B6EF-4DAD-A1C3-DE53B9DAF586",
    "EndTime": "2019-01-18T16:00:00Z"
}

Error codes

Http status code Error code Error message Description
400 InvalidParam Period is invalid The error message returned because the specified subscription duration is invalid.
403 AlreadyPrePaid This instance is already prepaid The error message returned because the instance is already charged on a subscription basis.
400 ResourceNotAvailable Resource you requested is not available for finance user. The error message returned because the requested resource is unavailable to users of Alibaba Finance Cloud.
400 InsufficientBalance Your account does not have enough balance. The error message returned because your Alibaba Cloud account does not have a sufficient balance. Add funds to your Alibaba Cloud account and try again.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because your Alibaba Cloud account has not passed real-name verification.

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