When I include a value for reference_id in my terminal checkout request, the terminal.checkout.created and terminal.checkout.updated events include this value in [data]->[object]->[reference_id]. However, it is not returned in the payment.created or payment.updated events.
The description of the reference_id field in terminal.checkout.created Webhook - Square API Reference states:
" An optional user-defined reference ID which can be used to associate this
TerminalCheckout to another entity in an external system. For example, an order ID generated by a third-party shopping cart. Will also be associated with any payments used to complete the checkout."
Is this a bug or is there something that I’m not aware of? The payment objects included in payment.created and payment.updated events include the terminal_checkout_id value and therefore the API on your end knows the relationship between the checkout and the payment objects.
I know that I can lookup the checkout object and then retrieve the reference_id from there. However, I would prefer not to make that extra call.
Thanks for your feedback.
I just tested this and do see
reference_id on the second
payment.updated webhook that is fired (I received three total webhooks: 1 created, 2 updated). If you’re not seeing it still, please share a
payment_id and I can take a look in our logs.
I should have mentioned that this is in the sandbox. Not sure if you ran a test there.
The payment_id for the latest test that I did is jfDoFmIYdz1s2lfoz5nIr4QijuUZY. I checked all 3 payment-related events, as you mentioned there are 3 of them, and none of them included the reference_id property. You can see that the reference_id is included in the initial checkout object that triggered those 3 payment events. The checkout id in this case is npV71RgPlyXqO.
Ah, thanks for clarifying! It does appear the
reference_id is not being passed correctly in sandbox, and the team has been notified. I will update this thread when it’s been resolve, but just to confirm: it does work in production, just not in sandbox. Thanks for reporting!
I’m also experiencing the same issue with payment.created and payment.updated webhooks in production for version 2021-03-17. reference_id is nowhere to be found in the data for both created and updated.