Jump to content

Stripe official module wrong expected webhook url


Alex-

Recommended Posts

Screenshot2024-04-06at15-.thumb.png.4d9070fcb108a35cefb1a41dff9b17c7.png

Hello,

After installing and configuring everything in live mode, the module Stripe Official keeps expecting and force to push the wrong webhook url :
Expected webhook URL : https://www.domain.module/stripe_official/webhook

but it should be : https://www.domain.fr/module/stripe_official/webhook ; like fixed on the Stripe.com > webhooks
The module wants to update to domain.module/stripe instead of domain.fr/module

I tried to look everywhere, remade the webhook, update the new webhook id in the db but it keeps asking the same wrong url and unfortunately all the orders made are not created in the BO, even if the payments have been received.

The domain of the shop on prestashop is correct btw

Shop url :https://www.domain.fr
Physical url : /

Thank you for your help.

 

Edit 1 : I found out the issue might be caused by this function in the file /stripe_official.php

/**
     * get webhook url of stripe_official module
     *
     * @return string
     */
    public static function getWebhookUrl()
    {
        $context = Context::getContext();
        $locale = $context->language->iso_code;

        $url = $context->link->getModuleLink(
            'stripe_official',
            'webhook',
            [],
            true,
            null,
            Configuration::get('PS_SHOP_DEFAULT')
        );

        return str_replace($locale . '/', '', $url);
    }

By changing this function by :

  /**
     * get webhook url of stripe_official module
     *
     * @return string
     */
    public static function getWebhookUrl()
{
    return 'https://www.domain.fr/module/stripe_official/webhook';
}

Or by :

public static function getWebhookUrl()
{
    $context = Context::getContext();

    // Obtenir l'URL générée dynamiquement
    $url = $context->link->getModuleLink(
        'stripe_official',
        'webhook',
        [],
        true,
        null,
        Configuration::get('PS_SHOP_DEFAULT')
    );

    return $url;
}

I don't have the message shown in the backoffice anymore. I'm not sure if the webhook will works properly though.

Edited by Alex- (see edit history)
  • Like 1
Link to comment
Share on other sites

Thanks for your reply.

I fixed the issue myself with modification I have posted in my previous message in the edit. The function use "$locale" to get the iso code "fr" to remove from the URL /fr/ for example but it simply removes the "'.fr/".

It's actually not an issue with Stripe but with the function in the module. As the website is in french "fr" and the domain extension is ".fr", the function truncate this part from the webhook URL.

By changing the original function with the code I've modified, fix the issue.

Link to comment
Share on other sites

  • 2 months later...

@Alex- Thanks for the fix! The Stripe support for Prestashop does not seem very keen to answer any questions...

Not sure if you had the same issue but I have also tried to enable the Express Checkout Buttons on product and cart pages but nothing is loading although the hooks are correctly inserted in the template.

Link to comment
Share on other sites

  • 2 weeks later...

I have the same problem with some of our multistore sites. We also have the problem nrsoft mentioned.

Also webhooks are not working they give response 403 status forbidden for the shops that have correct URL in webhooks. Despite of the problems with webhooks the orders seem to come through to back office just fine.

Link to comment
Share on other sites

  • 1 month later...

I have the same problem as the author of the post. After updating the module to 3.3.2, the "Integrated payment form" option stopped working. Payment methods do not load. It only works in the "Redirect to Stripe" option.
I manually changed the webook from "domain.module" to "domain.com", but unfortunately it did not help. Does anyone have a similar problem and know how to solve it?

Link to comment
Share on other sites

  On 8/2/2024 at 10:22 AM, BuddyTheElf said:

have the same problem as the author of the post. After updating the module to 3.3.2, the "Integrated payment form" option stopped working. Payment methods do not load. It only works in the "Redirect to Stripe" option.

Expand  

Even with the same problem you need to give more details on the server, the store itself, update history.

Link to comment
Share on other sites

  • 2 months later...
  On 8/2/2024 at 10:22 AM, BuddyTheElf said:

I have the same problem as the author of the post. After updating the module to 3.3.2, the "Integrated payment form" option stopped working. Payment methods do not load. It only works in the "Redirect to Stripe" option.
I manually changed the webook from "domain.module" to "domain.com", but unfortunately it did not help. Does anyone have a similar problem and know how to solve it?

Expand  

Hi, have you found a solution?

Link to comment
Share on other sites

  • 4 weeks later...

Two things that need checking;

- Make sure PS Checkout is installed and enabled otherwise the payments don’t show for stripe

- Check the api key and the permissions as the required permissions aren’t set correctly when connecting the stripe plugin. You can see in the stripe workbench, some requests to customer are denied

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...