Request is not well-formed, syntactically incorrect, or violates schema.

deb1231
New Community Member
var createOrder = {
      method : "POST",
      headers : {
        "Accept" : "application/json",
         "Content-Type" : "application/json",
         "Authorization" : "Bearer <Access Token>"
      },
      data :{
         "intent": "CAPTURE",
         "purchase_units": [
            {
               "amount": {
                  "currency_code": "USD",
                  "value": "14.4",
                }
            }
          ]
      }
   }
 request(createOrder,function(error,response,body){
      response.body;
   })
 
I am using the above parameters to create a order in node js.
But i always get a same error like :-
{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "94dec6f54ac7b",
"details": [
{
"field": "/intent",
"value": "",
"location": "body",
"issue": "MISSING_REQUIRED_PARAMETER",
"description": "A required field / parameter is missing."
},
{
"field": "/purchase_units",
"value": "",
"location": "body",
"issue": "MISSING_REQUIRED_PARAMETER",
"description": "A required field / parameter is missing."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-MISSING_REQUIRED_PARAMETER",
"rel": "information_link",
"encType": "application/json"
}
]
}
I don't know where i am wrong and where i am missing the structure of JSON
Tried all possible ways please need help 
Login to Me Too
2 REPLIES 2

gonzaDG
New Community Member

Some update? I have the same problem 😞

Login to Me Too

allabpow
Contributor
Contributor

I have the same problem and make the request from the server.

Here is my \PayPalCheckoutSdk\Orders\OrdersCreateRequest Object:

 

 

 

PayPalCheckoutSdk\Orders\OrdersCreateRequest::__set_state(array(
   'path' => '/v2/checkout/orders?',
   'body' => 
  array (
    'intent' => 'CAPTURE',
    'application_context' => 
    array (
      'brand_name' => 'foo',
      'locale' => 'de-DE',
      'landing_page' => 'BILLING',
      'shipping_preferences' => 'foo',
      'user_action' => 'PAY_NOW',
      'return_url' => 'http://foo.lan/paypalcheckout-requestreturn',
      'cancel_url' => 'http://foo.lan/paypalcheckout-requestcancel',
    ),
    'purchase_units' => 
    array (
      0 => 
      array (
        'reference_id' =[Removed. Phone #s not permitted]db83e9619fb',
        'description' => 'foo',
        'amount' => 
        array (
          'currency_code' => 'EUR',
          'value' => 34.71740740740741,
          'breakdown' => 
          array (
            'item_total' => 
            array (
              'currency_code' => 'EUR',
              'value' => 23.55740740740741,
            ),
            'shipping' => 
            array (
              'currency_code' => 'EUR',
              'value' => 11.16,
            ),
            'tax_total' => 
            array (
              'currency_code' => 'EUR',
              'value' => 3,
            ),
          ),
        ),
        'items' => 
        array (
          0 => 
          array (
            'name' => 'foo 1000 Ø18,0mm',
            'sku' => 'CP00083',
            'unit_amount' => 
            array (
              'currency_code' => 'EUR',
              'value' => '20.466667',
            ),
            'tax' => 
            array (
              'currency_code' => 'EUR',
              'value' => '3',
            ),
            'quantity' => 0.16666666666666666,
          ),
        ),
        'shipping' => 
        array (
          'method' => 'UPS',
          'address' => 
          array (
            'address_line_1' => 'Somestreet',
            'address_line_2' => 'Thename',
            'admin_area_2' => 'City',
            'postal_code' => '12345',
            'country_code' => 'DE',
          ),
        ),
      ),
    ),
  ),
   'verb' => 'POST',
   'headers' => 
  array (
    'Content-Type' => 'application/json',
    'Prefer' => 'return=representation',
  ),
))

 

 

Login to Me Too

Haven't Found your Answer?

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