Updated on 2024-08-27 GMT+08:00

Paying Yearly/Monthly Product Orders

Function

A customer can invoke this API to pay yearly-monthly product orders in the pending payment status.

Customers can follow the instructions described in Payment to pay yearly/monthly product orders in the pending payment status in Billing Center.

  • This API supports both monthly settlement and balance payment. Monthly settlement is preferred.
  • Balance payment includes cash account payment and credit account payment. If both accounts have balance, the cash account payment is preferred.
  • Restrictions for using a discount and coupon at the same time:
    • If the restriction attribute of a coupon contains field simultaneousUseWithEmpowerDiscount with a value of 0, the discount and coupon cannot be used at the same time.
    • If the restriction attribute of a coupon contains field simultaneousUseWithContractDiscount with a value of 0, the discount and coupon cannot be used at the same time.
    • If the restriction attribute of a coupon contains field minConsumeDiscount and the values of discount_ratio for all the order items are less than the value of minConsumeDiscount, the discount and coupon cannot be used at the same time.
    • If the restriction attribute of a coupon contains field simultaneousUseWithPromotionDiscount with a value of 0, the discount and coupon cannot be used at the same time.
  • When this API is invoked by a unified accounting member, if their enterprise master account has coupons available for the orders, the coupons are automatically applied without the need to include coupon IDs in a request.

Constraints

This API can be invoked only by the customer AK/SK or token.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

POST /v3/orders/customer-orders/pay

Request

Request Parameters

Parameter

Mandatory

Type

Maximum Length of Characters

Description

order_id

Yes

String

A maximum of 64 characters

Order ID.

The value is the same as the order_id value in the response message of invoking the API described in Querying Orders or the order_ids value in the response message of API described in Renewing Subscription to Yearly/Monthly Resources.

use_coupon

Yes

String

[YES|NO]

Whether coupons are used for order payment. If this parameter is set to YES, the coupon_infos field is mandatory. If this parameter is set to NO, the value of coupon_infos is ignored.

  • YES: indicates that the coupons are used for payment.
  • NO: indicates that the coupons are not used for payment.

use_discount

Yes

String

[YES|NO]

Whether a discount is used for the order payment. If this parameter is set to YES, the discount_infos field is mandatory. If this parameter is set to NO, the value of discount_infos is ignored.

  • YES: indicates that the discount is used for payment.
  • NO: indicates that the discount is not used for payment.

coupon_infos

No

List<CouponSimpleInfo>

A maximum of 3 IDs are supported.

For details, see Table 1.

This parameter is reserved.

If use_coupon is set to YES, this parameter is mandatory. If use_coupon is set to NO, this parameter can be left empty. Otherwise, a message indicating parameter error is displayed.

CAUTION:

When this API is invoked by a unified accounting member, if their enterprise master account has coupons available for the orders, the coupons are automatically applied without the need to include coupon IDs in a request.

discount_infos

No

List<DiscountSimpleInfo>

Only one discount ID is allowed.

For details, see Table 2.

Discount ID list.

If use_discount is set to YES, this parameter is mandatory. If use_discount is set to NO, this parameter can be left empty. Otherwise, a message indicating parameter error is displayed.

Table 1 CouponSimpleInfo

Parameter

Mandatory

Type

Maximum Length of Characters

Description

id

Yes

String

A maximum of 64 characters

Coupon ID.

type

Yes

Integer

[300-303]

Coupon type.

  • 300: Discount coupon (reserved)
  • 301: Promotion coupon
  • 302: Promotion flexi-purchase coupon (reserved)
  • 303: Promotion stored-value card (reserved)
Table 2 DiscountSimpleInfo

Parameter

Mandatory

Type

Maximum Length of Characters

Description

id

Yes

String

A maximum of 64 characters

Discount ID.

type

Yes

Integer

[0,2,3]

Discount type.

  • 0: promotion discount
  • 2: commercial discount
  • 3: discount granted by a partner
Example Request
POST https://bss-intl.myhuaweicloud.com/v3/orders/customer-orders/pay HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
    "use_coupon":"YES",
    "use_discount":"YES",
    "coupon_infos": [
        {
            "id": "CP200527025610NGSC",
            "type": 301
        }
    ],
   "discount_infos": [
        {
            "id": "PDP2011260815047721TYT48G0BA02EI",
            "type": 1
        }
    ],
    "order_id": "CS20052715001E4CR"
}

Response

Response Parameters

Status code: 204

Success is returned by default.

Status code: 400

Parameter

Type

Maximum Length of Characters

Description

error_code

String

A maximum 10 characters

Error code.

For details, see Returned Values.

error_msg

String

A maximum of 256 characters

Error description.

quota_infos

List<QuotaInfo>

-

List of the resources whose quota or capacity is insufficient.

For details, see Table 3.

This parameter is valid only when error_code is set to CBC.99003141.

  • If the quota is insufficient, notify the customer to submit a service ticket on the HUAWEI CLOUD official website to increase the quota and then pay the order.
  • If the capacity is insufficient, notify the customer to place an order again.
  • If the specifications have changed, notify the customer to place an order again.

enterprise_project_auth_result

List<EnterpriseProject>

-

Information about the enterprise project whose fund is insufficient.

For details, see Table 4.

This parameter is valid only when error_code is set to CBC.99003155.

Table 3 QuotaInfo

Parameter

Type

Description

region

String

Cloud service region code, for example, ap-southeast-1. Obtain the value from the Region column in Regions and Endpoints.

service_type_code

String

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs.

resource_type_code

String

Resource type code. For example, the resource type code of VM is hws.resource.type.vm.

The relationship between ResourceType and CloudServiceType is as follows: A resource type represents a resource contained in the cloud service type, and the cloud service type is a combination of multiple resource types.

resource_spec_code

String

Resource specifications of the subscribed cloud service products.

For example, the resource specification of a small-scale VM is s2.small.1.linux.

service_type_name

String

Cloud service type. For example, the cloud service type of ECS is Elastic Cloud Server.

resource_type_name

String

Resource type. For example, the resource type of ECS is Cloud Host.

auth_result

Integer

Verification result of the change of the cloud service quota, capacity, or specifications.

  • 1: The quota is insufficient.
  • 2: The capacity is insufficient.
  • 3: The resource specifications are incorrect. This value is valid only when the resource specifications change between the time when a customer places an order and the time when the customer pays the order.
  • 4: The associated resource information is incorrect. This value is valid only when the resource specifications change between the time when a customer places an order and the time when the customer pays the order.
  • 99: Other errors. This value is valid only when the resource specifications change between the time when a customer places an order and the time when the customer pays the order.

available_zone

String

AZ ID.

For details, see the AZ names of regions listed on the Regions and Endpoints, for example, cn-north-1a.

Table 4 EnterpriseProject

Parameter

Type

Description

enterprise_project_id

String

ID of the enterprise project where an order belongs.

  • 0: ID of a default project
  • -1 or null: Non-project ID

enterprise_project_name

String

Enterprise project name.

auth_status

Integer

Verification result of the enterprise project's fund quota.

10: Insufficient fund quota/Invalid project

11: The organization budget quota is insufficient.

Example Response

HTTP/1.1 204 No Content
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 

Returned Values

  • 4xx: This class of HTTP status code is intended for situations in which the error seems to have been caused by the client, for example, the request contains bad syntax or incorrect parameters. You must ensure the request is correct.
  • 5xx: This class of HTTP status code is intended for cases in which the Huawei Cloud server is aware that it has encountered an error or is otherwise incapable of performing the request. In this case, contact Huawei Cloud customer service.

HTTP Status Code

Error Code

Description

400

CBC.99000046

Insufficient budget.

400

CBC.30000010

Operation not allowed because the order is invalid or does not exist.

400

CBC.99003106

The order status has changed and no payment can be made.

400

CBC.99003108

This discount cannot be used for this order.

400

CBC.99003110

The order has not been paid before the expiration time. Please re-submit the order.

400

CBC.99003112

The coupon or stored-value card has been used.

400

CBC.99003116

The restriction to selected coupon regulates that the coupon cannot be used with the discount at the same time.

400

CBC.99003117

The selected discount is less than the minimum discount rate configured for the selected coupon.

Note: For example, if the minimum discount rate configured for a coupon is 90% and the selected discount is less than 90% in all order lines, the discount cannot be used.

400

CBC.99003141

The cloud service quota or capacity is insufficient, or the resource specifications have changed.

400

CBC.99003147

Discounts and cash coupons cannot be both used.

400

CBC.99003155

The enterprise project's fund quota is insufficient, or the project is invalid.

400

CBC.99003156

Coupons applicable to KooGallery products cannot be used together with dedicated coupons.

400

CBC.99003162

The payment time must be earlier than the specified effective time.

400

CBC.99003198

Insufficient budget of the organization.

400

CBC.99005003

Insufficient balance.

400

CBC.99005036

Payment via API not allowed for this customer. (Payment by balance and monthly-settled payment are not allowed.)

400

CBC.99006093

Failed to obtain the tax rate.

400

CBC.7281

Renewal, unsubscription, or payment not supported. Your account has been frozen.

400

CBC.99008040

Too many attempts.

500

CBC.0999

Other errors.

400

CBC.99000088

Your payment is being processed.

400

CBC.99000089

Operation failed. Sub-orders of a combine order cannot be processed independently.