The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Accessing json objects with webhook

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.