Rental Reservations
Rental reservations book a unit out for a window of time — a bike, a kayak, a camera, an event space — and track everything that comes with handing physical property to a customer: a duration tier, a rental charge and security deposit, an optional waiver and ID verification, a pickup/return checklist, and the return state (including overdue). They are the most operationally involved reservation type because the unit physically leaves and must come back.
The TypeScript SDK exposes a dedicated client.rentalReservations resource with rental-specific fields (tier, payment, deposit status, checklist). The Python SDK creates every reservation type through the unified client.reservations resource using reservation_type="rental" and the shared reservation fields. Both are shown below.
Create a rental resource
First, create the rental resource and its physical units (see Resources & Instances).
- TypeScript
- Python
import { ResourceType, ResourceInstanceStatus } from 'wiil-core-js';
const rentalResource = await client.reservationResources.create({
name: 'Mountain Bike - Premium',
resourceType: ResourceType.RENTAL,
capacity: 1,
isAvailable: true,
amenities: ['Helmet included', 'Lock included'],
checklistTemplate: [],
applicableTierIds: [],
instances: [
{ name: 'Bike #001', code: 'MTB-001', status: ResourceInstanceStatus.AVAILABLE, isAvailable: true },
{ name: 'Bike #002', code: 'MTB-002', status: ResourceInstanceStatus.AVAILABLE, isAvailable: true },
],
});
from wiil.models.business_mgt import CreateResource
rental_resource = client.reservation_resources.create(
CreateResource(
resource_type="rental",
name="Mountain Bike - Premium",
capacity=1,
is_available=True,
amenities=["Helmet included", "Lock included"],
reservation_duration=240,
reservation_duration_unit="minutes",
)
)
Query available rental slots
Rental slot availability — with pickup and return times — is queried through the TypeScript SDK.
import { ResourceType, RentalCandidateSlot } from 'wiil-core-js';
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const localDate = tomorrow.toISOString().split('T')[0];
const slotResponse = await client.rentalReservations.getAvailableSlots({
resourceType: ResourceType.RENTAL,
localDate: localDate,
resourceId: rentalResource.id,
durationMinutes: 240, // 4 hours
maxResults: 10,
});
slotResponse.slots.forEach((slot: RentalCandidateSlot, idx) => {
console.log(` ${idx + 1}. Pickup: ${slot.pickupTimeOfDay}, Return: ${slot.returnTimeOfDay}`);
});
Create a rental reservation
- TypeScript
- Python
import {
CreateRentalReservationSchema,
RentalReservationStatus,
DepositStatus,
} from 'wiil-core-js';
const slot = slotResponse.slots.find(s => s.isAvailable);
if (!slot) throw new Error('No available rental slots');
// API expects UTC seconds
const rentalReservation = await client.rentalReservations.create({
resourceId: rentalResource.id,
customerId: 'cust_789',
startAt: slot.startTimeUtcSec,
endAt: slot.endTimeUtcSec,
tierId: 'tier_standard',
status: RentalReservationStatus.UPCOMING,
payment: {
rentalCharge: 75.00,
securityDeposit: 200.00,
depositStatus: DepositStatus.PENDING,
},
checklistCompletions: [],
notes: 'First-time renter, provide extra instructions',
});
console.log(`Rental Reservation Created: ${rentalReservation.id}`);
from time import time
from wiil.models.business_mgt import CreateReservation
now_ms = int(time() * 1000)
reservation = client.reservations.create(
CreateReservation(
reservation_type="rental",
resource_id=rental_resource.id,
customer_id="cust_789",
start_time=now_ms + 3600000,
end_time=now_ms + 3600000 + 4 * 60 * 60 * 1000,
duration=240,
total_price=75.00,
deposit_paid=200.00,
notes="First-time renter, provide extra instructions",
is_resource_reservation=True,
)
)
print("Reservation:", reservation.id)
The unified Python model captures the rental charge and deposit through the shared total_price and deposit_paid fields. Rental-specific structures — tierId, depositStatus, waiver, ID verification, and checklist completions — are modeled on the TypeScript rentalReservations resource.
Read, update, and cancel
- TypeScript
- Python
import { DepositStatus } from 'wiil-core-js';
const rental = await client.rentalReservations.get('reservation_123');
const customerRentals = await client.rentalReservations.getByCustomer('cust_789');
const resourceRentals = await client.rentalReservations.getByResource(rentalResource.id);
const all = await client.rentalReservations.list();
const updated = await client.rentalReservations.update(rentalReservation.id, {
id: rentalReservation.id,
notes: 'Customer requested early pickup',
payment: {
rentalCharge: 85.00,
securityDeposit: 200.00,
depositStatus: DepositStatus.PAID,
},
});
const cancelled = await client.rentalReservations.cancel(
rentalReservation.id,
'Weather conditions not suitable'
);
await client.rentalReservations.delete('reservation_123');
from wiil.models.business_mgt import UpdateReservation
from wiil.types import PaginationRequest
loaded = client.reservations.get(reservation.id)
by_customer = client.reservations.get_by_customer("cust_789", PaginationRequest(page=1, page_size=20))
by_resource = client.reservations.get_by_resource(rental_resource.id, PaginationRequest(page=1, page_size=20))
updated = client.reservations.update(
UpdateReservation(id=reservation.id, notes="Customer requested early pickup")
)
cancelled = client.reservations.update_status(reservation.id, "cancelled")
RentalReservation fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier |
customerId | string | Yes | Customer identifier |
resourceId | string | Yes | Rental resource |
tierId | string | Yes | Rental tier from reservation settings |
startAt | number | Yes | Pickup / rental start (Unix seconds) |
endAt | number | Yes | Expected return (Unix seconds) |
actualReturnAt | number | null | No | Actual return timestamp |
status | enum | Yes | Lifecycle status (see below; default upcoming) |
payment | object | Yes | rentalCharge, securityDeposit, depositStatus |
checklistCompletions | array | Yes | Pickup/return checklist results |
waiver | object | null | No | Waiver reference and status |
idVerification | object | null | No | ID verification reference and status |
notes | string | null | No | Free-text notes |
locationId | string | null | No | Location scope |
channelId | string | null | No | Booking channel |
Status lifecycle
| Value | Meaning |
|---|---|
upcoming | Future rental |
pickup_soon | Near the pickup window |
out | Unit is currently rented |
returned | Unit has been returned |
overdue | Expected return (endAt) has passed |
cancelled | Rental was cancelled |
Payment
| Field | Type | Description |
|---|---|---|
rentalCharge | number | Rental fee (≥ 0) |
securityDeposit | number | Refundable deposit (≥ 0) |
depositStatus | enum | pending, paid, returned, or forfeited |
Checklist completions
Each entry records a checklist item result at pickup or return.
| Field | Type | Description |
|---|---|---|
itemId | string | Checklist item from the resource's checklistTemplate |
completed | boolean | Whether the item was completed (default false) |
completedAt | number | null | When it was completed |
completedBy | string | null | Who completed it |
Waiver & ID verification
A rental can require a signed waiver and a verified identity before the unit goes out. The waiver reference carries a waiverId, optional signedAt, and a status of required, signed, or waived. The idVerification reference carries a verificationId, optional provider and verifiedAt, and a status of required, verified, or rejected. Whether these are required is configured in rental settings.
endAt must be greater than startAt, and rentalCharge and securityDeposit must be non-negative.
Query options
RentalReservation queries filter by resourceId, customerId, status[], and date range, sorted by startAt, endAt, or createdAt (asc / desc), with page/pageSize pagination.
Related
- Resources & Instances — rental resources, pricing tiers, and checklist templates
- Settings & Operations — rental tiers, waiver, ID verification, and deposit defaults
- Quickstart — an end-to-end reservation flow