Changes the billing method of an ApsaraDB for Redis instance. This operation allows you to change a subscription instance into a pay-as-you-go instance or change a pay-as-you-go instance into a subscription instance.

Before you call this operation, make sure that you understand relevant precautions and billing rules. For more information, see the following topics:

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 TransformInstanceChargeType

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

ChargeType String Yes PrePaid

The new billing method. Valid values:

  • PrePaid: subscription. If you set this parameter to PrePaid, you must also set the Period parameter.
  • PostPaid: pay-as-you-go.

InstanceId String Yes r-bp1zxszhcgatnx****

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

RegionId String No cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

Period Long No 1

The subscription duration. Unit: months. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36.

Note This parameter is valid and required only if you set the ChargeType parameter to PrePaid.
AutoPay Boolean No true

Specifies whether to enable automatic payment. Default value: true. Valid values:

  • true: Automatic payment is enabled.
  • false: Automatic payment is disabled. If automatic payment is disabled, you must perform the following steps to complete the payment: In the top navigation bar of the ApsaraDB for Redis console, choose Expenses > Renewal Management. In the left-side navigation pane of the Billing Management console, click Orders. On the Orders page, find the order and complete the payment.

Response parameters

Parameter Type Example Description
EndTime String 2021-05-13T00:00:00Z

The time when the instance expires.

Note A value is returned for this parameter only if the instance was changed from pay-as-you-go to subscription.
OrderId String 20881824000****

The ID of the order.

RequestId String 82C791FB-8979-489E-853D-706D7743****

The ID of the request.

Examples

Sample requests

http(s)://r-kvstore.aliyuncs.com/?Action=TransformInstanceChargeType
&ChargeType=PrePaid
&InstanceId=r-bp1zxszhcgatnx****
&Period=1
&<Common request parameters>

Sample success responses

XML format

<TransformInstanceChargeTypeResponse>
      <EndTime>2021-05-13T00:00:00Z</EndTime>
      <RequestId>82C791FB-8979-489E-853D-706D7743****</RequestId>
      <OrderId>20881824000****</OrderId>
</TransformInstanceChargeTypeResponse>

JSON format

{
    "EndTime": "2021-05-13T00:00:00Z",
    "RequestId": "82C791FB-8979-489E-853D-706D7743****",
    "OrderId": "20881824000****"
}

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.
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 account balance is insufficient. 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.