PHP code example of webcraft / lunar-mollie

1. Go to this page and download the library: Download webcraft/lunar-mollie library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webcraft / lunar-mollie example snippets




return [
    // ...
    'types' => [
        'mollie' => [
            'driver' => 'mollie',
        ],
    ],
];

[
    //...
    
    'specify_payment_methods' => true,

    'payment_methods' => [
        'bancontact',
        'creditcard',
        'ideal',
        'paypal',
    ],
]

[
    //...
    
    'payment_paid_route' => 'checkout-success.view',
    'payment_canceled_route' => 'checkout-canceled.view',
    'payment_open_route' => 'checkout-open.view',
    'payment_failed_route' => 'checkout-failure.view',
]

//app/Http/Livewire/CheckoutSuccessPage.php



namespace App\Http\Livewire;

use Livewire\Component;
use Lunar\Facades\CartSession;
use Lunar\Models\Cart;
use Lunar\Models\Order;

class CheckoutSuccessPage extends Component
{
    public ?Cart $cart;

    public Order $order;

    public function mount()
    {
        $this->cart = CartSession::current();

        if (! $this->cart || ! $this->cart->completedOrder) {
            $this->redirect('/');

            return;
        }
        $this->order = $this->cart->completedOrder;

        CartSession::forget();
    }

    public function render()
    {
        return view('livewire.checkout-success-page');
    }
}

//routes/web.php

Route::get('checkout/success', \App\Http\Livewire\CheckoutSuccessPage::class)->name('checkout-success.view');
bash
php artisan vendor:publish --tag=lunar.mollie.config
bash
php artisan vendor:publish --tag=lunar.mollie.components
bash
php artisan vendor:publish --tag=lunar.mollie.translations