Logo

External APIs

Mollie (Payments)

We use the Mollie payment gateway for processing payments in our platform. The integration is done via the mollie/laravel-mollie package. This section will cover how we handle the driver and company checkouts, invoice generation, voucher code application, and handling Mollie webhook notifications. To access mollie, please reach out to our Project Manager to get developer access to the account of BKF.

Driver and Company Checkouts

Our platform differentiates between driver checkouts and company checkouts:

  1. Driver Checkout: When drivers purchase courses for themselves.
  2. Company Checkout: When drivers request course purchases from their connected companies. Companies can then buy all requested courses on behalf of their drivers.

Invoice Generation

Invoices are generated based on the Invoice model. The Invoice model contains all necessary information to create an invoice for a completed purchase.

Voucher Codes

Voucher codes can be applied during the checkout process. A voucher code can either provide a percentage discount or a fixed amount discount on the total cart value. The codes can be generated in the admin panel.

Mollie Webhook Notifications

Mollie sends payment status updates via webhook notifications. Our application listens for these notifications at the /webhooks/mollie endpoint, which is defined in our route file as follows:

Route::name('webhooks.mollie')->post('webhooks/mollie', [CheckoutController::class, 'handleWebhookNotification']);

Handling Webhook Notifications

The CheckoutController handles webhook notifications received from Mollie. It is responsible for processing the payment updates, such as updating the payment status and triggering necessary actions based on the payment status (e.g., activating courses, sending confirmation emails).

The handleWebhookNotification method in CheckoutController takes care of these tasks:

public function handleWebhookNotification(Request $request)
{
    // ...
    // Get the payment ID from the webhook request
    $paymentId = $request->input('id');

    // Retrieve the payment details from Mollie API
    $payment = Mollie::api()->payments->get($paymentId);

    // Process the payment update (e.g., update payment status, activate courses, send emails)
    // ...
}

To work on the Mollie integration or any other part of this platform, developers should have a good understanding of Laravel, Livewire, Alpine.js, and Tailwind CSS, as these technologies are extensively used in the project.

Previous
Color controls