Subscription with Pay first, customer upon webhook

Reading around some, I have not found this setup yet.

My public landing page hosts a signup button (only) that goes to Square via a payment link I setup on the backend when handling the button click. There is no user data on my system and no account for their subscription is setup at this point. I am aiming for just the signup button and no other form fields at this point.

They do the Square thing and get redirected to my success page. I tell them I will send an email.

When the payment.updated webhook fires, I store the data, fire off a HTTP200 to the webhook, then use their email to create an account on my server. This does an initial password and the email as a temp username.

I am adding a second system for free accounts to upgrade, but I have some acct data for these folks and pass that along to get it in the payment.updated webhook. This part works.

Overall, I would like to assign the account ID to their membership, so that future webhooks can be applied to their account.

I am lost as to what data tracks where to get from the payment object to the subscription object.

Near as I can tell from forum answers, I need to create a new customer (no real data) every time I make the payment link and redirect the user in the hopes they complete the order. This seems excessive, so along with confirming this idea, can I somehow get the subscription ID from the Payment.Created webhook event by tracing through some chain of related data? I see the order, but that API does not have the customer. Tracing the subscription API backwards, I seem to need the Customer who is not in the Payment or Order responses.

Is the only way to do this frictionless signup would be to create a customer and store them as I create the payment link by API and redirect?

Being an automated subscription for web access, I need to ensure that I am tracking customers, subscriptions, payments and the like automatically.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Onboard to Square Appointments
Use Webhooks to Integrate with a Payroll System
Subscription Plan Checkout

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To track a subscription from a payment, you query for the subscription by customer_id with SearchSubscriptions. The customer_id will be included in the webhook payload. :slightly_smiling_face:

1 Like

Thank you for this!

The API docs do not reflect the customer_id in the response payload:

I will run a test and capture the response to find the correct location for it in the data object (I presume it is in the data object).