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

For more information about how to perform the corresponding operation in the console, see Switch to subscription.

Note However, you cannot change the billing method of an 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.

Period Long Yes 12

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

AutoPay Boolean No true

Specifies whether to enable automatic renewal. Valid values:

  • true: enables automatic renewal.
  • false: manual payment.

Default value: true.

Note If you set this parameter to false, you must manually renew the instance before the instance expires. For more information, see Manual renewal.
RegionId String No cn-hangzhou

The ID of the region.

Response parameters

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

The expiration time of the instance after the billing method was 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

HttpCode Error code Error message Description
400 MissingParameter Period is mandatory for this action. The error message returned because the instance ID is required.
400 InvalidParam Period is invalid The error message returned because the specified period is invalid.
403 AlreadyPrePaid This instance is already prepaid The error message returned because this instance is already a subscription instance.
400 ResourceNotAvailable Resource you requested is not available for finance user. The error message returned because the requested resource is unavailable to a finance user.
400 InsufficientBalance Your account does not have enough balance. The error message returned because you do not have sufficient account balance. Recharge your account and try it again.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because your account did not pass the real-name verification.

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