Discount Code Endpoint updated_at

willf
New Member
1 0 0

Hello,

For this endpoint: /admin/api/2021-07/price_rules/456.json

{
  "price_rule": {
    "id": 456,
    "value_type": "percentage",
    "value": "-20.0",
    "customer_selection": "prerequisite",
    "target_type": "line_item",
    "target_selection": "entitled",
    "allocation_method": "across",
    "allocation_limit": null,
    "once_per_customer": true,
    "usage_limit": 8,
    "starts_at": "2021-06-29T17:18:04+02:00",
    "ends_at": null,
    "created_at": "2021-06-29T17:18:04+02:00",
    "updated_at": "2021-06-30T07:20:23+02:00",
...
}

I assume the updated_at field would be only updated when the endpoint/rule was modified. This makes sense, tells me if anyone has changed the rules.

But for this endpoint: /admin/api/2021-07/discount_codes/lookup.json?code=XXX

 

{
  "discount_code": {
    "id": 123,
    "price_rule_id": 456,
    "code": "XXX",
    "usage_count": 9,
    "created_at": "2021-06-29T17:18:04+02:00",
    "updated_at": "2021-06-30T07:20:22+02:00"
  }
}

 

Does updated_at get updated when usage_count is updated from a processed order? So we can assume 2021-06-30 7:20:22 was the "last order" that used this coupon code, or something else?

I am trying to debug a situation where the usage count in discount code is higher than the usage limit. We have no records of changing this price rule, but with these two endpoints being within one second (rounding error), seems a bit odd.

Has anyone ran into this situation before?

Thanks,

-will

 

 

 

 

0 Likes