Skip to main content

Overview

Calculates the total price for one or more service configurations. Use this endpoint to display accurate pricing to your customers before they confirm a booking. You can optionally include coupon IDs or codes to preview the discounted price.

Endpoint

POST /partners/pricing/calculate-price

Authentication

Requires a valid API Key with the partner_pricing_read permission.

Request Body

{
  "items": [
    {
      "hours": 3,
      "serviceId": "dddddddd-0000-0000-0000-000000000004"
    }
  ],
  "couponIds": [],
  "codes": [],
  "userId": null,
  "phone": null
}
FieldTypeRequiredDescription
itemsarrayYesArray of price calculation items. Min 1 item, max 10 items.
items[].hoursnumberYesService duration in hours. Must be between 1 and 24.
items[].serviceIdUUIDConditionalService ID. Required if packageId is not provided.
items[].packageIdUUIDConditionalPackage ID. Required if serviceId is not provided.
items[].subServiceIdUUIDNoSub-service ID for add-ons.
couponIdsUUID[]NoUp to 2 coupon IDs to preview discounts for.
codesstring[]NoUp to 2 coupon/promo codes to preview discounts for.
userIdUUIDNoCleanLife user ID for coupon validation (required for COMPENSATION coupons).
phonestringNoCustomer phone number for coupon validation (MARKETING coupons).

Example Requests

Single service, no discounts

curl -X POST "https://apiv3.thecleanlife.dev/v1/partners/pricing/calculate-price" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "hours": 3,
        "serviceId": "dddddddd-0000-0000-0000-000000000004"
      }
    ]
  }'

With coupon code preview

curl -X POST "https://apiv3.thecleanlife.dev/v1/partners/pricing/calculate-price" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "hours": 3,
        "serviceId": "dddddddd-0000-0000-0000-000000000004"
      }
    ],
    "codes": ["SUMMER10"]
  }'

Success Response

HTTP Status: 200 OK
{
  "success": true,
  "data": {
    "items": [
      {
        "serviceId": "dddddddd-0000-0000-0000-000000000004",
        "hours": 3,
        "price": 150.00,
        "amount": 135.00,
        "amountPayable": 135.00,
        "currency": "SAR",
        "couponPreview": {
          "applied": true,
          "discount": 15.00
        }
      }
    ],
    "total": 135.00,
    "currency": "SAR"
  }
}
The exact response fields may vary. Fields like couponPreview may be omitted if no coupons are provided or if they apply at the booking invoice level.

Error Responses

HTTP StatusCodeDescription
400VALIDATION_ERRORInvalid request body (missing required fields, out-of-range hours, etc.)
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENMissing partner_pricing_read permission

Notes

  • serviceId and packageId are mutually exclusive within each item — provide exactly one.
  • This endpoint is a preview only — it does not create any record or affect any booking.
  • Coupon applicability at booking time may differ from the preview. Coupons are subject to availability, usage limits, and customer eligibility.
  • For services billed at the invoice level (not at booking), the couponPreview may indicate that the coupon is not applied at booking time.

  • GET /partners/pricing/tiers — Get pricing tiers
  • POST /partners/bookings — Create the actual booking using these pricing parameters