title: PayPal REST API Getting 422 Unprocessable Entity Error using Sandbox Account
body: <p>I'm making an e-commerce application and I'm using the JavaScript SDK. When I create an order WITH the items list, I get the 422 error. When I create it without the items list, it works like a charm. However, I need to be able to list out all of the items from my cart in the items list. Can anyone help me?</p>
  <p>Here's the documenation to create an order: <a href="https://developer.paypal.com/docs/api/orders/v2/#orders_create" rel="nofollow noreferrer">https://developer.paypal.com/docs/api/orders/v2/#orders_create</a></p>
  <p>This works:</p>
  <pre><code>return actions.order.create({
      purchase_units: [{
          amount: {
              value: '9.99'
          }
      }]
  });
  </code></pre>
  <p>This doesn't work:</p>
  <pre><code>var items = [];
  for (const i of shoppingCart) {
      items.push({
          'name': `${i.length}&quot; ${i.name} ${i.category}`,
          'unit_amount': {
              currency_code: 'USD',
              value: '9.99'
          },
          'quantity': '2'
      })
  }
  
  return actions.order.create({
      purchase_units: [{
          amount: {
              value: '{{ grandTotal }}'
          },
          items: items
      }]
  });
  </code></pre>
  <p>Solved. Here's a full solution of what I needed to do:</p>
  <pre><code>purchase_units: [
      {
          amount: {
              value: '{{ grandTotal }}',
              currency_code: 'USD',
              breakdown: {
                  item_total: {
                      currency_code: 'USD',
                      value: '{{ total }}'
                  },
                  discount: {
                      currency_code: 'USD',
                      value: discount
                  }
              }
          },
          items: items
      }
  ]
  </code></pre>