title: PayPal Checkout (javascript) with Smart Payment Buttons create order problem
body: <p>On my webpage I'm trying to implement a PayPal checkout using JavaScript following the manual: <a href="https://developer.paypal.com/docs/checkout/" rel="noreferrer">https://developer.paypal.com/docs/checkout/</a>
  <br>Everything works great with the standard options. For example this works just fine:</p>
  <pre><code>paypal.Buttons({
      createOrder: function(data, actions) {
          return actions.order.create({
              purchase_units: [{
                  amount: {
                      currency_code: 'EUR',
                      value: '120.16'
                  },
                  description: 'Purchase Unit test description',
                  custom_id: '64735',
              }]
          })
      },
      onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
              alert('Transaction completed by ' +
                    details.payer.name.given_name)
              // Call your server to save the transaction
              return fetch('/api/paypal-transaction-complete', {
                  method: 'post',
                  headers: {
                      'content-type': 'application/json'
                  },
                  body: JSON.stringify({
                      orderID: data.orderID
                  })
              })
          })
      }
  }).render('#paypal-button-container')
  </code></pre>
  <p>But when I try to be more specific about the order details it gives me an error:</p>
  <pre><code>Error: &quot;Order Api response error: 
  { 
      &quot;name&quot;: &quot;INVALID_REQUEST&quot;, 
      &quot;message&quot;: &quot;Request is not well-formed, syntactically incorrect, or violates schema.&quot;, 
      &quot;debug_id&quot;: &quot;1ed03d18530c1&quot;, 
      &quot;details&quot;: [ 
          { 
              &quot;location&quot;: &quot;body&quot;, 
              &quot;issue&quot;: &quot;INVALID_SYNTAX&quot;, 
              &quot;description&quot;: &quot;Cannot deserialize instance of `com.paypal.api.platform.checkout.orders.v2.model.AmountBreakdown` out of START_ARRAY token line: 1, column: 82&quot; 
              } 
              ], 
              &quot;links&quot;: [ 
                  { 
                      &quot;href&quot;: &quot;https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_SYNTAX&quot;, &quot;rel&quot;: &quot;information_link&quot;, &quot;encType&quot;: &quot;application/json&quot; 
                  } 
              ] 
          }&quot;
  }
  </code></pre>
  <p>This is my code:</p>
  <pre><code>paypal.Buttons({
      createOrder: function(data, actions) {
          return actions.order.create({
              purchase_units: [{
                  amount: {
                      currency_code: 'EUR',
                      value: '120.16',
                      breakdown: [{
                                      item_total: {
                                          unit_amount: 7,
                                          currency_code: 'EUR',
                                          value: '120.16'
                                      }
                                      }]
  
                  },
                  description: 'Purchase Unit test description',
                  custom_id: '64735',
                  items: [{
                      name: 'Test item 1',
                      unit_amount: {
                          currency_code: 'EUR',
                          value: '60.12'
                      },
                      quantity: 2,
                      description: 'Uaua item 1 description'
                  }, {
                      name: 'Test item 2',
                      unit_amount: {
                          currency_code: 'EUR',
                          value: '60.00'
                      },
                      quantity: 5,
                      description: 'Test item 2 description'
                  }]
              }]
          })
      },
      onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
              alert('Transaction completed by ' +
                    details.payer.name.given_name)
              // Call your server to save the transaction
              return fetch('/api/paypal-transaction-complete', {
                  method: 'post',
                  headers: {
                      'content-type': 'application/json'
                  },
                  body: JSON.stringify({
                      orderID: data.orderID
                  })
              })
          })
      }
  }).render('#paypal-button-container')
  </code></pre>
  <p>Does anyone know where the problem is? The PayPal documentation is not very informative...</p>