Subscribe paypal billing plan error on client side

aryazeazonz
Contributor
Contributor

I am trying to subscribe paypal billing plan from Smart Payment Buttons.I tried the following steps found in the link https://developer.paypal.com/docs/subscriptions/integrate/.

But  I am getting error "The specified resource does not exist" as shown below.

{
"name": "RESOURCE_NOT_FOUND",
"message": "The specified resource does not exist.",
"debug_id": "af417b60234c4",
"details": [
{
"issue": "INVALID_RESOURCE_ID",
"description": "Requested resource ID was not found."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#RESOURCE_NOT_FOUND",
"rel": "information_link",
"method": "GET"
}
]
}

 

 

 

Login to Me Too
1 REPLY 1

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Merchant Technical Support Community.

Here are the steps to creating a product, plan, and subscription:

https://developer.paypal.com/docs/subscriptions/ --> information taken from here.

Start with creating your product:
Post here: https://api.sandbox.paypal.com/v1/catalogs/products
{
  "name": "Your Subscription",
  "description": "Type of subscription you have",
  "type": "SERVICE",
  "category": "SOFTWARE",
  "image_url": "https://example.com/streaming.jpg",
  "home_url": "https://example.com/home"
}
The response will include:
PROD-6SG01252UF281672M --> Don't use this one its an example. 
Now create the plan with the PROD Id that was returned to you:
https://api.sandbox.paypal.com/v1/billing/plans --> Post Here
{
    "id": "P-2G9244075A964184PLZMVHTI",
    "product_id": "PROD-6SG01252UF281672M",
    "name": "Your Product",
    "status": "ACTIVE",
    "description": "Your description",
    "billing_cycles": [
        {
            "frequency": {
                "interval_unit": "MONTH",
                "interval_count": 1
            },
            "tenure_type": "TRIAL",
            "sequence": 1,
            "total_cycles": 1
        },
        {
            "pricing_scheme": {
                "version": 1,
                "fixed_price": {
                    "currency_code": "USD",
                    "value": "10.0"
                },
                "create_time": "2020-02-28T17:54:21Z",
                "update_time": "2020-02-28T17:54:21Z"
            },
            "frequency": {
                "interval_unit": "MONTH",
                "interval_count": 1
            },
            "tenure_type": "REGULAR",
            "sequence": 2,
            "total_cycles": 12
        }
    ],
    "payment_preferences": {
        "auto_bill_outstanding": true,
        "setup_fee": {
            "currency_code": "USD",
            "value": "10.0"
        },
        "setup_fee_failure_action": "CONTINUE",
        "payment_failure_threshold": 3
    },
    "taxes": {
        "percentage": "10.0",
        "inclusive": false
    },
    "quantity_supported": false,
    "create_time": "2020-02-28T17:54:21Z",
    "update_time": "2020-02-28T17:54:21Z",
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/plans/P-2G9244075A964184PLZMVHTI",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/plans/P-2G9244075A964184PLZMVHTI",
            "rel": "edit",
            "method": "PATCH"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/plans/P-2G9244075A964184PLZMVHTI/deactivate",
            "rel": "self",
            "method": "POST"
        }
    ]
}
Now create the Subscription:
https://api.sandbox.paypal.com/v1/billing/subscriptions --> post here
Make sure that you update the plan_id to be the one that was given to you when you created your product. Also make sure to update the start date to the next day (or a date in the future) and not today's date. 
{
      "plan_id": "P-2G9244075A964184PLZMVHTI",
      "start_time": "2020-03-01T06:00:00Z",
      "subscriber": {
        "name": {
          "given_name": "Jimin",
          "surname": "Smith"
        },
        "email_address": "buyers.email@email.com"
      },
      "application_context": {
        "brand_name": "your product",
        "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"
      }
    }

You will receive a response that looks like the below. Keep in mind that this information is for sample purposes, you won't be able to use this information since it is set to a different account. Once the buyer approves the subscription then it will become active. 
{
    "status": "APPROVAL_PENDING",
    "status_update_time": "2020-02-28T18:01:23Z",
    "id": "I-3EFBDC4SV0RT",
    "plan_id": "P-2G9244075A964184PLZMVHTI",
    "start_time": "2020-03-01T06:00:00Z",
    "quantity": "1",
    "subscriber": {
        "name": {
            "given_name": "Jimin",
            "surname": "Smith"
        },
        "email_address": "yourbuyersemail@email.com"
    },
    "create_time": "2020-02-28T18:01:23Z",
    "links": [
        {
            "href": "https://www.sandbox.paypal.com/webapps/billing/subscriptions?ba_token=BA-99665434CN427810Q",
            "rel": "approve",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-3EFBDC4SV0RZ",
            "rel": "edit",
            "method": "PATCH"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-3EFBDC4SV0RZ",
            "rel": "self",
            "method": "GET"
        }
    ]
}

This is just sample created through Postman and using the PayPal API structure that was laid out in the PayPal Developer documents.

Thank you,

Jennifer

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.