Open WEBronckhorst opened 2 weeks ago
Hi @WEBronckhorst ,
Thanks for the extensive report.
To get started:
Here’s an improved and translated response in Markdown format:
Hi @sandervanhooft,
Thank you for your response!
Here's the information you requested:
Package Version: Using "mollie/laravel-cashier-mollie": "^2.0"
.
Other Dependencies: I’ve attached my full composer.json list below, which includes dependencies like mollie/laravel-mollie, livewire/livewire, and several others.
Custom Modifications: I made a minor adjustment in the Laravel Cashier Mollie package, specifically in FirstPaymentBuilder.ph
public function getMolliePayload()
{
return array_filter(array_merge([
// 'sequenceType' => SequenceType::SEQUENCETYPE_FIRST, // <<
'method' => [], // <<
'customerId' => $this->owner->asMollieCustomer()->id,
'locale' => Cashier::getLocale($this->owner),
'description' => $this->description,
'amount' => money_to_mollie_array($this->actions->total()),
'webhookUrl' => $this->webhookUrl,
'redirectUrl' => $this->redirectUrl,
'metadata' => [
'owner' => [
'type' => $this->owner->getMorphClass(),
'id' => $this->owner->getKey(),
],
],
], $this->options));
}
Mollie Setup: Currently using my own test key and profile until SEPA direct debit is fully activated for the client. This allows me to avoid initiating a payment each time during testing.
Webhook Issue: Payments succeed, but the webhook triggers an error afterward.
Other Dependencies: My project's composer.json
includes the following packages:
"require": {
"php": "^8.2",
"andreiio/blade-iconoir": "^4.3",
"ariaieboy/filament-currency": "^1.9",
"artesaos/seotools": "^1.3",
"calebporzio/sushi": "^2.5",
"carlos-meneses/laravel-mpdf": "^2.1",
"codeat3/blade-grommet-icons": "^1.9",
"codeat3/blade-iconpark": "^1.6",
"codeat3/blade-phosphor-icons": "^2.2",
"codeat3/blade-teeny-icons": "^1.10",
"consoletvs/charts": "^6.7",
"davidhsianturi/blade-bootstrap-icons": "^1.5",
"dymantic/laravel-instagram-feed": "^3.3",
"filament/filament": "^3.2",
"filament/spatie-laravel-media-library-plugin": "^3.2",
"intervention/image": "^3.7",
"intervention/image-laravel": "^1.3",
"laravel/framework": "^11.9",
"laravel/horizon": "^5.27",
"laravel/tinker": "^2.9",
"league/html-to-markdown": "^5.1",
"livewire/livewire": "^3.0",
"m-paap/veloyd-api": "^0.0.2",
"mailersend/laravel-driver": "^2.6",
"mollie/laravel-cashier-mollie": "^2.0",
"mollie/laravel-mollie": "^3.0",
"mollie/mollie-api-php": "^2.67",
"mpdf/mpdf": "^8.2",
"rawilk/laravel-printing": "^3.0",
"sentry/sentry-laravel": "^4.9",
"simplesoftwareio/simple-qrcode": "~4",
"spatie/flysystem-dropbox": "^3.0",
"spatie/image": "^3.7",
"spatie/laravel-backup": "^9.0",
"spatie/laravel-login-link": "^1.2",
"unisharp/laravel-filemanager": "dev-master",
"whitecube/laravel-cookie-consent": "^1.2"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.2",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"pestphp/pest": "^3.3",
"pestphp/pest-plugin-laravel": "^3.0"
}
Thank you in advance for your help in resolving this!
Best regards,
Let me know if this version captures everything accurately or if you'd like any adjustments.
something went wrong with my last pee it has not been resolved yet
Thanks @WEBronckhorst ,
That leaves these questions open:
what specific (2.x.y) package version are you using?
You can find the installed package version using composer show mollie/laravel-cashier-molllie
have you recently changed Mollie environments, i.e. from test to live, or changed the Mollie profile key for another profile's?
for these specific resources, what is the Mollie dashboard telling you about the history?
Issue: Webhook Handling Error in Laravel Cashier Mollie
Description
When handling the webhook for first payments, the webhook fails and results in an internal server error.
Error Details
Laravel\Cashier\Exceptions\InvalidMandateException
Request Details
POST /webhooks/mollie/first-payment
content-length
: 22user-agent
: RapidAPI/4.2.6 (Macintosh; OS X/15.1.0) GCDHTTPRequestconnection
: closehost
: gaia.staging.nucontent-type
: application/json; charset=utf-8Application Details
\Laravel\Cashier\Http\Controllers\FirstPaymentWebhookController@handleWebhook
webhooks.mollie.first_payment
Database Queries
SELECT * FROM customers WHERE customers.id = 2 LIMIT 1
(2.6 ms)SELECT * FROM payments WHERE mollie_payment_id = 'tr_xxxxxxxx' LIMIT 1
(0.58 ms)UPDATE customers SET mollie_mandate_id = NULL, customers.updated_at = '2024-11-04 17:05:00' WHERE id = 2
(0.57 ms)Steps to Reproduce
/webhooks/mollie/first-payment
endpoint.id
in the request body, such as"id": "tr_xxxxxxxx"
.Expected Behavior
The webhook should be handled without any exceptions or errors, and the payment should be processed correctly.
Actual Behavior
An
InvalidMandateException
is thrown, resulting in an internal server error.Possible Related Issues
payments
andcustomers
tables have consistent data related to the givenmollie_payment_id
.Suggested Solution
Investigate why the
mollie_mandate_id
is set toNULL
during the process and ensure that valid mandates are present for the customer.