{"action":"opened","issue":{"url":"https://api.github.com/repos/braintree/braintree_node/issues/129","repository_url":"https://api.github.com/repos/braintree/braintree_node","labels_url":"https://api.github.com/repos/braintree/braintree_node/issues/129/labels{/name}","comments_url":"https://api.github.com/repos/braintree/braintree_node/issues/129/comments","events_url":"https://api.github.com/repos/braintree/braintree_node/issues/129/events","html_url":"https://github.com/braintree/braintree_node/issues/129","id":300883798,"number":129,"title":"Different error for invalid payloads","user":{"login":"kylealwyn","id":14184138,"avatar_url":"https://avatars2.githubusercontent.com/u/14184138?v=4","gravatar_id":"","url":"https://api.github.com/users/kylealwyn","html_url":"https://github.com/kylealwyn","followers_url":"https://api.github.com/users/kylealwyn/followers","following_url":"https://api.github.com/users/kylealwyn/following{/other_user}","gists_url":"https://api.github.com/users/kylealwyn/gists{/gist_id}","starred_url":"https://api.github.com/users/kylealwyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylealwyn/subscriptions","organizations_url":"https://api.github.com/users/kylealwyn/orgs","repos_url":"https://api.github.com/users/kylealwyn/repos","events_url":"https://api.github.com/users/kylealwyn/events{/privacy}","received_events_url":"https://api.github.com/users/kylealwyn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-28T04:03:31Z","updated_at":"2018-02-28T04:03:31Z","closed_at":null,"author_association":"NONE","body":"Not a bug, just a small suggestion after integrating.\r\n\r\nI had this code after some copy-pasta while moving over from Stripe: \r\n```js\r\nconst results = await braintree.customer.create({\r\n      paymentMethodNonce: nonce,\r\n     // `metadata` instead of `customFields`\r\n      metadata: {\r\n        user_id: user.id,\r\n      },\r\n});\r\n```\r\n\r\nIt's misleading to throw an `AuthorizationError` when sending invalid fields in a gateway call. Something along the lines of `MalformedPayload` or `BadRequest` seems like it would be more helpful. It would then mimic more closely http statuses 401 Unauthorized and 400 Bad Request or 422 UnprocessableEntity. The misnamed (or extra in my case) fields seem to have nothing to do with Authorization, which led me down the rabbit hole of thinking my keys were wrong.\r\n\r\nI understand now it's in the documentation but still believe to be a misnomer. Thanks!"}}
{"actor":{"display_login":"kylealwyn"}}