ApplyPromoCode
Need an API key?
Get one from Crave Dashboard > Developers > API Development > Step 1 - API Keys. Copy the matching
locationId from Step 2 - Location IDs on the same page.Preview
Import
Usage
Props
(code: string) => Promise<PromoResult>
required
Async callback to validate and apply the promo code. Should return the discount result or throw on invalid codes.
string
Currently applied promo code, if any.
() => void
Callback to remove the currently applied promo code.
Behavior
- Inline validation with loading state during API call
- Shows success message with discount amount on valid code
- Shows error message for invalid or expired codes
- Displays applied code as a removable chip
- Collapses to “Have a promo code?” link when no code is applied