# Website booking payments

Website bookings have a 24-hour deadline from creation to receive the required advance. The advance is calculated on the server using Business Settings → Booking Rules and saved on the booking, so later setting changes do not change the original requirement. Paying the advance confirms the booking and removes the deadline; customers may pay their remaining balance later.

Customers can choose **Book now, pay within 24 hours** after signing in. **My Bookings** in the account menu opens `/account/bookings`, where customers see only their own bookings, the deadline, and advance/full-balance payment options. Guests can still use immediate checkout when the existing sign-in setting permits it. Guests should register or sign in with their booking email to access their bookings afterwards.

In the admin panel, open **Bookings → View → Receive Payment**. Select the receiving account and method, enter the amount, reference and notes. Website bookings must receive at least the outstanding required advance initially. Offline bookings support smaller partial payments. Receipts update paid/due balances, payment history, the payment ledger and a balanced journal voucher. Repeat submissions of the same receipt and repeated gateway callbacks do not post money twice. The existing accounting customer-payment form also updates the linked booking.

Unpaid expired bookings remain visible as cancelled for history. Their original quote is retained separately; sales, subtotal, total, tax, commission and outstanding balance become zero. They cannot be paid or reopened by editing. Advance-paid bookings and admin-created bookings without a website deadline are not expired. Existing unpaid pending website checkouts with gateway transactions receive a deadline based on their original creation time when the migration runs.

Verified late payments and excess payments are retained as gateway transactions marked **Requires review**, and do not confirm the cancelled booking or post its quote as revenue. The payment result page asks the customer to contact the team. Review these transactions in the booking's payment history.

## Deployment

Run in the backend directory:

```sh
php artisan migrate --force
php artisan db:seed --class=BookingPaymentSetupSeeder --force
php artisan optimize:clear
php artisan bookings:expire-unpaid
```

The incremental seeder adds the Receive Payment permission to super-admin and roles already allowed to edit bookings. It preserves other grants.

Laravel's scheduler must run every minute for unattended cancellation. Configure the server cron using its actual PHP binary and application path:

```cron
* * * * * cd /path/to/lets_tour_admin && /usr/bin/php artisan schedule:run >> /dev/null 2>&1
```

The command `bookings:expire-unpaid` is scheduled every minute with overlap prevention. Customer booking reads/payment attempts and admin booking/dashboard/report views also process overdue bookings. Payment checks are repeated while holding a database row lock. Deadlines are communicated as ISO timestamps with timezone information.

Build and deploy the frontend using `npm run build`. The existing configured and enabled payment gateways are shared by immediate checkout and customer-panel payment; manual admin receipts work without online gateways.
