agent applied a coupon to the wrong subscription: no eligibility check before apply
Fixes an agent applying a coupon to the wrong subscription with no eligibility check. Covers pre-apply scoping verification, audit logging, and regression tests. Not for invalid coupons or discount math errors.
TL;DR
The agent applied a coupon to the wrong subscription because nothing checked eligibility first: coupons have scoping rules (which customers, plans, and billing intervals they apply to). Add an eligibility check before every apply: fetch the coupon's applies-to rules, verify the target subscription qualifies, and only then attach it. Log the eligibility decision so misapplications are auditable.
agent applied a coupon to the wrong subscription: no eligibility check before applyUse this when
- An agent applied a coupon to the wrong subscription
- Coupon applies lack an eligibility check
- You need coupon scoping enforcement
Not for this skill when
- The coupon itself is invalid or expired
- The discount amount calculated incorrectly
- You are debugging invoice finalization
Steps
Identify the misapplied coupon: remove it from the wrong subscription and credit any incorrect discount. Expected: The harm is repaired.
Read the coupon's eligibility rules: applicable customers, plans, and billing intervals. Expected: The rules are explicit.
Add a pre-apply check: the agent must verify the target subscription against every rule. Expected: Ineligible targets are rejected before apply.
Require the agent to log the coupon id, target subscription, and the eligibility verdict. Expected: Every apply is auditable.
Re-apply the coupon to the correct subscription if one was intended. Expected: The intended discount lands correctly.
Add a test case with a deliberately ineligible subscription to the agent's regression suite. Expected: The check is proven.
Tool compatibility
Stripe coupons and subscription discounts; any coupon system with scoping rules.
Variant phrasings
agent coupon wrong subscription apply
The incident phrased directly.
coupon eligibility check before apply
The guardrail phrasing.
stripe coupon applies_to validation
The Stripe-specific angle.
Why it happens
Coupons are scoped instruments: a coupon meant for annual plans or new customers does real financial damage applied to the wrong subscription, and the error compounds every billing cycle until caught. Agents apply coupons as instructed without the skepticism a human would bring to an odd instruction, so the check must live in the tool path, not in the prompt. Eligibility verification turns apply from a blind write into a validated write. The logged verdict gives finance an audit trail for every discount granted.
Edge cases / pitfalls
- Coupon rules can change after creation; always read the live rules, not a cached copy.
- Stacking rules matter: an eligible coupon can still be wrong if combined with another discount.
- Human approval threshold: discounts above a set value need a person even when eligible.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstLSH4os7vmQu2W-bgTEnZA