Received CHECKOUT.ORDER.APPROVED on webhook, but can't capture [SANDBOX]

EvertonJ
Contributor
Contributor

I'm using the orders api to create an order:
POST https://api-m.sandbox.paypal.com/v2/checkout/orders

 

 

{
    "id": "33T90120KX1728526",
    "status": "CREATED",
    "links": [
        ...
        {
            "href": "https://www.sandbox.paypal.com/checkoutnow?token=33T90120KX1728526",
            "rel": "approve",
            "method": "GET"
        },
        ...
    ]
}

 

 

Then I enter the 'approve' link e try to finish the payment:

 

 

{
  "ack": "success",
  "data": {
    ...
    "state": "APPROVED",
}

 

 

After that I receive this notification on my webhook:

 

 

{
  "id": "WH-30025782RS611840D-84981668V7049300V",
  "event_version": "1.0",
  "create_time": "2021-04-21T14:16:13.997Z",
  "resource_type": "checkout-order",
  "resource_version": "2.0",
  "event_type": "CHECKOUT.ORDER.APPROVED",
  "summary": "An order has been approved by buyer",
  "resource": {
    ...
    "id": "33T90120KX1728526",
    "intent": "CAPTURE",
    "status": "CREATED"
  },
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-30025782RS611840D-84981668V7049300V",
      "rel": "self",
      "method": "GET"
    },
    {
      "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-30025782RS611840D-84981668V7049300V/resend",
      "rel": "resend",
      "method": "POST"
    }
  ]
}

 

 

But when I try to capture it (POST https://api-m.sandbox.paypal.com/v2/checkout/orders/33T90120KX1728526/capture) I get an ORDER_NOT_APPROVED.

 

 

{
    "name": "UNPROCESSABLE_ENTITY",
    "details": [
        {
            "issue": "ORDER_NOT_APPROVED",
            "description": "Payer has not yet approved the Order for payment. Please redirect the payer to the 'rel':'approve' url returned as part of the HATEOAS links within the Create Order call or provide a valid payment_source in the request."
        }
    ],
    "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
    "debug_id": "4dca141f80ade",
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED",
            "rel": "information_link",
            "method": "GET"
        }
    ]
}

 

 

 What am I doing wrong?

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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