Webhooks for recurring payments

Hi, I’m trying to do a simple integration for recurring payments using this article: https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout.

I’m a bit lost and would really appreciate some clarifications.

Which webhook should I check and what data to make sure that payment was made? Will payment.updated and “status”: “COMPLETED” be okay?

What webhook will be sent for next period payment? Can somebody show me example of initial webhook and the next one?

Is there a page where I can view list of sandbox payments and subscriptions?

Thank you in advance.

Yes, the payment.updated and payment.created events will fire every time a payment is made for a subscription. Also an invoices.paymet.made event will trigger as well.

For a seller view of subscriptions and payments you can see them in the Square Sandbox Seller Dashboard. Also if you want example webhook payloads you can send test events from the webhooks subscription. :slightly_smiling_face:

Thank you for answering me.
In webhook payload there is event_id, data.id and data.order_id. Could you tell me which one will stay the same for all subsequent payments and which will be unique to individual payment? I wasn’t able to find answer for it myself, thanks.

Those values will change with every unique payment. Were you expecting one of the IDs to stay the same? :slightly_smiling_face:

For initial payment I have order_id generated with payment link so I can compare it to a webhook data but how can I identify future payments? I need some common id to link first payment to future recurring payments. How else can I process recurring payments webhooks?

You’ll use the subscription_id track any further payments associated to the subscription. The invoices events will have the subscription_id associated to the payments. :slightly_smiling_face:

With initial subscription payment I only get order.* and payment.* webhooks and I’ve subscribed to all webhook events possible. There is no subscription_id in those events data. How can I get it?

You didn’t get a subscription.created event? :slightly_smiling_face:

I didn’t get any subscription.* event for any of sandbox subscription payments. I’ve subscribed to all events and created requests according to the article I’ve linked before. What can be wrong?

What’s your application ID? :slightly_smiling_face:

ID: sandbox-sq0idb-8qp-xR55PsSdUt_41lxx6g
Currently url for webhook subscription is incorrect, there was the same result with correct one and there is no subscription.* event in webhook logs.

Oh, are these subscriptions created with CreatePaymentLink? If so this is a gap in Sandbox. They won’t trigger a subscription webhook. However they do trigger them in production. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. :slightly_smiling_face:

Yes, it’s created with CreatePaymentLink. I can delay integration for a few weeks but I would prefer it to be fully functional in dev mode. Can I get notified when it’s solved?

Okay, unfortunately this isn’t a quick fix and we don’t currently have a timeline for a fix. :slightly_smiling_face: