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

Before you call this operation, make sure that you understand the billing methods and pricing of ApsaraDB for MongoDB. For more information, go to the Pricing tab of the ApsaraDB for MongoDB product page at the international site (alibabacloud.com).

A subscription instance cannot be changed to a pay-as-you-go instance. To avoid wasting resources, proceed with caution.

Before you call this operation, make sure that the following requirements are met:

  • The instance is in the Running state.
  • The billing method of the instance is pay-as-you-go.
  • The instance has no unpaid subscription orders.
  • The instance type is available for purchase. For more information about unavailable instance types, see Instance types.
Note To change the billing method of an instance whose instance type is no longer available to subscription, call the ModifyDBInstanceSpec or ModifyNodeSpec operation to first change the instance type.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer automatically 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.

RegionId String No cn-hangzhou

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

InstanceId String Yes dds-bp1366caac83****

The ID of the instance.

Period Long Yes 1

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

AutoPay Boolean No true

Specifies whether to enable automatic payment. Valid values:

Note Default value: true.
BusinessInfo String No {“ActivityId":"000000000"}

The business information. This is an additional parameter.

AutoRenew String No true

Specifies whether to enable auto-renewal for the instance. Valid values:

  • true: enables auto-renewal.
  • false: disables auto-renewal.
Note Default value: false.
CouponNo String No youhuiquan_promotion_option_id_for_blank

The coupon code. Default value: youhuiquan_promotion_option_id_for_blank.

Response parameters

Parameter Type Example Description
RequestId String 2F42BB4E-461F-5B55-A37C-53B1141C****

The ID of the instance.

OrderId String 21022019252****

The ID of the order.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/?Action=TransformToPrePaid
&Period=1
&InstanceId=dds-bp1366caac83****
&<Common request parameters>

Sample success responses

XML format

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

<TransformToPrePaidResponse>
    <RequestId>2F42BB4E-461F-5B55-A37C-53B1141C****</RequestId>
    <OrderId>21022019252****</OrderId>
</TransformToPrePaidResponse>

JSON format

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

{
  "RequestId" : "2F42BB4E-461F-5B55-A37C-53B1141C****",
  "OrderId" : "21022019252****"
}

Error codes

HttpCode Error code Error message Description
400 InsufficientBalance Your account does not have enough balance. The error message returned because your account balance is insufficient. Add funds to your account and try again.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because the specified user has not completed real-name verification. Complete real-name verification and try again.

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