cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

PayPal Subscription revise - buyer is not redirected after consent

Davidwesa
Contributor
Contributor

I am using following PayPal REST API endpoint to revise subscription. In this case, I am trying to change the existing plan to 'enterprise plan'.

https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-RWWYH16HNGLT/revise

Following JSON is being sent in the body:

{
    "plan_id": "{{enterprise_plan_id}}",
    "application_context": {
        "return_url": "https://ijcaonline.org",
        "cancel_url": "https://www.elsevier.com"
    }
}

PayPal sends me a proper JSON response with HATEOAS link for approval.

{
    "plan_id": "P-58L61331DX546581WMIPDYMQ",
    "plan_overridden": false,
    "links": [
        {
            "href": "https://www.sandbox.paypal.com/webapps/billing/subscriptions/update?ba_token=BA-2HE39875M7268303S",
            "rel": "approve",
            "method": "GET"
        },
        {
            "href": "https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-RWWYH16HNGLT",
            "rel": "edit",
            "method": "PATCH"
        },
        {
            "href": "https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-RWWYH16HNGLT",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-RWWYH16HNGLT/cancel",
            "rel": "cancel",
            "method": "POST"
        },
        {
            "href": "https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-RWWYH16HNGLT/suspend",
            "rel": "suspend",
            "method": "POST"
        },
        {
            "href": "https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-RWWYH16HNGLT/capture",
            "rel": "capture",
            "method": "POST"
        }
    ]
}

When I go to the approval link in the browser, I am greeted with the login form. But after login, the page loops arounds for a few seconds and later I am flashed with an error in the browser:

We’re sorry Things don’t appear to be working at the moment. Try Again

I opened the google chrome developer console and have noted the errors:

3H5t3.png

I tried doing the subscription revision using Javascript SDK as well rather than calling REST API endpoints but still the HATEOAS approval link won't work.

 
Login to Me Too
Who Me Too'd this topic