Querying Coupons
Function
Customers can query information about their coupons.
You can follow the instructions described in Viewing Cash Coupons to view coupons.
- Currently, flexi-purchase coupons and discount coupons are not available for the international website.
- Information about cash coupons or discount coupons that have expired for more than one year is not returned.
- If the expiration time of a coupon is earlier than the current time, the coupon is invalid.
Constraints
This API can be invoked using the customer AK/SK or token.
You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.
URI
GET /v2/promotions/benefits/coupons
The following table describes the parameters.
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
coupon_id |
No |
String |
A maximum of 64 characters |
Coupon ID. If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. |
order_id |
No |
String |
A maximum of 64 characters |
Order ID. If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. |
promotion_plan_id |
No |
String |
A maximum of 64 characters |
Promotion plan ID. If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. |
coupon_type |
No |
Integer |
[1-4] |
Coupon type.
If this parameter is not included in the request parameters, is left empty, or is set to null, it cannot be used as a filter criterion. It cannot be set to "". |
status |
No |
Integer |
[1-5] |
Customer coupon status.
If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. |
active_start_time |
No |
String |
A maximum of 64 characters |
Activation start 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. If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. It cannot be set to "" or null. |
active_end_time |
No |
String |
A maximum of 64 characters |
Activation 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. If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. It cannot be set to "" or null. |
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, if there are 10 records that meet query conditions, when you set limit to 10 and offset to 1, the second to the tenth records are returned. If there are 20 records that meet query conditions, when you set offset to 0 and limit to 10 for the first page and set offset to 10 and limit to 10 for the second page, then each page will respectively have 10 records. |
limit |
No |
Integer |
[1-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. If this parameter is not included, is left empty, or is set to null, it cannot be used as a filter criterion. If it is set to "", it can be used as a filter criterion. |
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. |
Parameter |
Type |
Description |
---|---|---|
coupon_id |
String |
Coupon ID. |
coupon_code |
String |
Coupon code. |
status |
Integer |
Coupon status
|
customer_id |
String |
Customer account ID. |
coupon_type |
Integer |
Coupon type.
|
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.
NOTE:
If a coupon is used for multiple times, order IDs involved are separated by semicolons (;). If a coupon is used in a combined payment, order IDs involved are separated by commas (,). Example: CS1904011928GIBHC1,CS1904011928GIBHC2,CS1904011928GIBHC3;CS1904011928GIBHCB. Not all returned orders used the coupon. |
promotion_plan_id |
String |
Promotion plan ID. |
plan_name |
String |
Promotion plan name. |
plan_desc |
String |
Promotion plan description. |
media_type |
Integer |
Medium type.
|
fetch_method |
Integer |
Obtaining method.
|
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.
|
balance |
Double |
Coupon balance. Unit: USD |
lock_order_id |
String |
ID of the order for the coupon. |
coupon_usage |
String |
Coupon usage. |
is_frozen |
String |
Whether a coupon is frozen.
|
currency |
String |
Currency. The options are as follows: USD |
extend_param1 |
String |
Extended field. |
source_id |
String |
Coupon source.
|
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. |
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:
|
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. |
|
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).
|
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:
|
|
isOnlyForStrictSelected |
Whether the coupons can only be used for Featured Products on KooGallery. |
The value is specified in value1. The value can be:
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:
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:
|
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:
|
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:
|
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:
|
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": "532 USDCoupon name", "plan_desc": "532 USDCoupon 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
- 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 Value |
Error Code |
Description |
---|---|---|
400 |
CBC.0100 |
Parameter error. |
403 |
CBC.0151 |
Access denied. |
500 |
CBC.0999 |
Other errors |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot