Agile Jedi
Agile Jedi

Reputation: 2942

Keep receiving 404 Error with Rest API when doing a capture

This is an edit to my original post. I think the paypal rest api sandbox is down.

The error just started and I haven't had it before: here is the capture URL: https://api.sandbox.paypal.com/v1/payments/payment/PAY-8EN83459YH6921921KJ4QNHQ

Its a 404 error. Here is the body:

{
name: "INVALID_RESOURCE_ID"
message: "The requested resource ID was not found"
information_link: "https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID"
debug_id: "e56bae98dcc26"
}

The payment was properly created and I used the same credentials and the payment link provided in the returned payment creation response.

Here was the response from the original payment creation call:

{
  "id": "PAY-8EN83459YH6921921KJ4QNHQ",
  "create_time": "2013-11-05T14:54:22Z",
  "update_time": "2013-11-05T14:54:30Z",
  "state": "approved",
  "intent": "authorize",
  "payer": {
    "payment_method": "credit_card",
    "funding_instruments": [
      {
        "credit_card": {
          "type": "visa",
          "number": "xxxxxxxxxxxx0331",
          "expire_month": "11",
          "expire_year": "2018",
          "first_name": "Joe",
          "last_name": "Shopper",
          "billing_address": {
            "line1": "52 N Main ST",
            "city": "Johnstown",
            "state": "OH",
            "postal_code": "43210",
            "country_code": "US"
          }
        }
      }
    ]
  },
  "transactions": [
    {
      "amount": {
        "total": "7.47",
        "currency": "USD",
        "details": {
          "subtotal": "7.41",
          "tax": "0.03",
          "shipping": "0.03"
        }
      },
      "description": "This is the payment transaction description.",
      "related_resources": [
        {
          "authorization": {
            "id": "0UH21242UH1119007",
            "create_time": "2013-11-05T14:54:22Z",
            "update_time": "2013-11-05T14:54:30Z",
            "state": "authorized",
            "amount": {
              "total": "7.47",
              "currency": "USD",
              "details": {
                "subtotal": "7.41",
                "tax": "0.03",
                "shipping": "0.03"
              }
            },
            "parent_payment": "PAY-8EN83459YH6921921KJ4QNHQ",
            "valid_until": "2013-12-04T14:54:22Z",
            "links": [
              {
                "href": "https:\/\/api.sandbox.paypal.com\/v1\/payments\/authorization\/0UH21242UH1119007",
                "rel": "self",
                "method": "GET"
              },
              {
                "href": "https:\/\/api.sandbox.paypal.com\/v1\/payments\/authorization\/0UH21242UH1119007\/capture",
                "rel": "capture",
                "method": "POST"
              },
              {
                "href": "https:\/\/api.sandbox.paypal.com\/v1\/payments\/authorization\/0UH21242UH1119007\/void",
                "rel": "void",
                "method": "POST"
              },
              {
                "href": "https:\/\/api.sandbox.paypal.com\/v1\/payments\/payment\/PAY-8EN83459YH6921921KJ4QNHQ",
                "rel": "parent_payment",
                "method": "GET"
              }
            ]
          }
        }
      ]
    }
  ],
  "links": [
    {
      "href": "https:\/\/api.sandbox.paypal.com\/v1\/payments\/payment\/PAY-8EN83459YH6921921KJ4QNHQ",
      "rel": "self",
      "method": "GET"
    }
  ]
}

Upvotes: 3

Views: 3379

Answers (2)

Tad
Tad

Reputation: 4784

I was hitting my head against the wall for a while thinking that this PayPal bug was the cause of my problems. However, it turns out that PayPal generates the same error when you are using the wrong configuration in your client. In my case, I had the Android library set to use ENVIRONMENT_NO_NETWORK, and not ENVIRONMENT_SANDBOX. This produces real-looking transaction IDs, which (of course) are not registered with the server.

Upvotes: 1

Mido
Mido

Reputation: 120

There is a reported problem at the moment with REST API. PayPal are working on it.

Upvotes: 2

Related Questions