We're having problems creating a webhook service for a payment using "Mollie".
Here's the webhook code
public function premiumPaymentCheck(Request $request)
{
$payment = Mollie::api()->payments()->get(Input::get('id'));
$metadata = $payment->metadata;
$user_id = $metadata->user_id;
if ($payment->isPaid()) {
$user = User::find($user_id);
$user->mollie_customerID = $metadata->customerId;
$user->premium = true;
$user->premium_type = "premium";
$user->subscribed = true;
$user->premium_expire_date = Carbon::now()->addMonth();
$user->save();
}
}
Everything works, except for the premium_expire_date
. From what I understand, it should add 1 month from the payment time (the time the payment calls the webhook, so Carbon::now()), but the dates never match.It's always a random date that doesn't really make sense.
Some of the dates are correct, but most of them seem completely of. Any Idea what this might be?
There is no problem with carbon. Check your config/app.php file for timezone property.
'timezone' => env('APP_TIMEZONE', 'UTC'),
Timezone is currently:
'timezone' => 'UTC',
We are in Belgium/Brussels. So should it be:
'timezone' => env('Europe/Brussels', 'UTC')
Alternately it could be:
'timezone' => 'Europe/Brussels',
Thanks for the help!