Skip to content

mustafaHgad/paytask

Repository files navigation

laravel-payment-task

Small Laravel 11 project implementing the interview task: pay an order and add points to the user.

How to run

  1. Clone repo
  2. Copy .env.example to .env and set DB credentials
  3. Install composer dependencies:
composer install
php artisan key:generate
php artisan migrate --seed
php artisan serve

4. Test the endpoint with Postman or curl:

POST http://127.0.0.1:8000/api/orders/{2}}/pay

Body:
{
    "user_id": 1
}

Response will be like
{
  "message": "Order paid successfully.",
  "order": {
    "id": 2,
    "user_id": 1,
    "total_price": "40.50",
    "status": "paid",
    "created_at": "2025-11-10T00:00:00.000000Z",
    "updated_at": "2025-11-10T00:00:00.000000Z"
  },
  "user_points": 50.50
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages