• Resolved mcdeth

    (@mcdeth)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mcdeth

    (@mcdeth)

    Also, once everthing enabled I couldn’t see express checkout button anyway, turns out it was because client id was missing (Even though normal payment worked always without it, so its very easy to miss, worth adding a notice).

    Another good thing would be to verify length of client id (I thought it’s k*** number for a moment)

    • This reply was modified 3 months ago by mcdeth.
    Plugin Support awaatklarna

    (@awaatklarna)

    Hi @mcdeth,

    It appears you might be on an old version of the plugin. The webhook setting is not necessary unless you are integrating via an acquiring partner, so to avoid confusion we have hidden that setting in our later versions of the plugin. If that is the case, no webhook is needed. You should be good to go by just enabling Express Checkout and filling in the client ID. For that we always recommend this guide on how to retrieve client ID and set Express Checkout up in woocommerce.

    Thank you for letting us know!
    Kind Regards,
    Awa from Klarna

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.