Updated on 2024-07-08 GMT+08:00
Querying Available Coupons for an Order

Querying Available Coupons for an Order

Function

A customer can invoke this API to view the coupons available for an order on the self-built platform.

For details about how to check available coupons in Billing Center, see Viewing Cash Coupons.

Constraints

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

URI

GET /v2/orders/customer-orders/order-coupons

The following table describes the parameter.

Table 1 Request parameter

Parameter

Mandatory

Value Range

Description

order_id

Yes

A maximum of 64 characters

Order ID.

Request

Request parameters

None

Example Request

GET https://bss.myhuaweicloud.eu/v2/orders/customer-orders/order-coupons?order_id=CS170926155954NO7 HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response

Response parameters

Parameter

Type

Value Range

Description

error_code

String

A maximum of 20 characters

Error code.

For details, see Returned Values.

error_msg

String

A maximum of 2,000 characters

Error description.

count

Integer

-

Total queries.

user_coupons

List<CouponInfoV2>

-

Querying customer's yearly/monthly resources

For details, see Table 2.

coupon_max_use_quantity

List<CouponMaxUseQuantity>

-

Maximum number of coupons that can be used.

For details, see Table 4.

Table 2 CouponInfoV2

Parameter

Type

Value Range

Description

coupon_id

String

A maximum of 64 characters

Coupon ID.

coupon_code

String

A maximum of 64 characters

Coupon code.

status

Integer

-

Coupon status. The options are as follows:

  • 1: Inactivated
  • 2: To be used

coupon_type

Integer

-

Coupon type.

  • 300: Discount coupon (reserved)
  • 301: Cash coupon
  • 302: Flexi-purchase coupon (reserved)
  • 303: Stored-value card (reserved)

measure_id

Integer

-

Currency.

1: Dollar

face_value

Double

-

Face value.

effective_time

String

A maximum of 20 characters

Effective time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

expire_time

String

A maximum of 20 characters

Expiration time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

plan_name

String

A maximum of 512 characters

Promotion plan name.

plan_desc

String

A maximum of 512 characters

Promotion plan description.

use_limits

List<LimitInfoV2>

-

Coupon limits.

For details, see Table 3.

active_time

String

A maximum of 20 characters

Activation time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

last_used_time

String

A maximum of 20 characters

Last use time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

create_time

String

A maximum of 20 characters

Creation time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

coupon_version

Integer

-

Coupon version.

  • 1: Earlier version (including three types: cash coupon, discount coupon, and bonus coupon)
  • 2: Latest version (cash coupon)

balance

Double

-

Balance.

used_by_order_id

String

A maximum of 64 characters

ID of the order for which a coupon is used. A coupon used for an order cannot be used for other orders.

coupon_usage

String

A maximum of 512 characters

Coupon usage.

coupon_group

Integer

-

Coupon category

  • 1: Coupons issued by KooGallery
  • 2: Huawei Cloud coupon-1024-dedicated coupon
  • 3: Huawei Cloud coupon - usage restrictions - hardware coupon
  • 0: Huawei Cloud service coupons (excluding coupons above)
Table 3 LimitInfoV2

Parameter

Type

Value Range

Description

use_limiti_info_id

String

A maximum of 128 characters

Usage limit ID.

limit_key

String

A maximum of 1024 characters

Discount limit. For details about the value, see Table 5.

value1

String

A maximum of 2048 characters

Value 1.

value2

String

A maximum of 2048 characters

Value 2.

value_unit

String

A maximum of 1024 characters

Value unit.

limit_type

String

A maximum of 1024 characters

Limit type.

promotion_plan_id

String

A maximum of 128 characters

Promotion plan ID.

Table 4 CouponMaxUseQuantity

Parameter

Type

Value Range

Description

coupon_type

Integer

-

Coupon type.

  • 1: Cash coupon
  • 2: Discount coupon
  • 3: Product coupon
  • 4: Flexi-purchase coupon

coupon_group

Integer

-

Coupon category

  • 1: Coupons issued by KooGallery
  • 2: Huawei Cloud coupon-1024-dedicated coupon
  • 3: Huawei Cloud coupon - usage restrictions - hardware coupons
  • 0: Huawei Cloud service coupons (excluding coupons above)

use_quantity_value

Integer

-

Number of used coupons.

Currently, flexi-purchase coupons and discount coupons are not available for the European site.

Table 5 limit_key requirements for ICouponUseLimitInfo

Key

Meaning

Description

Remarks

baseValue

Order amount.

value1 specifies the lower limit of the order amount, and value2 specifies the upper limit of the order amount.

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

serviceType

Cloud service type.

Only value1 is valid. To obtain a specific cloud service type, call the API in Querying Cloud Service Types.

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

regionCode

Region code.

value1 specifies the region code, and value2 specifies the region name.

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

productId

Product ID

You can configure multiple product IDs. Separate them using commas (,).

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

subscribeType

Order type.

Only value1 is valid. The value can be:

  • new: Order placement
  • renew: Order renewal
  • change: Order change

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

firstOrderInService

Restriction for the first-time purchase.

Only value1 is valid.

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

cycleNum

Number of periods.

Only value1 is valid.

Cash coupons, flexi-purchase coupons, and discount coupons are supported.

cycleType

Trial use period type.

  • 0: Yearly/monthly (unlimited)
  • 1. Yearly/monthly (yearly)
  • 2: Yearly/monthly (monthly)
  • 3: Yearly/monthly (daily)
  • 4: Yearly/monthly (hourly)
  • 5: Pay-per-use
  • 6: General purpose
  • 7: One-off payment
  • 8: Reserved instance
  • 11: Savings plan

Cash coupons, flexi-purchase coupons, and discount coupons are supported. Discount coupons support only the yearly/monthly mode.

simultaneousUseWithEmpowerDiscount

Whether cash coupons can be used together with authorized discounts.

Whether cash coupons can be used with authorized discounts (including commercial discounts and discounts authorized by partners).

  • 0: No
  • 1: Yes

Cash coupons, flexi-purchase coupons, and discount coupons are supported. The value for discount coupons can only be 0.

usageTimes

Whether coupons can be used for multiple times.

The value is specified in value1. The value can be:

  • 0: Used for unlimited times
  • 1: Used for only once
  • N: Used for N times. (For cash coupons of the old version, N is fixed at 1.)
  • When CouponType is set to 2 (discount coupons), this parameter can only be set to 1, and if this parameter is not specified or is set to a non-1 value, the parameter value is 1.
  • When CouponType is set to 1 (cash coupons) (or 4 (flexi-purchase coupons), if this parameter is not specified or is set to a value other than 0 or 1, the parameter value is 0.

isOnlyForStrictSelected

Whether the coupons can only be used for Featured Products on KooGallery.

The value is specified in value1. The value can be:

  • 0: No
  • 1: Yes

If there is no such restriction, the value is 0. This restriction applies only to flexi-purchase coupons.

Flex-purchase coupons are supported.

isRebate

Whether coupons are counted in to the partner incentive rebates.

The value is specified in value1. The value can be:

  • 0: No
  • 1: Yes

This restriction applies only to flexi-purchase coupons.

Flex-purchase coupons are supported.

serviceTypeBlackList

Service type blacklist.

Service type blacklist. The service type code is specified in value1. This restriction applies only to flexi-purchase coupons.

Flex-purchase coupons are supported.

minConsumeDiscount

Minimum customer consumption discount.

The value is specified in value1. The value ranges from 0 to 1 (excluding 0 and 1).

Cash coupons and flexi-purchase coupons are supported.

isForAnnualContracts

Whether coupons can only be used for yearly/monthly (one-year) orders.

The value can be:

  • 0: No
  • 1: Yes

Cash coupons and discount coupons are supported.

simultaneousUseWithPromotionProduct

Whether cash coupons can be used together with promotional products.

The value is specified in value1. The value can be:

  • 0: No
  • 1: Yes

Cash coupons and discount coupons are supported.

simultaneousUseWithPromotionDiscount

Whether cash coupons can be used together with promotion discounts.

The value is specified in value1. The value can be:

  • 0: No
  • 1: Yes

Cash coupons are supported.

simultaneousUseWithDiscountCoupon

Whether cash coupons can be used together with discount coupons.

The value is specified in value1. The value can be:

  • 0: No
  • 1: Yes

Cash coupons are supported.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time
{
  "count": "1",
  "user_coupons": [
    {
      "coupon_id": "CP1*****4VC8",
      "coupon_code": "",
      "status": "2",
      "coupon_type": "301",
      "measure_id": "1",
      "face_value": "100",
      "effective_time": "2021-04-29T15:59:59Z",
      "expire_time": "2021-04-30T15:59:59Z",
      "plan_name": "Cash coupon for HUAWEI CLOUD products",
      "plan_desc": "",
      "use_limits": [
        {
          "use_limiti_info_id": "",
          "limit_key": "simultaneousUseWithDiscountCoupon",
          "value1": "1",
          "value2": "",
          "value_unit": "",
          "limit_type": "",
          "promotion_plan_id": ""
        }
      ],
      "active_time": "2020-04-24T12:16:55Z",
      "last_used_time": "",
      "create_time": "2020-04-24T12:16:55Z",
      "coupon_version": 2,
      "balance": 10.0,
      "used_by_order_id": "",
      "coupon_usage": "null",
      "coupon_group": 1
    }
  ],
"coupon_max_use_quantity": [
        {
            "coupon_type": 1,
            "coupon_group": 0,
            "use_quantity_value": 3
        },
        {
            "coupon_type": 1,
            "coupon_group": 3,
            "use_quantity_value": 4
        },
        {
            "coupon_type": 1,
            "coupon_group": 1,
            "use_quantity_value": 2
        }
    ]
}

Returned Values

  • 4xx: Indicates errors caused by the client side, for example, a request containing bad syntax or incorrect parameters. You must ensure the request is correct.
  • 5xx: Indicates error caused by the Huawei Cloud system side. In this case, contact Huawei Cloud customer service.

HTTP Value

Error Code

Description

400

CBC.0100

Parameter error.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.