milzer / checkout
the checkout package for the Nezasa checkout system
Installs: 138
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 3
pkg:composer/milzer/checkout
Requires
- php: ^8.3.0
- azimkordpour/power-enum: ^1.2
- livewire/livewire: ^3.6
- saloonphp/saloon: ^3.0
- spatie/laravel-data: ^4.15
- stripe/stripe-php: ^19.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18.1
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.3
- pestphp/pest: ^3.5.1
- pestphp/pest-plugin-type-coverage: ^3.1
- phpstan/phpstan: ^2.1
- rector/rector: ^2.1
- spatie/phpunit-snapshot-assertions: ^5.2
- symfony/var-dumper: ^7.1.6
- dev-main
- v1.0.42
- v1.0.41
- v1.0.40
- v1.0.39
- v1.0.38
- v1.0.37
- v1.0.36
- v1.0.35
- v1.0.34
- v1.0.33
- v1.0.32
- v1.0.31
- v1.0.30
- v1.0.29
- v1.0.28
- v1.0.27
- v1.0.26
- v1.0.25
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-codex/write-tests-for-all-features
- dev-MLZ-3093_checkout-app-Remove-disclaimer-add-dynamic-one-for-in-destination-costs_Mojtaba-Kordpour
- dev-MLZ-2574_Checkout-App-for-Cuba-Travel-Services_Mojtaba-Kordpour
This package is auto-updated.
Last update: 2025-12-17 13:45:31 UTC
README
This Laravel package provides a complete checkout process for the Nezasa web application.
It integrates with Nezasa’s APIs to handle all the necessary steps for booking an itinerary, ensuring a smooth and reliable booking experience.
Requirements
Make sure your environment meets the following requirements:
- PHP 8.3 or higher
- MySQL 8
- Laravel 11 or higher
- Redis (optional)
The package relies heavily on cache** and queues to ensure better performance.
It is highly recommended to use Redis as both the queue driver and cache driver for optimal speed and reliability.
Installation & Setup
This package is already installed and pre-configured in the checkout-main-app repository.
The repository also includes useful configurations and dependencies to help you set up and run a Laravel application faster:
- Vite configuration for asset bundling and front-end builds
- Laravel Horizon for managing and monitoring queues
With these configurations in place, you can quickly get started with the Nezasa checkout.
Setup on Nezasa instance
After deploying the laravel application, you need to chanege the following settings on your Nezasa instance:
- Go to Nezasa cockpit
- Then to Settings
- Select your instance
- Click on the checkout tab
- Scroll down to custom checkout
- Change configuration to your laravel application url like
http://your-domain.com/checkout/details?checkoutId=${CHECKOUT_ID}&itineraryId=${ITINERARY_ID}&origin=${ORIGIN}
Features of the Package
Below is a list of the key features included in this package:
- Itinerary Summary – Summarizes itinerary details such as travel dates, travelers, and pricing.
- Contact Form Handling – Customizes the display and validation of contact input fields based on the Nezasa API.
- Traveler Form Handling – Customizes the display and validation of traveler input fields according to the Nezasa API. The page dynamically adapts to the number of rooms and travelers.
- Country List Integration – Displays the list of countries retrieved from the Nezasa API.
- Availability Check – Automatically checks itinerary availability once the required data is provided, working seamlessly in the background.
- Promotional Codes – Allows applying promotional codes to a booking through the Nezasa API.
- Additional Services – Supports adding and removing extra services in a booking using the Nezasa API.
- Payment Provider Integration – Provides a flexible design to integrate different payment providers into the project. (Currently, only Oppwa is supported.)
- Transaction Handling – Initiates and stores transaction data via the Nezasa API.
- Booking Confirmation – Manages booking confirmation and displays the booking reference.
- Error & Exception Handling – Handles errors gracefully, with user-friendly messages and fallback options.
- Save Booking State – Preserves the current state of the booking process. For example, if a user leaves the page while entering traveler details, all entered data is stored and restored the next time they return.
- Multi-language Support – Includes localization for English, German, French, and Spanish, with easy extensibility for additional languages.
- Configuration Options – Offers flexible configuration to adapt the package to project needs, such as updating payment provider credentials.
- Best Practices – Follows industry best practices for security, performance, and code quality, ensuring a robust and maintainable package.
Setting up Configuration
Add the following variables to the .env file of your Laravel application:
# Nezasa API CHECKOUT_NEZASA_BASE_URL="nezasa trip builder api url" CHECKOUT_NEZASA_USERNAME="username" CHECKOUT_NEZASA_PASSWORD="password"
Oppwaa payment provide
You need set up theses variables in the .env file of your Laravel application:
# Oppwa Payment Provider CHECKOUT_WIDGET_OPPWA_ACTIVE=true CHECKOUT_WIDGET_OPPWA_NAME='Oppwa' CHECKOUT_WIDGET_OPPWA_ENTITY_ID="*******" CHECKOUT_WIDGET_OPPWA_TOKEN="*******"
This a test card number:
4200000000000091
Enter the remaining data as you wish. You will find the other card number for different situations in this link: https://axcessms.docs.oppwa.com/tutorials/threeDSecure/TestingGuide
Stripe payment provide
You need set up theses variables in the .env file of your Laravel application:
# Strip Payment Provider CHECKOUT_STRIPE_ACTIVE=true CHECKOUT_STRIPE_NAME='Stripe' CHECKOUT_STRIPE_SECRET_KEY="your stripe secret key"
This a test card number:
4242424242424242
Enter the remaining data as you wish. You will find the other card number for different situations in this link: https://docs.stripe.com/testing#cards
Computop payment provide
You need set up theses variables in the .env file of your Laravel application:
# Strip Payment Provider CHECKOUT_COMPUTOP_ACTIVE=true # false for production CHECKOUT_COMPUTOP_TEST_MODE=true CHECKOUT_COMPUTOP_NAME='Computop' CHECKOUT_COMPUTOP_USERNAME='your username' CHECKOUT_COMPUTOP_PASSWORD='your password'
This a test card number:
//Mastercard 5555555555554444
Enter the remaining data as you wish. You will find the other card number for different situations in this link: https://developer.computop.com/display/EN/Test+credit+card
New payment method
One of the main goal of this package is to make it easy to add new payment methods. You need to create a class that implements the related interfaces for a new payment method. All payment classes must implement the PaymentContract interface.
<?php declare(strict_types=1); namespace Nezasa\Checkout\Payments\Contracts; use Illuminate\Http\Request; use Nezasa\Checkout\Dtos\BaseDto; use Nezasa\Checkout\Integrations\Nezasa\Dtos\Payloads\CreatePaymentTransactionPayload as NezasaPayload; use Nezasa\Checkout\Payments\Dtos\PaymentInit; use Nezasa\Checkout\Payments\Dtos\PaymentOutput; use Nezasa\Checkout\Payments\Dtos\PaymentPrepareData; use Nezasa\Checkout\Payments\Dtos\PaymentResult; interface PaymentContract { /** * Returns whether the payment gateway is active. */ public static function isActive(): bool; /** * Returns the name of the payment gateway. * * Important: This name will be used to identify the payment gateway in the checkout process * and it has to be unique, please check the previous gateways' names, */ public static function name(): string; /** * Prepares the payment initiation process. */ public function prepare(PaymentPrepareData $data): PaymentInit; /** * Returns the payload required for creating a transaction in Nezasa. */ public function makeNezasaTransactionPayload(PaymentPrepareData $data, PaymentInit $paymentInit): NezasaPayload; /** * Handles the callback from the payment gateway. * * @param array<string, mixed>|BaseDto $persistentData */ public function verify(Request $request, array|BaseDto $persistentData): PaymentResult; /** * Shows the result of the payment process to the user. */ public function output(PaymentResult $result, PaymentOutput $output): PaymentOutput; }
If your payment is a redirect payment, you have to implement the RedirectPaymentContract interface. RedirectPaymentContract inherits from PaymentContract.So you have to implement all methods of PaymentContract and RedirectPaymentContract.
<?php declare(strict_types=1); namespace Nezasa\Checkout\Payments\Contracts; use Illuminate\Support\Uri; use Nezasa\Checkout\Payments\Dtos\PaymentInit; interface RedirectPaymentContract extends PaymentContract { /** * The url to the payment gateway. */ public function getRedirectUrl(PaymentInit $init): Uri; }
if your payment is an iframe or widget,... etc that loads inside the application, you have to implement the WidgetPaymentContract interface. WidgetPaymentContract inherits from PaymentContract.So you have to implement all methods of PaymentContract and WidgetPaymentContract.
<?php declare(strict_types=1); namespace Nezasa\Checkout\Payments\Contracts; use Nezasa\Checkout\Payments\Dtos\PaymentAsset; use Nezasa\Checkout\Payments\Dtos\PaymentInit; interface WidgetPaymentContract extends PaymentContract { /** * Returns the assets required for the payment initiation process. */ public function getAssets(PaymentInit $paymentInit): PaymentAsset; }
After defining the class, you need to add them to the config/checkout.php file:
'payment' => [ StripeGateway::class, ],
Other configuration options
You can also configure other options like max child age:
# the default value is 17 MAC_CHILD_CHECKOUT_AGE=16
Useful commands:
⚡️ Install the package using Composer:
composer milzer/checkout
Then you need to run the following command to publish the migration file:
php artisan vendor:publish --tag=checkout-migrations
And execute the migration:
php artisan migrate
🧹 Keep a modern codebase with Pint:
composer lint
✅ Run refactors using Rector
composer refactor
⚗️ Run static analysis using PHPStan:
composer test:types
✅ Run unit tests using PEST
composer test:unit
🚀 Run the entire test suite:
composer test
This package was created by milzer GmbH under the MIT license.