Is it normal for the payment created to create 3 calls to it’s endpoint? I’m logging the data and it shows 2 entries for Approved and another entry for Completed. Shouldn’t completed be a part of the payment_updated trigger? Payment update does the same thing, but I expect that, except there are two results of Completed being exactly the same.
Was this in sandbox or production? Also what’s the payment_id
that you multiple created events for? There should only be one created event for payments.
Sandbox
nlxmPjlHYoSZNO2hqlhskN7GBBPZY
In our logs I only see one payment.created
event and two payment.updated
events which is the expected behavior.
I’m using payment.updated, but it’s triggering two of the exact same responses. ID 5Wfrh2mBD5zMArJe6X7Q6ocO3UEZY has two completed entries.
Do you have the bodies of those webhooks? They should be different and that’s the reason that you got multiple events.
The body is the same except for the event_id
f68d8e5f-df83-420b-a7ec-465ed7c4b951
8aeb3aca-3478-4404-9bb8-1d6de5eee77e
Is it supposed to do that? I would filter the additional one out, but there’s not anything I can really filter it by.
Does the first payment.updated
event have the processing_fee
[]
? In my test the first event won’t have processing_fee
but the second payment.updated
event will have it which is why there is a second updated event.
When I do a diff check on the two events the only difference is the event_id
Any other ideas on this?
Would you mind sharing the two webhooks that have the same body? We haven’t been able to replicate this.
I’m only using one webhook endpoint. It’s payment.updated.
Debug 12-16-21 11:17:35: hit
Debug 12-16-21 11:17:35: Body
Debug 12-16-21 11:17:35: Array
(
[merchant_id] => MLSDRFTT73W7B
[type] => payment.created
[event_id] => 3ee0c56e-39df-4871-8c35-2f6145578a92
[created_at] => 2021-12-16T23:17:34.7Z
[data] => Array
(
[type] => payment
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[object] => Array
(
[payment] => Array
(
[amount_money] => Array
(
[amount] => 9999
[currency] => USD
)
[application_details] => Array
(
[application_id] => sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg
[square_product] => VIRTUAL_TERMINAL
)
[capabilities] => Array
(
[0] => EDIT_AMOUNT_UP
[1] => EDIT_AMOUNT_DOWN
[2] => EDIT_TIP_AMOUNT_UP
[3] => EDIT_TIP_AMOUNT_DOWN
)
[cash_details] => Array
(
[buyer_supplied_money] => Array
(
[amount] => 9999
[currency] => USD
)
[change_back_money] => Array
(
[amount] => 0
[currency] => USD
)
)
[created_at] => 2021-12-16T23:17:34.696Z
[customer_id] => EBJJ46345S08H7FYDHN47Q9S8C
[employee_id] => TM-eYN4faAVNnf_D
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[location_id] => L2KEJWT3XZW30
[order_id] => i2NjvSkkBhXz9OqYtyyISf4CH3fZY
[receipt_number] => Rq3B
[source_type] => CASH
[status] => APPROVED
[team_member_id] => TM-eYN4faAVNnf_D
[total_money] => Array
(
[amount] => 9999
[currency] => USD
)
[version] => 0
)
)
)
)
Debug 12-16-21 11:17:36: hit
Debug 12-16-21 11:17:36: hit
Debug 12-16-21 11:17:36: Body
Debug 12-16-21 11:17:36: Array
(
[merchant_id] => MLSDRFTT73W7B
[type] => payment.updated
[event_id] => b90839ae-f34c-4317-a77a-a0899ed8f7d7
[created_at] => 2021-12-16T23:17:35.697Z
[data] => Array
(
[type] => payment
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[object] => Array
(
[payment] => Array
(
[amount_money] => Array
(
[amount] => 9999
[currency] => USD
)
[application_details] => Array
(
[application_id] => sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg
[square_product] => VIRTUAL_TERMINAL
)
[capabilities] => Array
(
[0] => EDIT_AMOUNT_UP
[1] => EDIT_AMOUNT_DOWN
[2] => EDIT_TIP_AMOUNT_UP
[3] => EDIT_TIP_AMOUNT_DOWN
)
[cash_details] => Array
(
[buyer_supplied_money] => Array
(
[amount] => 9999
[currency] => USD
)
[change_back_money] => Array
(
[amount] => 0
[currency] => USD
)
)
[created_at] => 2021-12-16T23:17:34.696Z
[customer_id] => EBJJ46345S08H7FYDHN47Q9S8C
[employee_id] => TM-eYN4faAVNnf_D
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[location_id] => L2KEJWT3XZW30
[order_id] => i2NjvSkkBhXz9OqYtyyISf4CH3fZY
[receipt_number] => Rq3B
[receipt_url] => https://squareupsandbox.com/receipt/preview/Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[source_type] => CASH
[status] => COMPLETED
[team_member_id] => TM-eYN4faAVNnf_D
[total_money] => Array
(
[amount] => 9999
[currency] => USD
)
[version] => 1
)
)
)
)
Debug 12-16-21 11:17:36: Body
Debug 12-16-21 11:17:36: Array
(
[merchant_id] => MLSDRFTT73W7B
[type] => payment.updated
[event_id] => 13d61713-36e5-4293-81d4-30ee7fd757b0
[created_at] => 2021-12-16T23:17:35.697Z
[data] => Array
(
[type] => payment
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[object] => Array
(
[payment] => Array
(
[amount_money] => Array
(
[amount] => 9999
[currency] => USD
)
[application_details] => Array
(
[application_id] => sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg
[square_product] => VIRTUAL_TERMINAL
)
[capabilities] => Array
(
[0] => EDIT_AMOUNT_UP
[1] => EDIT_AMOUNT_DOWN
[2] => EDIT_TIP_AMOUNT_UP
[3] => EDIT_TIP_AMOUNT_DOWN
)
[cash_details] => Array
(
[buyer_supplied_money] => Array
(
[amount] => 9999
[currency] => USD
)
[change_back_money] => Array
(
[amount] => 0
[currency] => USD
)
)
[created_at] => 2021-12-16T23:17:34.696Z
[customer_id] => EBJJ46345S08H7FYDHN47Q9S8C
[employee_id] => TM-eYN4faAVNnf_D
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[location_id] => L2KEJWT3XZW30
[order_id] => i2NjvSkkBhXz9OqYtyyISf4CH3fZY
[receipt_number] => Rq3B
[receipt_url] => https://squareupsandbox.com/receipt/preview/Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[source_type] => CASH
[status] => COMPLETED
[team_member_id] => TM-eYN4faAVNnf_D
[total_money] => Array
(
[amount] => 9999
[currency] => USD
)
[version] => 1
)
)
)
)
I’m only using one webhook endpoint. It’s payment.updated.
Debug 12-16-21 11:17:35: hit
Debug 12-16-21 11:17:35: Body
Debug 12-16-21 11:17:35: Array
(
[merchant_id] => MLSDRFTT73W7B
[type] => payment.created
[event_id] => 3ee0c56e-39df-4871-8c35-2f6145578a92
[created_at] => 2021-12-16T23:17:34.7Z
[data] => Array
(
[type] => payment
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[object] => Array
(
[payment] => Array
(
[amount_money] => Array
(
[amount] => 9999
[currency] => USD
)
[application_details] => Array
(
[application_id] => sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg
[square_product] => VIRTUAL_TERMINAL
)
[capabilities] => Array
(
[0] => EDIT_AMOUNT_UP
[1] => EDIT_AMOUNT_DOWN
[2] => EDIT_TIP_AMOUNT_UP
[3] => EDIT_TIP_AMOUNT_DOWN
)
[cash_details] => Array
(
[buyer_supplied_money] => Array
(
[amount] => 9999
[currency] => USD
)
[change_back_money] => Array
(
[amount] => 0
[currency] => USD
)
)
[created_at] => 2021-12-16T23:17:34.696Z
[customer_id] => EBJJ46345S08H7FYDHN47Q9S8C
[employee_id] => TM-eYN4faAVNnf_D
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[location_id] => L2KEJWT3XZW30
[order_id] => i2NjvSkkBhXz9OqYtyyISf4CH3fZY
[receipt_number] => Rq3B
[source_type] => CASH
[status] => APPROVED
[team_member_id] => TM-eYN4faAVNnf_D
[total_money] => Array
(
[amount] => 9999
[currency] => USD
)
[version] => 0
)
)
)
)
Debug 12-16-21 11:17:36: hit
Debug 12-16-21 11:17:36: hit
Debug 12-16-21 11:17:36: Body
Debug 12-16-21 11:17:36: Array
(
[merchant_id] => MLSDRFTT73W7B
[type] => payment.updated
[event_id] => b90839ae-f34c-4317-a77a-a0899ed8f7d7
[created_at] => 2021-12-16T23:17:35.697Z
[data] => Array
(
[type] => payment
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[object] => Array
(
[payment] => Array
(
[amount_money] => Array
(
[amount] => 9999
[currency] => USD
)
[application_details] => Array
(
[application_id] => sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg
[square_product] => VIRTUAL_TERMINAL
)
[capabilities] => Array
(
[0] => EDIT_AMOUNT_UP
[1] => EDIT_AMOUNT_DOWN
[2] => EDIT_TIP_AMOUNT_UP
[3] => EDIT_TIP_AMOUNT_DOWN
)
[cash_details] => Array
(
[buyer_supplied_money] => Array
(
[amount] => 9999
[currency] => USD
)
[change_back_money] => Array
(
[amount] => 0
[currency] => USD
)
)
[created_at] => 2021-12-16T23:17:34.696Z
[customer_id] => EBJJ46345S08H7FYDHN47Q9S8C
[employee_id] => TM-eYN4faAVNnf_D
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[location_id] => L2KEJWT3XZW30
[order_id] => i2NjvSkkBhXz9OqYtyyISf4CH3fZY
[receipt_number] => Rq3B
[receipt_url] => https://squareupsandbox.com/receipt/preview/Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[source_type] => CASH
[status] => COMPLETED
[team_member_id] => TM-eYN4faAVNnf_D
[total_money] => Array
(
[amount] => 9999
[currency] => USD
)
[version] => 1
)
)
)
)
Debug 12-16-21 11:17:36: Body
Debug 12-16-21 11:17:36: Array
(
[merchant_id] => MLSDRFTT73W7B
[type] => payment.updated
[event_id] => 13d61713-36e5-4293-81d4-30ee7fd757b0
[created_at] => 2021-12-16T23:17:35.697Z
[data] => Array
(
[type] => payment
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[object] => Array
(
[payment] => Array
(
[amount_money] => Array
(
[amount] => 9999
[currency] => USD
)
[application_details] => Array
(
[application_id] => sandbox-sq0idb-BbZvlaIkgSYnVUI4rpSedg
[square_product] => VIRTUAL_TERMINAL
)
[capabilities] => Array
(
[0] => EDIT_AMOUNT_UP
[1] => EDIT_AMOUNT_DOWN
[2] => EDIT_TIP_AMOUNT_UP
[3] => EDIT_TIP_AMOUNT_DOWN
)
[cash_details] => Array
(
[buyer_supplied_money] => Array
(
[amount] => 9999
[currency] => USD
)
[change_back_money] => Array
(
[amount] => 0
[currency] => USD
)
)
[created_at] => 2021-12-16T23:17:34.696Z
[customer_id] => EBJJ46345S08H7FYDHN47Q9S8C
[employee_id] => TM-eYN4faAVNnf_D
[id] => Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[location_id] => L2KEJWT3XZW30
[order_id] => i2NjvSkkBhXz9OqYtyyISf4CH3fZY
[receipt_number] => Rq3B
[receipt_url] => https://squareupsandbox.com/receipt/preview/Rq3B3gcFZ8xCUrIurWSy5HxypTMZY
[source_type] => CASH
[status] => COMPLETED
[team_member_id] => TM-eYN4faAVNnf_D
[total_money] => Array
(
[amount] => 9999
[currency] => USD
)
[version] => 1
)
)
)
)
Not sure why I can’t post code.
I’m only using one webhook endpoint. It’s payment.updated. Akismet is giving me problems, posting code, but if you review the pending posts (sorry didn’t see the notification) you’ll see my logging and how the webhook is firing and hitting my endpoint 3 times.
Right, I get multiple events as well for payments which is expected however the bodies of the webhooks are all different. This is the expected behavior. Also if you don’t respond with a 200
within 10 seconds Square will think the webhook delivery failed. If this happens we will resend the event as per our re-send schedule.
I am currently returning the response and tried json return as well. It’s still posting the completed event twice. Are you saying this is expected? Why is the payment being marked completed twice?
Responses to event
Json
{"data":{"status":200,"response":"success"},"headers":[],"status":200}
Object
(
[links:protected] => Array
(
)
[matched_route:protected] =>
[matched_handler:protected] =>
[data] => Array
(
[status] => 200
[response] => success
)
[headers] => Array
(
)
[status] => 200
)
Also after looking at the times, the second time it fires is 4 minutes later. This is from sandbox and I’m using virtual terminal.
Any idea on why it’s firing a second time 4 minutes later?
The only reason you’d receive another webhook later would be if there was an update event. Do you have the payloads for all the webhook events?