webhook fails to create bug report
-
Hi, I found an issue regarding express checkout setup.
Environment:
- WordPress 6.9.1
- WooCommerce 10.5.3
- Klarna Payments for WooCommerce 4.6.1
- PHP 8.2.30
- Live mode
Issue:
When I go to WooCommerce > Settings > Payments > Klarna Payments > Express Checkout and click Create Webhook, the webhook is not created.What happens:
- The admin request reaches WordPress correctly.
- The nonce is valid.
- The plugin handler runs.
- It fails at the signing key step with Could not create signing key.
- No kec_signing_key or kec_webhook option is saved.
Root cause:
In the KEC notification request base URL, live mode generates an invalid URL with a double dot:https://api-global..klarna.com/v2/notification/signing-keys
This appears to come from:
dependencies/krokedil/klarna-express-checkout/src/Requests/Base.php
Current logic:
$environment = $testmode ? 'test' : ''; return "https://api-global.{$environment}.klarna.com/";In live mode, this becomes:
https://api-global..klarna.com/
Expected live URL:
https://api-global.klarna.com/Suggested fix:
Either:return $testmode ? 'https://api-global.test.klarna.com/' : 'https://api-global.klarna.com/';or:
$environment = $testmode ? '.test' : ''; return "https://api-global{$environment}.klarna.com/";Temporary workaround:
I added a WordPress filter that rewrites only the malformed URL from:https://api-global..klarna.com/
to:
https://api-global.klarna.com/
After that, Create Webhook worked correctly.
You must be logged in to reply to this topic.