Changes the billing method of a specified cluster.

Note
  • PolarDB clusters support the subscription and pay-as-you-go billing methods. You can change the billing method from subscription to pay-as-you-go or from pay-as-you-go to subscription based on your business requirements. For more information, see Change the billing method from subscription to pay-as-you-go and Change the billing method from pay-as-you-go to subscription.
  • You cannot change the billing method from pay-as-you-go to subscription if your account balance is insufficient.
  • If you change the billing method from subscription to pay-as-you-go, the system automatically refunds the balance of the prepaid subscription fees.

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 TransformDBClusterPayType

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

DBClusterId String Yes pc-bp10gr51qasnl****

The ID of the cluster.

PayType String Yes Prepaid

The billing method of the cluster. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
RegionId String Yes cn-hangzhou

The region ID of the cluster.

UsedTime String No 1

The subscription period of the new instance. This parameter takes effect only when you select the subscription billing method for the new instance. Valid values:

  • If Period is set to Year, UsedTime can be set to 1, 2, or 3.
  • If Period is set to Month, UsedTime can be set to 1, 2, 3, 4, 5, 6, 7, 8, or 9.
Note This parameter is required if you set PayType to Prepaid.
Period String No Month

The renewal cycle of the read-only instance. Valid values:

  • Year: yearly subscription
  • Month: monthly subscription
Note This parameter is required if you set PayType to Prepaid.
ResourceGroupId String No rg-acfm3f4un32****

The ID of the resource group.

ClientToken String No 6000170000591aed949d0f5********************

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

Response parameters

Parameter Type Example Description
RequestId String 5E71541A-6007-4DCC-A38A-F872C31FEB45

The ID of the request.

ChargeType String Prepaid

The billing method of the cluster. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
DBClusterId String pc-bp10gr51qasnl****

The ID of the cluster.

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

The time when the instance expires.

Note This parameter is returned if PayType is set to Prepaid.
OrderId String 20515760028****

The ID of the order.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/?Action=TransformDBClusterPayType
&DBClusterId=pc-bp10gr51qasnl****
&PayType=Prepaid
&RegionId=cn-hangzhou
&UsedTime=1
&Period=Month
&ResourceGroupId=rg-acfm3f4un32****
&ClientToken=6000170000591aed949d0f5********************
&Common request parameters

Sample responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<TransformDBClusterPayTypeResponse>
    <RequestId>5E71541A-6007-4DCC-A38A-F872C31FEB45</RequestId>
    <ChargeType>Prepaid</ChargeType>
    <DBClusterId>pc-bp10gr51qasnl****</DBClusterId>
    <ExpiredTime>2020-04-20T10:00:00Z</ExpiredTime>
    <OrderId>205157600280623</OrderId>
</TransformDBClusterPayTypeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "5E71541A-6007-4DCC-A38A-F872C31FEB45",
  "ChargeType" : "Prepaid",
  "DBClusterId" : "pc-bp10gr51qasnl****",
  "ExpiredTime" : "2020-04-20T10:00:00Z",
  "OrderId" : "205157600280623"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidPaymentMethod.Incomplete No payment method is specified for your account. We recommend that you add a payment method. The error message returned because no valid payment method is provided within the current Alibaba Cloud account. Add a valid payment method and try again.
403 OperationDenied.LockMode The operation is not permitted when the instance is locked. The error message returned because the operation is not supported while the cluster is in the locked state.
404 InvalidDBCluster.NotFound The specified DBClusterId is not found. The error message returned because the specified cluster instance ID does not exist.

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