Squareup Webhook - Send duplicate request

I am using squareup APIs .. i setup the notification URL to my application correctlly and setup it for PAYMENT_UPDATED

// setup notifications
$data = array("PAYMENT_UPDATED");
$data_json = json_encode($data);
$curl = curl_init();

curl_setopt ($curl, CURLOPT_URL, "https://connect.squareup.com/v1/me/webhooks");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");

curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_json),
    'Authorization: Bearer XXXXXXXXXXXXXXXXXX')
);

curl_setopt($curl, CURLOPT_POSTFIELDS,$data_json);

echo $response  = curl_exec($curl);
curl_close($curl);
echo "<pre>";
print_r(json_decode($response,true));
echo "</pre>";

and i make a payment from a mobile device then, i got a duplicate requests for the single payment withe the same data like that:

     {"entity_id":"xxxxxxxxxxxx","event_type":"PAYMENT_UPDATED","merchant_id":"xxxxxxxxxxxx","subunit_id":"xxxxxxxx"}

any help ?!

3,354 Views
Message 1 of 2
Report
1 REPLY 1
Alumni

Hey there @george364 and welcome to the Seller Community! 👋

 

While our forums are open for everyone, you may have more success looking for API support under our Developer Portal. Once there you may click on Support and I am pretty confident you will have better luck finding an answer there.

 

P.S. Welcome to the Seller Community ✨ 

JJ
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
3,292 Views
Message 2 of 2
Report