Help Center > > API Reference> Transaction Management> Coupons Management> Querying Coupons

Querying Coupons

Updated at: Jun 17, 2021 GMT+08:00

Function

Partners can query information about their coupons.

Partners can following the instructions described in Viewing Cash Coupons to view the issued cash coupons in Partner Center, and view details about a cash coupon.

HUAWEI CLOUD (International site) does not provide flexi-purchase coupons or discount coupons.

Constraints

This API can be used to query only the coupons of the partner. To query the coupon list of a customer on the partner sales platform, the customer token is used.

URI

GET /v2/promotions/benefits/coupons

The following table describes the parameters.

Table 1 Request parameters

Parameter

Mandatory

Type

Value Range

Description

coupon_id

No

String

A maximum of 64 characters

Coupon ID.

order_id

No

String

A maximum of 64 characters

Order ID.

promotion_plan_id

No

String

A maximum of 64 characters

Promotion plan ID.

coupon_type

No

Integer

[1-4]

Coupon type.

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

status

No

Integer

[1-4]

Customer coupon status.

  • 1: Inactivated
  • 2: To be used
  • 3: Used
  • 4: Expired

active_start_time

No

String

A maximum of 64 characters

Activation time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, such as 2019-05-06T08:05:01Z The range of HH is 0-23, and the range of mm and ss is 0-59.

active_end_time

No

String

A maximum of 64 characters

End time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, such as 2019-05-06T08:05:01Z The range of HH is 0-23, and the range of mm and ss is 0-59.

offset

No

Integer

0 to maximum integer

Offset, which starts from 0. The default value is 0.

NOTE:

This parameter is used for pagination. Retain its default value 0 if pagination is not required. offset indicates the offset relative to the first data record among all that meets the conditions configured. If you set offset to 1, the second and subsequent data records are returned.

For example, there are 10 data records, and if you set limit to 10 and offset to 1, the second to the tenth data records are returned.

limit

No

Integer

Maximum value: 100

Number of coupons queried each time. The default value is 10.

source_id

No

String

A maximum of 255 characters

Coupon source. If the coupon is sent by a partner, the parameter value is the partner ID.

To query coupons issued by a partner, enter the partner ID.

Request Message

Request Parameters

No.

Example Request

GET https://bss-intl.myhuaweicloud.com/v2/promotions/benefits/coupons HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response Message

Response Parameters

Parameter

Type

Value Range

Description

error_code

String

A maximum of 16 characters

Error code.

For details, see Returned Values.

error_msg

String

A maximum of 1024 characters

Error description.

count

Integer

-

Total number of records that meet the search criteria.

user_coupons

List<IQueryUserCouponsResult>

-

Coupon records.

For details, see Table 2.

Table 2 IQueryUserCouponsResult

Parameter

Type

Description

coupon_id

String

Coupon ID.

coupon_code

String

Coupon code.

status

Integer

Coupon status

  • 1: Inactivated
  • 2: To be used
  • 3: Used
  • 4: Expired
  • 5: Withdrawn

customer_id

String

Customer account ID.

coupon_type

Integer

Coupon type.

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

measure_id

Integer

Measurement unit.

1: Dollar

face_value

Double

Coupon amount.

valid_time

String

Effective time.

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

expire_time

String

Expiration time.

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

order_id

String

Order ID.

promotion_plan_id

String

Promotion plan ID.

plan_name

String

Promotion plan name.

plan_desc

String

Promotion plan description.

media_type

Integer

Medium type.

  • 1: E-coupon
  • 2: Paper coupon

fetch_method

Integer

Obtaining method.

  • 1: Claimed online
  • 2: Redeemed online
  • 3: Issued online
  • 4: Obtained offline
  • 5: Rewarded based on events

use_limits

List<ICouponUseLimitInfoV2>

Coupon usage limits.

For details, see Table 3.

active_time

String

Activation time.

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

reserve_time

String

Usage time.

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

promotion_id

String

Promotion ID.

create_time

String

Creation time.

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

coupon_version

Integer

Coupon version.

  • 1: Old version. Coupons of the old version can be used only once.
  • 2: New version. Coupons of the new version can be used repeatedly.

balance

Double

Coupon balance. Unit: USD

For coupons of the old version, this parameter is left empty.

lock_order_id

String

ID of the order for the coupon.

For coupons of the old version, this parameter is left empty.

coupon_usage

String

Coupon usage.

is_frozen

String

Whether a coupon is frozen.

  • 0: No
  • 1: Yes

currency

String

Currency. The options are as follows:

USD

extend_param1

String

Extended field.

source_id

String

Coupon source.

  • If the coupon is sent by a partner, the parameter value is the partner ID.
  • If the coupon is issued for an activity, the parameter value is the activity ID.
    • Coupons redeemed by cloud beans: Cloud bean ID
    • Coupons issued as rewards of accumulated consumption: Consumption accumulation reward ID
    • Coupons issued as rewards for lucky draw: Lucky draw ID
    • Coupons issued based on events: Event ID
    • Customized coupons: Creator ID
Table 3 ICouponUseLimitInfoV2

Parameter

Type

Description

use_limiti_info_id

String

Usage limit ID.

limit_key

String

Usage limit. For details about the value, see Table 4.

value1

String

Value 1.

value2

String

Value 2.

value_unit

String

Value unit.

limit_type

String

Limit type.

promotion_plan_id

String

Promotion plan ID.

Table 4 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

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

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": "CP19092406014086E3",
      "coupon_code": "CP19092406014086E3",
      "status": "2",
      "customer_id": "c9e731c4663646988ef4cdb3122837b6",
      "coupon_type": "1",
      "measure_id": "1",
      "face_value": "100",
      "valid_time": "2019-09-16T16:00:00Z",
      "expire_time": "2019-09-16T16:00:00Z",
      "order_id": "CS1904011928GIBHC",
      "promotion_plan_id": "promotionPlanId5322584",
      "plan_name": "532USDCoupon name",
      "plan_desc": "532USDCoupon desc",
      "media_type": "1",
      "fetch_method": "1",
      "use_limits": [
        {
          "use_limiti_info_id": "CP19092406014086E3",
          "limit_key": "simultaneousUseWithDiscountCoupon",
          "value1": "1",
          "value2": "",
          "value_unit": "",
          "limit_type": "=",
          "promotion_plan_id": "promotionPlanId5322584"
        }
      ],
      "active_time": "2019-09-16T16:00:00Z",
      "reserve_time": "2019-09-16T16:00:00Z",
      "promotion_id": "promotionPlanId5322584",
      "create_time": "2019-09-16T16:00:00Z",
      "coupon_version": "2",
      "balance": "100",
      "lock_order_id": "CS1904011928GIBHC",
      "coupon_usage": "170719190603338056FEH60VIRWEP",
      "is_frozen": "0",
      "currency": "USD",
      "extend_param1": "2019091702368200",
      "source_id": "c9e731c4663646988ef4cdb3122837b6"
    }
  ]
}

Returned Values

HTTP Value

Error Code

Description

400

CBC.0100

Parameter error.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel