Products, payments, and bookings
Create a product
bash
curl -X POST "$BOOKING_URL/api/products" \
-H "Authorization: Bearer $BOOKING_SESSION" \
-H "Content-Type: application/json" \
-d '{
"type":"class_pass",
"name":"Ten class pass",
"price":120000,
"currency":"DKK",
"classAllowance":10,
"validityDays":180,
"status":"active"
}'Supported types are drop_in, subscription, class_pass, workshop, teacher_training, and other.
Purchase
An authenticated user purchases with POST /api/products/{productId}/purchases. A paid result creates an entitlement automatically. Purchases require an active payment connection.
Book with an entitlement
json
{
"instanceId": "INSTANCE_ID",
"entitlementId": "ENTITLEMENT_ID"
}Book with a drop-in payment
json
{
"instanceId": "INSTANCE_ID",
"productId": "DROP_IN_PRODUCT_ID"
}Post either body to /api/bookings. The API checks cancellation, audience, group participation, capacity, entitlement ownership/expiry/allowance, and payment outcome atomically.
Attendees see their own bookings with GET /api/bookings; elevated operational roles see all bookings in their account. Delete /api/bookings/{bookingId} to cancel. Cancelling an entitlement-funded booking restores one remaining class where applicable.