Closed Dennise89 closed 6 months ago
In the read.me there is a line: Looking for a complete recurring billing solution? Take a look at laravel/cashier-mollie instead.
Is that what you are looking for? because Subscription is recurring billing.
In the read.me there is a line: Looking for a complete recurring billing solution? Take a look at laravel/cashier-mollie instead.
Is that what you are looking for? because Subscription is recurring billing.
Yes I know that package, but that's not useable with Mollie Connect. It only works with a single mollie key. I am using Mollie Connect to connect to multiple profiles/accounts. Thanks for the link though.
Hi @Dennise89,
sorry for taking so long!
The subscription endpoint uses the same webhook mechanism as for payments. The only difference with subscriptions is that when you receive the payment from the API, it will contain subscription specific information, such as the subscriptionId
(s. https://docs.mollie.com/reference/v2/payments-api/get-payment#response-parameters-for-recurring-payments).
$mollieSubscription = Mollie::api()
->subscriptions
->create(...);
// save to your database
$subscription = new Subscription;
$subscription->mollie_id = $mollieSubscription->id;
$subscription->save();
Route::post('subscriptions/webhooks', function ($request) {
$payment = Mollie::api()
->payments
->get($request->id);
$subscription = Subscription::where('mollie_id', $payment->subscriptionId)->first();
// handle the payment
});
Let me know if you need further help!
Would be nice if there was an example of a webhook for a subscription as well. Because it's different than a normal payment or first payment webhook.