unable to create webhook url in paypal smart payment buttons

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hi,
I'm using a clean installation of the latest v4.30 nopcommerce and I am trying to set up paypal smart payment buttons (the default nopcommerce version of the plugin that comes prepackaged with the installation), butwhen I edit the payment config, I get the following messages at the top:

-Webhook was not created, so some functions may not work correctly (see details in the log) (orange background)
-The specified credentials are valid (green background)
-The plugin has been updated successfully. (green background)



the log displays the following information:
Payments.PayPalSmartPaymentButtons error:
One or more errors occurred. ({"name":"VALIDATION_ERROR","message":"Invalid data provided","debug_id":"5e11f5b073fc0","information_link":"https://developer.paypal.com/docs/api/webhooks/#errors","details":[{"field":"url","location":"body","issue":"Not a valid webhook URL"}],"links":[]})
Full message  
System.AggregateException: One or more errors occurred. ({"name":"VALIDATION_ERROR","message":"Invalid data provided","debug_id":"5e11f5b073fc0","information_link":"https://developer.paypal.com/docs/api/webhooks/#errors","details":[{"field":"url","location":"body","issue":"Not a valid webhook URL"}],"links":[]})
---> BraintreeHttp.HttpException: {"name":"VALIDATION_ERROR","message":"Invalid data provided","debug_id":"5e11f5b073fc0","information_link":"https://developer.paypal.com/docs/api/webhooks/#errors","details":[{"field":"url","location":"body","issue":"Not a valid webhook URL"}],"links":[]}
   at BraintreeHttp.HttpClient.Execute[T](T req)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Nop.Plugin.Payments.PayPalSmartPaymentButtons.Services.ServiceManager.HandleCoreRequest[TRequest,TResult](PayPalSmartPaymentButtonsSettings settings, TRequest request)
   at Nop.Plugin.Payments.PayPalSmartPaymentButtons.Services.ServiceManager.<>c__DisplayClass29_0.<CreateWebHook>b__0()
   at Nop.Plugin.Payments.PayPalSmartPaymentButtons.Services.ServiceManager.HandleFunction[TResult](PayPalSmartPaymentButtonsSettings settings, Func`1 function)


does anyone know what the webhook url should be? I can just drop this straight into paypal if I knew what it was supposed to be.

BTW, I am using the admin on the store url, not a test url, and there are no firewall issues that I have found.
3 years ago
things to check:

sandbox checkbox in configuration : using sandbox creds with staging, and production creds with production

hit F12 to open your browser devtools, any javascript errors in the console?

I believe that plugin requires the order total to be sent which may not be on the page where the buttons render : Settings > Order settings > Checkout section > check 'Order totals on payment info tab"
3 years ago
Hi

I have exactly the same problem.  The paypal end is setup OK.  The plugin doesn't specify a webhook URL on the config page, but does give the error you describe when you click save.  As this is a NopCommerce builtin plugin I would hope one of the team could explain the error. Let's see....

Mark
3 years ago
Hi.
Webhook is created based on your store URL when you save the plugin configuration. The error text contains 'debug_id', you can contact PayPal support and give them this id, they'll answer you what exactly is wrong with your webhook URL and why it's not valid.
3 years ago
Hi Maksim

Thanks for the reply.  I can see there is a debug_id containing a 12 digit hex number and will try Paypal support.

I think they may respond with "you have no web hooks defined" because there aren't any in my paypal account.  You can't create a web hook unless you have a URL to send it to and we don't have that information from the plugin.  The plugin can't create one as it has no credentials to do that, so personally I think this is a plugin issue rather than a Paypal one.

Regards
Mark
3 years ago
Thanks for replying.

The reply about 'order id' is not related to my issue because my error message appears when trying to set up the payment config in the admin system for the first time, so is not related to any order.

I've tried both in sandbox mode and live mode with the relevant credentials with the same result. If you use the live credentials with the 'use sandbox' checkbox checked it tells you its wrong at the top, so I know the client ID and secret I am using are correct.

I ran the page again but this time attached my VS solution to the process so I could inspect the request and response objects (putting a break point on line 205 in the /plugins/nop.plugin.payments.paypalsmartpaymentbuttons/services/servicemanager.cs class)

I figured out what the webhook url should be from the request object, and it looks like this:

https://[yourdomain]/Plugins/PayPalSmartPaymentButtons/Webhook

I logged into paypal, and put that in the webhook field in the app settings so I think that's all you need to do.

Another thing I noticed is that PayPal are deprecating the v1 api calls which this plugin currently uses:  https://developer.paypal.com/docs/api/quickstart/create-webhook/
3 years ago
Follow up:
I hard coded the url for my shop page in the code and ran it again, then fiddled about with different url options. This time it did not give me the webhook error message. Therefore I think the issue happened because the test url I was using did not have https at the start, so paypal were rejecting it because it was an insecure url.

So to make this plugin work properly, you need to first get your site working on SSL, then update your config to enable SSL and set the url to start with https in the Settings>Stores>[storename] page.

Once you've done this, you should be able to get it to work properly.
3 years ago
Spot on.

I too went through the code to find out the web hook URL and realised I was using the HTTP link in my NGROK tunnel by mistake.  Changed to HTTPS and all is well!

Interesting about the v1 REST APIs - any mention of when they will be withdrawn? Perhaps Maksim or another member of the nopCommerce team can advise on the upgrade path for the plugin.

Cheers
Mark
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.