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.

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

Before you call this API operation, make sure that the ApsaraDB for MongoDB instance meets the following requirements:

  • 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.


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.

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: 1, 2, 3, 4, 5, 6, 7, 8, 9, 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
  • false
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 request.

OrderId String 21022019252****

The ID of the order.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK


JSON format

HTTP/1.1 200 OK

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

Error codes

HttpCode Error codes 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.