Overview
Bonuses are prepaid packages that allow clients to purchase multiple sessions of a specific service at a discounted rate. They consist of:- Bonus: The template defining the service, number of sessions, and price
- ClientBonus: Individual instances purchased by clients, tracking remaining sessions
Bonus Model
The Bonus model defines the package template that clients can purchase.Unique identifier for the bonus (UUID)
Name of the bonus package (e.g., “10-Session Massage Package”)
Detailed description of the bonus terms and conditions
Total number of sessions included in the bonus
Total price for the bonus package
Status of the bonus:
activo (available for purchase) or inactivo (discontinued)Reference to the specific Service this bonus is for (optional)
Service details when included in the response
Timestamp when the bonus was created
Timestamp when the bonus was last updated
List Bonuses
Retrieve all available bonus packages.Query Parameters
Search bonuses by name or description
Response
Returns an array of bonus objects with related service information included.Create Bonus
Create a new bonus package template.Request Body
Descriptive name for the bonus package
Details about the bonus, terms, and conditions
Number of sessions included (must be positive)
Total package price (typically less than service price × sessions)
UUID of the service this bonus applies to
Initial status:
activo or inactivoResponse
Returns the created bonus object with related service information.Get Bonus
Retrieve a specific bonus by ID.Path Parameters
The unique identifier of the bonus
Response
Returns the bonus object with full service details (name and price).Error Responses
HTTP status code
400: Bonus ID is required404: Bonus not found
Error message describing the issue
Update Bonus
Update an existing bonus package.Path Parameters
The unique identifier of the bonus to update
Request Body
All fields are optional. Only include fields you want to update.Update the bonus name
Update the description
Update the number of sessions
Update the package price
Change the associated service
Update the status
Response
Returns the updated bonus object with service information.Delete Bonus
Permanently delete a bonus template.Path Parameters
The unique identifier of the bonus to delete
Response
Returns
true if the deletion was successfulClient Bonus Model
When a client purchases a bonus, a ClientBonus record is created to track their usage.Unique identifier for the client’s bonus purchase (UUID)
UUID of the client who purchased the bonus
Reference to the bonus template that was purchased
Related bonus details
Number of sessions remaining for the client to use
When the client purchased this bonus
When the bonus expires (if applicable)
Status:
activo (can be used), completado (all sessions used), or expirado (expired)Timestamp when the client bonus was created
Timestamp when the client bonus was last updated
Business Logic
Pricing Strategy
Bonuses typically offer a discounted rate compared to purchasing individual sessions:Session Tracking
remaining_sessionsstarts equal tototal_sessionsat purchase- Each time a client books using their bonus,
remaining_sessionsdecrements by 1 - When
remaining_sessionsreaches 0, status should be updated tocompletado - Clients can have multiple active bonuses simultaneously
Expiration Management
- Set
expiration_dateat purchase time (e.g., 6 months from purchase) - Expired bonuses cannot be used for new bookings
- Update status to
expiradowhenexpiration_dateis passed - Consider notification systems to alert clients before expiration
Cart Integration
Bonuses are sold as items in the cart:Booking Integration
When a client books an appointment using a bonus session:- Verify client has an active ClientBonus with
remaining_sessions > 0 - Create the booking as normal
- Decrement
remaining_sessionsby 1 - If
remaining_sessionsbecomes 0, update status tocompletado - Link the booking to the ClientBonus for tracking
Validation Rules
Session Count
total_sessionsmust be a positive integer- Cannot be zero or negative
- Typically ranges from 5 to 20 sessions
Pricing
pricemust be positive- Should be less than
service.price × total_sessionsfor a real discount - Consider minimum discount thresholds (e.g., at least 10% off)
Service Association
service_idmust reference an existing, active service- If service is deleted or deactivated, bonuses should be handled appropriately
- Some bonuses might be service-agnostic (general credit)
Status Management
- Only
activobonuses appear in purchase lists - Setting to
inactivoprevents new purchases but doesn’t affect existing ClientBonuses - Existing ClientBonus records remain valid regardless of bonus template status