All Products
Search
Document Center

BSS OpenAPI:RefundInstance

Last Updated:Mar 01, 2024

Unsubscribes from an instance that is no longer needed.

Operation description

  1. Refunds are applicable only for the actual paid amount. Vouchers used for the purchase are non-refundable.
  2. Check the information about unsubscription and confirm the unsubscription terms and refundable amount. The resource that is unsubscribed cannot be restored.
  3. For more information, see Rules for unsubscribing from resources.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
bss:RefundBatchRemainRefundRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

This parameter is required for scenarios that need idempotence. The UUID that is used to ensure the idempotence of the request.

793F021C-B589-1225-82A9-99232AEBE494
ImmediatelyReleasestringNo

This parameter is required for unsubscription scenarios. Valid values: 1 and 0. A value of 1 specifies that the instance is immediately released. A value of 0 specifies that the instance is shut down based on the shutdown policy. This parameter is supported only for specified services. Default value: 1.

1
ProductCodestringNo

The code of the service. This parameter is required for unsubscription scenarios.

ecs
InstanceIdstringNo

The ID of the instance. This parameter is required for unsubscription scenarios. Do not specify a custom name for this parameter.

i-bp1etb69sqxgl4*******
ProductTypestringNo

The type of the service. This parameter is required for unsubscription scenarios. Unless otherwise specified, set this parameter to an empty string.

”“

Response parameters

ParameterTypeDescriptionExample
object

The result of the request.

Messagestring

The description of the execution result.

success
RequestIdstring

The ID of the request.

UUID
Dataobject

The returned data.

HostIdstring

The site of the execution host.

cn
OrderIdlong

The ID of the refund order that is returned only if the instance is unsubscribed from.

2100000000***
Codestring

The HTTP status code.

ResourceNotExists
Successboolean

Indicates whether the request was successful. Valid values: true and false.

false

Examples

Sample success responses

JSONformat

{
  "Message": "success",
  "RequestId": "UUID",
  "Data": {
    "HostId": "cn",
    "OrderId": 0
  },
  "Code": "ResourceNotExists",
  "Success": false
}

Error codes

HTTP status codeError codeError message
400ResourceNotExistsThe specific resource is not exists.
400ResourceStatusErrorThe resource status error.
400InvalidOwnerThe specified owner does not belong to caller.
400InvalidParameterThe specified request contains invalid parameters.
400MissingParameterThe specified request lacks essential parameters.
400NotApplicableThe specified API is not applicable for the user.
400NotAuthorizedThe user is not authorized for the specified API.
400BindMirrorInstanceErrorCharged images that are related to ECS.
400ExceedRefundQuotaErrorThe number of unsubscription times has reached the upper limit.
400ExistUnPaidOrderErrorThe instance has an unsettled order.
400ExistRefundingOrderErrorThe instance ID is invalid: the instance may have expired, been refunded, or been released.
400NoRestValueErrorThe refund amount is 0.
400AmbassadorOrderLimitErrorThe instance has an ambassador order that may raise risks.
400ActivityForbiddenErrorPromotional orders do not support refunds.
400ProductCheckErrorThe cloud service failed SPI preflight verification.
400CommodityNotSupportedThe specified commodity is not supported.
500InternalErrorAn error occurred in the internal server.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history

Error codes that are returned if a request is blocked

  • ResourceNotExists: The instance does not exist.
  • ResourceStatusError: The instance is not in the expected state.
  • BindMirrorInstanceError: The ECS instance is bound to a paid image.
  • ExceedRefundQuotaError: The number of times that you unsubscribe from the instance exceeds the quota.
  • ExistUnPaidOrderError: An order that is not paid exists in the instance.
  • ExistRefundingOrderError: The ID of the instance is invalid because the instance expires, the instance is released, or the instance is refunded.
  • NoRestValueError: The refundable amount is 0.
  • AmbassadorOrderLimitError: The instance has an ambassador order that may raise risks.
  • ActivityForbiddenError: You cannot request a refund for an instance that is purchased during the marketing campaigns.
  • ProductCheckError: The instance does not pass the precheck.