If you're looking for a guide on how to create your own Payment Driver, or for a more in-depth look at how they work, head over to the extending section.
Lunar takes a driver based approach with Payments, meaning you are free to use either add ons to support the provider you wish to use, or you can create your own to meet your exact needs.
All configuration for payments is located in
config/lunar/payments.php. Here you can specify different types of payments and the driver each one should use.
<?php return [ 'default' => env('PAYMENTS_TYPE', 'offline'), 'types' => [ 'cash-in-hand' => [ 'driver' => 'offline', 'released' => 'payment-offline', ], 'card' => [ 'driver' => 'stripe', 'released' => 'payment-received', ], ], ];
To use a payment driver, you need to pass the type of payment you wish to use, this will then return an instance of the driver.
$driver = \Lunar\Facades\Payments::driver('card');
We can then set the cart.
Set any additional data that the driver may need.
$driver->withData([ 'payment_token' => $token, ]);
Finally, we can authorize the payment.