Accessing json objects with webhook

yyhmsgyyhmsg Member
I'm not sure if I'm not getting the right payload back from the webhook or if my code is wrong.

I'm using the code from the webhook page:
$data = file_get_contents('php://input');
$parsedData = json_decode($data, true);

// Verify the webhook payload
$signature = hash_hmac('sha256', $data, FOXY_WEBHOOK_ENCRYPTION_KEY);
if (!hash_equals($signature, $_SERVER['HTTP_FOXY_WEBHOOK_SIGNATURE'])) {
echo "Signature verification failed - data corrupted";

and I seem to get the array back - how do I get to the objects, I've tried things like:

$myBody = '';
$myBody .= $parsedData['_embedded']['fx:billing_addresses'][0]['address1'];
$myBody .= $parsedData['_embedded']['fx']['billing_addresses']['city'];
$myBody .= $parsedData['fx:billing_addresses'][0]['address1'];
$myBody .= $parsedData['fx:billing_addresses']['address1'];

and none of them yield anything. Is there something I'm missing?

  • never mind the first option worked after an apache reload for some reason....
    $myBody .= $parsedData['_embedded']['fx:billing_addresses'][0]['address1'];
Sign In or Register to comment.