You might recall we wrote about Subscription billing with Laravel Cashier for Mollie a while back during the early stages of development. We have good news: Laravel Cashier for Mollie officially released version 1.0 earlier this week!
Ready to rock & roll!
Here is laravel/cashier-mollie v1.https://t.co/aAw7VNCHYR
Enjoy@laravelphp @MolliePayments
— Sander van Hooft (@SandervHooft) September 3, 2019
Laravel Cashier for Mollie is a first-party Laravel Cashier package—created and maintained by Sander van Hooft —which provides an expressive, fluent interface to subscriptions using Mollie’s billing services. This package is a massive win for working with European customers.
You can learn more about this package, get full installation instructions, and view the source code on GitHub at laravel/cashier-mollie.
To give you a quick preview of the ease of working with this package here’s a basic controller example for creating a subscription from the readme:
namespace App\Http\Controllers;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
class CreateSubscriptionController extends Controller
{
/**
* @param string $plan
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(string $plan)
{
$user = Auth::user();
$name = ucfirst($plan) . ' membership';
if(!$user->subscribed($name, $plan)) {
$result = $user->newSubscription($name, $plan)->create();
if(is_a($result, RedirectResponse::class)) {
return $result; // Redirect to Mollie checkout
}
return back()->with('status', 'Welcome to the ' . $plan . ' plan');
}
return back()->with('status', 'You are already on the ' . $plan . ' plan');
}
}
We’d like to congratulate Sander and the Laravel team for this exciting accomplishment!
0 comments:
Post a Comment
Thanks