Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Unable to pay: NotifyUrl is not a fully qualified URL error retrieved #1151

Closed
xserrat opened this issue Jul 19, 2018 · 15 comments
Closed

Unable to pay: NotifyUrl is not a fully qualified URL error retrieved #1151

xserrat opened this issue Jul 19, 2018 · 15 comments

Comments

@xserrat
Copy link

xserrat commented Jul 19, 2018

General information

  • SDK/Library version:
  • Environment:
  • PayPal-Debug-ID values:
  • Language, language version, and OS:

Issue description

I'm having an error when I try to pay, when creating an agreement. The error returned is:

NotifyUrl is not a fully qualified URL.

Also, when I try to retrieve subscription information about an agreementId, I get a similar error but with another url: ReturnUrl is not a fully qualified URL.

Is there any recent change in your API that is not updated in the SDK? It's related to a merchant_preferences field where the API is returning three null urls: "cancelUrl, returnUrl and notifyUrl".

I hope someone helps...

Thanks.

@marcogrossisas
Copy link

Hello @xserrat we also noticed it since 16 hours ago more or less.

The problem is that
POST https://api.sandbox.paypal.com/v1/payments/billing-agreements/ now returns the parameter notify_url and this provokes PayPal\Validation\UrlValidator::validate to fail. Until yesterday no notify_url was returned if wasn't set.

Unable to process payments now.
This is a serious bug.
Thanks

@xserrat
Copy link
Author

xserrat commented Jul 19, 2018

You're totally right @marcogrossisas . I've just compared the old return json and now appear the field you're saying.

We've tried to update the notify_url using a PATCH request with the agreement_id but it is only available when creating the plan... The error I see is the following:

{
    "name": "BUSINESS_VALIDATION_ERROR",
    "details": [
        {
            "field": "validation_error",
            "issue": "Can update template only in created state"
        }
    ],
    "message": "Business error",
    "information_link": "https://developer.paypal.com/docs/api/payments.billing-plans#errors",
    "debug_id": "b429385e17919"
}

@marcogrossisas
Copy link

@xserrat we just see there is a pull request #1152 to fix the problem. Once is merged update the library and it will be fixed.

@sasky
Copy link

sasky commented Jul 19, 2018

Not Happy Guys. I had to figure out what was going on and apply a quick fix in the middle of the night. As our website suddenly stopped accepting payment plans. We probably lost a few hundred in sales. Then my 8 month baby is apparently 'teething' so didn't get much sleep after fixing this on our site. Lets just say today I am sleep deprived and grumpy. I think I need another coffee.

@crowd8
Copy link

crowd8 commented Jul 20, 2018

the same here...

@highhair20
Copy link

When will PR #1152 be merged to master and will there be an official patch release?

Yop-La added a commit to Yop-La/spamtonprof that referenced this issue Aug 7, 2018
@daviduarte
Copy link

daviduarte commented Aug 18, 2018

The same here. I installed the SDK PHP through this page. I solve the problem with the link shared by karthiksekars. I'm waiting for a official patch release.

@waqasraza123
Copy link

same issue here.

@phillipsnick
Copy link

phillipsnick commented Aug 29, 2018

Is there no fix for this on existing plans?

@phillipsnick
Copy link

Spent a few hours on this now and made zero successful progress.

Looked at the response by @karthiksekars and created the following class.

use PayPal\Api\MerchantPreferences as BaseMerchantPreferences;
use PayPal\Validation\UrlValidator;

class MerchantPreferences extends BaseMerchantPreferences
{
    public function setNotifyUrl($notify_url)
    {
        if(!empty($notify_url)){
            UrlValidator::validate($notify_url, "NotifyUrl");
        }

        $this->notify_url = $notify_url;
        return $this;
    }
}

Then create a new plan using the following MerchantPreferences

$merchantPreferences = new MerchantPreferences();
$merchantPreferences->setReturnUrl("https://REDACTED.com/subscriptions/paypal/processagreement")
        ->setNotifyUrl("https://REDACTED.com/subscriptions/paypal/notify")
        ->setCancelUrl("https://REDACTED.com/subscriptions/paypal/cancel")
        ->setAutoBillAmount('YES')
        ->setInitialFailAmountAction('CONTINUE')
        ->setMaxFailAttempts('0');

But the response from PayPal is still

{
	"name": "VALIDATION_ERROR",
	"details": [{
		"field": "merchant_preferences.notify_url",
		"issue": "Field is invalid in a request."
	}],
	"message": "Invalid request. See details.",
	"information_link": "https://developer.paypal.com/docs/api/payments.billing-plans#errors",
	"debug_id": "40c3fa3bcd7ae"
}

I'm at a loss here as the URL looks perfectly valid to me.

According to the API docs at https://developer.paypal.com/docs/api/payments.billing-plans/v1/

notify_url string
The URL where the customer is notified that the agreement was created. Read-only and reserved for future use.
Read only.

Maximum length: 1000.

Could anyone point me in the right direction?

@bootell
Copy link

bootell commented Aug 31, 2018

@phillipsnick
According to docs, notify_url is a read only param, just remove the setNotifyUrl line should work fine.
You can set notify_url in paypal's REST Api webhook page.

@MrMooky
Copy link

MrMooky commented Sep 2, 2018

I solved the issue with setNotifyUrl as described in the link posted by @karthiksekars. Now I can make payments (still in Sandbox). When I get redirected to the ReturnUrl – which is already the correct Url, I get this error: ReturnUrl is not a fully qualified URL.

Again: payment is successfully made, a token is generated and the "PayPal Developer Backend" even tells me the payment went through. I do get redirected to the page I defined, yet the API gives me that error. Any idea what else it could be?

Update: that is the url: https://friendships.test/subscribe/paypal/return (local Laravel install)

@markantonay
Copy link

@MrMooky

try to add an if not empty condition in both function setCancelUrl and function setReturnUrl for the validator.

@prakash-gangadharan
Copy link
Contributor

Hi folks, this issue was also reported by Beatstars late in 2018 who is using the PHP SDK to create billing plans. The cause of the issue is, during GET call null is obtained for most of the response parameters (ex return_url, cancel_url, notify_url & state etc.,) from paypal server side when it was not set by the merchant.

The fix for this issue has been pushed to LIVE around 2nd October,2018 04:30 PM PST from paypal server side. This issue was not happening anymore. Hence closing this issue as it is no longer applicable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests