POST https://www.sandbox.paypal.com/v1/billing/subscriptions 404 (Not Found)

Suryau
New Community Member

I am trying to implement smart buttons API and I get this error in js console window of the browser when the createSubscription method is called when Paypal button is clicked. How do I get around this?

 

Not sure if this related but I also see the following error in the JS console when the page is loaded

net::ERR_NAME_NOT_RESOLVED

for https://tracking.qa.paypal.com/webapps/tracking/ts?pgrp=muse%3Ageneric%3Aanalytics%3A%3Amerchant&pag...

Login to Me Too
5 REPLIES 5

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Sandbox Community.

If you have already Created the Product, Created the Plan the final step is to create the subscription.

If you post something of this nature: (I changed the plan id on purpose since this is an example)

Post to: https://api.sandbox.paypal.com/v1/billing/subscriptions
{
      "plan_id": "P-42419643ER676252DLZ3EWWZ",
      "start_time": "2020-03-24T06:00:00Z",
      "subscriber": {
        "name": {
          "given_name": "Jim",
          "surname": "Smith"
        },
        "email_address": "mybuyer.buyer@buyer.com"
      },
      "application_context": {
        "brand_name": "My Subscription",
        "locale": "en-US",
        "shipping_preference": "SET_PROVIDED_ADDRESS",
        "user_action": "SUBSCRIBE_NOW",
        "payment_method": {
          "payer_selected": "PAYPAL",
          "payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
        },
        "return_url": "https://example.com/returnUrl",
        "cancel_url": "https://example.com/cancelUrl"
      }
    }

  Notice that the Return URL I'm using doesn't exist. You can use any return URL during sandbox, but its probably best to use one that will actually be a valid website.

The response that you should receive is something of this nature: (This is an example, information was changed on purpose)

{
    "status": "APPROVAL_PENDING",
    "status_update_time": "2020-03-22T14:49:25Z",
    "id": "I-NVHV48P5FXXX",
    "plan_id": "P-42419643ER676252DLZ3EWWZ",
    "start_time": "2020-03-24T06:00:00Z",
    "quantity": "1",
    "subscriber": {
        "name": {
            "given_name": "Jim",
            "surname": "Smith"
        },
        "email_address": "mybuyer.buyer@buyer.com"
    },
    "create_time": "2020-03-22T14:49:25Z",
    "links": [
        {
            "href": "https://www.sandbox.paypal.com/webapps/billing/subscriptions?ba_token=BA-43R78354UP596953Z",
            "rel": "approve",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-NVHV48P5FXXX",
            "rel": "edit",
            "method": "PATCH"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-NVHV48P5FXXX",
            "rel": "self",
            "method": "GET"
        }
    ]
}

After this response is received then a URL of this nature is used for the buyer to setup the subscription: https://www.sandbox.paypal.com/webapps/billing/subscriptions?ba_token=BA-43R78354UP596953Z  (This is an example you will want to use the one you received back)

Thank you,

Jennifer

PayPal

Login to Me Too

cjohnweb
Contributor
Contributor

Can you confirm, are we supposed to be posting to https://www.sandbox.paypal.com/v1/billing/subscriptions or https://api.sandbox.paypal.com/v1/billing/subscriptions ?

I'm getting the same error as the poster but this http://www.sandbox.paypal.com url comes from the SDK JS file, and your example illustrates the use of https://api.[...].

Login to Me Too

drakaria
Contributor
Contributor

This is unresolved, and I'm facing the same issue. The original post mentions that they're using the PayPal Smart Buttons solution to create the subscription. The same problem is happening in my project, a javascript console error `POST https://www.sandbox.paypal.com/v1/billing/subscriptions 404 (Not Found)`

For reference my code is the same as the documentation but with the plan_id I generated substituted in (note, this isn't my actual plan_id):

 

paypal.Buttons({
	createSubscription: function(data, actions) {
		return actions.subscription.create({
			'plan_id': 'P-75432334R0481662WL7ZER6A'
		});
	}
}).render('#paypal-button-container');

 

 

Edit: Furthermore the link provided in the console error ( https://developer.paypal.com/docs/api/v1/billing/subscriptions#RESOURCE_NOT_FOUND ) redirects to an unhelpful page, I believe the relevant info is at https://developer.paypal.com/docs/subscriptions/troubleshoot/ , although this info didn't help me address the problem anyway.

Login to Me Too

misterfish
New Community Member

Same issue here.... "POST https://www.sandbox.paypal.com/v1/billing/subscriptions 404"

 

Any resolution?

Login to Me Too

drakaria
Contributor
Contributor

This problem resolved for me, I can't recall what fixed it. Double check that your paypal.com/sdk/js?client-id= is set correctly

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.