Expose formatting function for JSON objects from webhooks
PomegranateApps opened this issue · comments
Pomegranate Apps commented
I'm using the Square API in Node.js. JSON response objects are formatted to camelcase. However, responses received from webhooks are formatted in underscore notation. Here is an example.
{
"amount_money" : {
"amount" : 3052,
"currency" : "USD"
},
"id" : "luSGCASUgrETw5zbTbxqoMcCNYFZY_TlymxTGdkvplzO5M9Ux6cJItmPhzDQy3iYBHoJqBoTF",
"order_id" : "jLi6ahIO2pVmcJp70s3gp1IQGRFZY",
"updated_at" : "2021-01-10T18:32:04.974Z",
"payment_id" : "luSGCASUgrETw5zbTbxqoMcCNYFZY",
"version" : 5,
"status" : "PENDING",
"created_at" : "2021-01-10T18:32:04.966Z",
"location_id" : "LJ8GN0VT498M1"
}
Please add a function that would expose this formatted as a separate function. This way we could format objects from a webhook and parse them in the same way as an object returned directly by the API.
luis-jetson commented
As far as I know, the sdk doesn't support webhooks. You may pass the webhook request obj to this camelCase function to get desired format. @PomegranateApps
sseaman commented
@luis-jetson is correct. The SDK does not currently support webhooks.