Klarna's API Integration is lightweight API that's integrated with the Klarna gateway for a simple checkout and webhook handling
php > 8.2
composer
Docker & Daemon
Klarna Account
- Clone the project
https://github.com/EssaadaniYounes/klarna-s-integration.git- Install and update packages
composer update- Create .env file and copy the content of the .env.example into it
cp .env.example .envReplace the variables with your values. Preferably before you do this to have a Klarna account and grap the username & password from it.
you can found them here
Klarna Users.
Run the following command to create MySQL and your app containers
./vendor/bin/sail up -dProbably in windows you'll get this error
🛑/bin/bash: C:\..\vendor\bin\/../laravel/sail/bin/sail: No such file or directoryTo solve it use this command instead
bash ./vendor/laravel/sail/bin/sail up -dNow the images are pulled and the containers are running.
Use this command to run the migration and seeders
./vendor/bin/sail artisan migrate:fresh --seed
If it say Sail isn't running this probably only for windows users. So go to your docker desktop and containers tab. Expand the laravel.test container and go to Exec tab.
then run
php artisan migrate:fresh --seed
Now everything should work fine visit http://localhost:8000/api/v1/products and you can see a list of four product!
If you want to test only the API
In your terminal run the following command
./vendor/bin/sail artisan test
If it didn't work again for windows just follow pervious steps and write the php artisan test command and see tests running.
In the other hand to test it with the front-end we require to clone this Project. and follow it's instruction to run it.