EstateHub

Customer Purchase APIs

Base URL: http://localhost:8000/api/v1
Prefix: /customers
Auth: Bearer token
Headers: Content-Type: application/json


1. Reserve a Property

Creates the property purchase reservation and submits the configured reservation bank-transfer payment for verification.

POST/customers/properties/{property_id}/reserve/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "buyer_message": "I would like to reserve this property.",
  "transaction_id": "BFT-20260908-987654",
  "payment_proof_url": ""
}

Success Example

JSON
{
  "success": true,
  "message": "Reservation payment submitted for verification.",
  "data": {
    "purchase": {
      "id": "4de62c56-10d6-4c98-9684-f70d9a828711",
      "status": "requested",
      "reservation_amount": "12500.00",
      "reservation_percent": 2,
      "currency": "USD"
    },
    "payment": {
      "id": "d0eb5f70-8c6b-43eb-a680-e82e3098f96f",
      "payment_for": "purchase_reservation",
      "method": "bank_transfer",
      "status": "submitted",
      "transaction_id": "BFT-20260908-987654",
      "payment_proof_url": ""
    },
    "next_action": "Your reservation payment is awaiting admin verification."
  }
}

Notes

  • buyer_message is optional.

  • transaction_id is required.

  • payment_proof_url is optional; it may contain a receipt image/PDF URL when available.

  • The server calculates the reservation amount from the administrator purchase reservation setting: percentage or fixed amount, defaulting to 2% of the property price.

  • The server creates the payment as submitted; the buyer then sees the pending-verification screen.

  • Admin or webhook verification changes payment to verified, purchase to reserved, and property to reserved.


Common Success Format

JSON
{
  "success": true,
  "message": "Request completed successfully.",
  "data": {}
}

Common Error Format

JSON
{
  "success": false,
  "message": "Property is no longer available for reservation.",
  "data": {}
}

Purchase Remaining Payment API

Base URL: http://localhost:8000/api/v1
Prefix: /customers
Auth: Bearer token with customer role
Headers: Content-Type: application/json


1. Submit Purchase Remaining Payment

Submits a full or partial bank-transfer payment against the outstanding balance of a property purchase.

POST/customers/remaining-payments/purchases/{purchase_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "amount": "250000.00",
  "transaction_id": "BFT-20260915-123456",
  "payment_proof_url": "https://example.com/payment-proofs/BFT-20260915-123456.jpg"
}

Success Example

JSON
{
  "success": true,
  "message": "Remaining purchase payment submitted for verification.",
  "data": {
    "purchase_id": "9a76cc16-a995-47e5-853e-a59643464ddb",
    "payment": {
      "id": "3eca5e0f-f22e-46aa-8794-5a703cd3cb73",
      "payment_for": "property_purchase",
      "amount": "250000.00",
      "currency": "USD",
      "method": "bank_transfer",
      "status": "submitted",
      "transaction_id": "BFT-20260915-123456",
      "payment_proof_url": "https://example.com/payment-proofs/BFT-20260915-123456.jpg",
      "created_at": "2026-09-15T10:30:00Z"
    },
    "total_amount": "625000.00",
    "verified_amount": "12500.00",
    "remaining_amount": "612500.00",
    "next_action": "This payment is awaiting admin verification."
  }
}

Notes

  • purchase_id comes from data.purchase.id returned by the purchase reservation API.

  • amount must be at least 1.00.

  • amount may represent either a partial payment or the complete outstanding balance.

  • transaction_id is required and may contain up to 120 characters.

  • payment_proof_url is optional but must be a valid URL when supplied.

  • The payment method is always bank_transfer.

  • The reservation payment must be verified before a remaining payment can be submitted.

  • Only the buyer associated with the purchase can submit its payment.

  • The purchase must have one of these statuses: reserved, agreement_pending, or payment_pending.

  • Only one pending or submitted remaining payment is allowed at a time.

  • The submitted amount cannot exceed the outstanding balance.

  • verified_amount includes verified reservation and purchase payments.

  • remaining_amount is the outstanding balance before the newly submitted payment is verified.

  • A submitted payment does not reduce the verified outstanding balance until an admin verifies it.

  • The purchase status changes to payment_pending.

  • Admins receive a payment-verification notification.

  • A successful request returns HTTP 201 Created.

  • Possible errors include:

    • 400 Bad Request when validation fails.

    • 401 Unauthorized when authentication is missing or invalid.

    • 403 Forbidden when the authenticated user is not a customer.

    • 404 Not Found when the purchase does not exist or belongs to another customer.


Common Success Format

JSON
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {}
}

Common Error Format

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "field_name": [
      "Error description."
    ]
  }
}