We are attempting to validate and process the JSON that our application subscribed to for the Order payment event. We are seeing inconsistent JSON object properties depending on how a customer's order is paid (paypal vs credit card) and other inconsistencies. We do not know all the variations for your JSON format for the Order payment event. Can you share the JSON schema for the order payment, so we can properly validate and parse this JSON without errors?
Hello, you can find the JSON under "orders/paid" here: https://shopify.dev/docs/admin-api/rest/reference/events/webhook
As @marcusradica pointed out, the JSON responses are documented but there are no schema for validation. I do not believe validating the entire response is necessary - i.e. no need to validate the response as it resolves, just validate inputs at function level that make use of parts of that response as you're unlikely to be passing the entire response body to downstream functions in your code anyway.
Perhaps the OP's code is performing some sort of JSON deserialization, so that inconsistencies can potentially break the string being parsed into an object. While Shopify's JSON response body is typically pretty consistent, I'm not too well-versed on using their webhooks. Using other vendor API's (e.g. - Lightspeed Retail) I would have to encapsulate the JSON string reading with some "gotcha" methods to sidestep their incredibly inconsistent API response JSON elements.
Point is that even if the API consumer only needs a couple of elements, if they are employing JSON deserialization then that's a potential gotcha...