title: Cannot capture sandbox PayPal payment
body: <p>I am currently trying the <a href="https://developer.paypal.com/docs/api/orders/v2/" rel="nofollow noreferrer">Orders API</a> of PayPal using Postman, but cannot capture any payment.</p>
  <p>For now, I could get the access token, set it to a collection variable, then created orders using (note the access token is set in the Authorization tab):</p>
  <pre><code>POST https://api-m.sandbox.paypal.com/v2/checkout/orders
  
  Body:
  {
    &quot;intent&quot;: &quot;CAPTURE&quot;,
    &quot;purchase_units&quot;: [
      {
        &quot;amount&quot;: {
          &quot;currency_code&quot;: &quot;USD&quot;,
          &quot;value&quot;: &quot;10.00&quot;
        }
      }
    ]
  }
  </code></pre>
  <p>The request was successful with response body:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;id&quot;: &quot;&lt;random-id&gt;&quot;,
      &quot;status&quot;: &quot;CREATED&quot;,
      &quot;links&quot;: [
          {
              &quot;href&quot;: &quot;https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;&quot;,
              &quot;rel&quot;: &quot;self&quot;,
              &quot;method&quot;: &quot;GET&quot;
          },
          {
              &quot;href&quot;: &quot;https://www.sandbox.paypal.com/checkoutnow?token=&lt;random-id&gt;&quot;,
              &quot;rel&quot;: &quot;approve&quot;,
              &quot;method&quot;: &quot;GET&quot;
          },
          {
              &quot;href&quot;: &quot;https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;&quot;,
              &quot;rel&quot;: &quot;update&quot;,
              &quot;method&quot;: &quot;PATCH&quot;
          },
          {
              &quot;href&quot;: &quot;https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;/capture&quot;,
              &quot;rel&quot;: &quot;capture&quot;,
              &quot;method&quot;: &quot;POST&quot;
          }
      ]
  }
  </code></pre>
  <p>Then I proceeded to <code>rel:approve</code>'s link using a browser <code>https://www.sandbox.paypal.com/checkoutnow?token=&lt;random-id&gt;</code> and signed in with my sandbox account. It shows me the usual payment window but when I pressed the &quot;Continue&quot; button, it tried to redirect to the return page but instead, refreshed the page itself.</p>
  <p>When I tryed to check the order using <code>rel:self</code>'s link: <code>GET https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;</code>. It correctly showed the sandbox account's shipping details (name and address), but the <code>status</code> remained <code>CREATED</code> (not <code>APPROVED</code> or <code>COMPLETED</code>):</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;id&quot;: &quot;&lt;random-id&gt;&quot;,
      &quot;intent&quot;: &quot;CAPTURE&quot;,
      &quot;status&quot;: &quot;CREATED&quot;,
      &quot;purchase_units&quot;: [
          {
              &quot;reference_id&quot;: &quot;default&quot;,
              &quot;amount&quot;: {
                  &quot;currency_code&quot;: &quot;USD&quot;,
                  &quot;value&quot;: &quot;10.00&quot;
              },
              &quot;payee&quot;: {
                  &quot;email_address&quot;: &quot;&lt;payee-email&gt;&quot;,
                  &quot;merchant_id&quot;: &quot;&lt;payee-id&gt;&quot;
              },
              &quot;shipping&quot;: {
                  &quot;name&quot;: {
                      &quot;full_name&quot;: &quot;&lt;payer-name&gt;&quot;
                  },
                  &quot;address&quot;: {
                      &quot;address_line_1&quot;: &quot;&lt;payer-address-1&gt;&quot;,
                      &quot;address_line_2&quot;: &quot;&lt;payer-address-2&gt;&quot;,
                      &quot;admin_area_2&quot;: &quot;&lt;payer-address-3&gt;&quot;,
                      &quot;admin_area_1&quot;: &quot;&lt;payer-address-4&gt;&quot;,
                      &quot;postal_code&quot;: &quot;&lt;payer-address-5&gt;&quot;,
                      &quot;country_code&quot;: &quot;&lt;payer-address-6&gt;&quot;
                  }
              }
          }
      ],
      &quot;create_time&quot;: &quot;&lt;time-of-post-request&gt;&quot;,
      &quot;links&quot;: [
          {
              &quot;href&quot;: &quot;https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;&quot;,
              &quot;rel&quot;: &quot;self&quot;,
              &quot;method&quot;: &quot;GET&quot;
          },
          {
              &quot;href&quot;: &quot;https://www.sandbox.paypal.com/checkoutnow?token=&lt;random-id&gt;&quot;,
              &quot;rel&quot;: &quot;approve&quot;,
              &quot;method&quot;: &quot;GET&quot;
          },
          {
              &quot;href&quot;: &quot;https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;&quot;,
              &quot;rel&quot;: &quot;update&quot;,
              &quot;method&quot;: &quot;PATCH&quot;
          },
          {
              &quot;href&quot;: &quot;https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;/capture&quot;,
              &quot;rel&quot;: &quot;capture&quot;,
              &quot;method&quot;: &quot;POST&quot;
          }
      ]
  }
  </code></pre>
  <p>When I tried to capture the payment using <code>rel:caputure</code>'s link: <code>POST https://api.sandbox.paypal.com/v2/checkout/orders/&lt;random-id&gt;/capture</code> with header <code>Content Type: application/json</code> and empty body, it said &quot;payer has not approved the Order for payment&quot;, despite I getting the shipping details from the <code>GET</code> request before:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;name&quot;: &quot;UNPROCESSABLE_ENTITY&quot;,
      &quot;details&quot;: [
          {
              &quot;issue&quot;: &quot;ORDER_NOT_APPROVED&quot;,
              &quot;description&quot;: &quot;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.&quot;
          }
      ],
      &quot;message&quot;: &quot;The requested action could not be performed, semantically incorrect, or failed business validation.&quot;,
      &quot;debug_id&quot;: &quot;6a10ea489ffce&quot;,
      &quot;links&quot;: [
          {
              &quot;href&quot;: &quot;https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED&quot;,
              &quot;rel&quot;: &quot;information_link&quot;,
              &quot;method&quot;: &quot;GET&quot;
          }
      ]
  }
  </code></pre>
  <p>I have three questions:</p>
  <ol>
  <li>Was I using the Orders API correctly? Did I miss some HTTP requests and/or some crucial steps?</li>
  <li>I had the return URL set for my sandbox application, why did the payment page not redirect me but instead refreshed itself? Did I miss some setup beforehand?</li>
  <li>Why did I fail to capture the payment like above?</li>
  </ol>
  <p>P.S. After some digging I think I might be missing the <a href="https://developer.paypal.com/docs/api/orders/v2/#orders_authorize" rel="nofollow noreferrer">authorize payment step</a> but I have no idea how to do it. (Client-side request? Server-side request?)</p>