# Subscription with Pay first, customer upon webhook

**URL:** <https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [June 7, 2024, 6:41pm UTC](https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085 "2024-06-07T18:41:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slag](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Slag](https://developer.squareup.com/forums/u/Slag)\
**Post date:** [June 7, 2024, 6:41pm UTC](https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085/1 "2024-06-07T18:41:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [June 7, 2024, 6:41pm UTC](https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085/2 "2024-06-07T18:41:58Z")

</div>

👋 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:

> **[Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks)**
>
> Learn how to configure webhooks to get notified of events when a customer profile is created, updated, deleted, or merged.

> **[Payments API Webhooks](https://developer.squareup.com/docs/payments-api/webhooks)**
>
> Learn about the Square webhook notifications supported by the Payments API.

> **Additional Documentation**
>
> [Onboard to Square Appointments](https://developer.squareup.com/docs/bookings-api/onboard-to-the-api)  
> [Use Webhooks to Integrate with a Payroll System](https://developer.squareup.com/docs/labor-api/webhooks)  
> [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/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.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [June 7, 2024, 6:59pm UTC](https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085/3 "2024-06-07T18:59:04Z")

</div>

To track a subscription from a payment, you query for the subscription by `customer_id` with [SearchSubscriptions](https://developer.squareup.com/reference/square/subscriptions-api/search-subscriptions). The `customer_id` will be included in the webhook payload. 🙂

---

<div class="post-metadata">

**Author:** ![Slag](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Slag](https://developer.squareup.com/forums/u/Slag)\
**Post date:** [June 7, 2024, 7:12pm UTC](https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085/4 "2024-06-07T19:12:12Z")

</div>

Thank you for this!

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

[https://developer.squareup.com/reference/square/payments-api/webhooks/payment.updated](https://developer.squareup.com/reference/square/payments-api/webhooks/payment.updated)

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).

---

<div class="post-metadata">

**Author:** ![Dmitry](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@Dmitry](https://developer.squareup.com/forums/u/Dmitry)\
**Post date:** [June 26, 2024, 12:02pm UTC](https://developer.squareup.com/forums/t/subscription-with-pay-first-customer-upon-webhook/17085/5 "2024-06-26T12:02:28Z")

</div>

Hello @Bryan-Square

I’m using Sandbox.

I use **CreatePaymentLink API** to get url and redirect users to Square’s hosted payment. I also configured all needed webhooks

But when I do a test payments I see only several webhooks were fired:  
**order.created**  
**order.updated**  
**payment.created**  
**payment.updated**

and I expected to see **customer.created** webhook because I left empty **customer\_id** when I created **CreatePaymentLink**

I’d appreciate any help!
