Discord Bot for handeling subscriptions


I was asked to create a discord Bot which would give access to those who subscribe to a payment plan.
My immediate thought was to ask every new user who joins discord for their order number so I can connect the discord userid with an order number.But soon I discovered that if a payment plan gives out a free trial for X days, it doesnt give them an order number, it only does when they actually pay after the free trial.
So, my second thought was that I should ask for their customer ID on square and connect that to the discord userid.My question would be, whether the customers have access to their customer ID or is it something that only the seller can see?Is my way of thinking correct or is there a better way?

The way I would prefer the bot to work is :
1,Somebody joins the discord server, the bot sends a DM asking for their orderID,customerID(or something)
2, The bot does an API call to check if the customer is an active sub.
3,If he is an active sub, it grants a discord role.

:wave: At this time only the seller has access to the Square customer_id with our APIs. If you need to get access to the sellers customers_ids your app will need to use OAuth to then pull in the customer_ids for that merchants account. :slightly_smiling_face:

As Bryan mentioned, the customers don’t have access to the customer ID.

My guess would be to gather email or phone from Discord, and search for a matching customer using the SearchCustomers end point, with the email as the query parameter.

But to be certain, could you please share more details on the workflow for how the customers subscribe to the payment plan? Is it through a custom website, or through Square Online website? Is a new customer being created at the time of subscribing, with email/phone details being collected?

Also, assuming you somehow get the customer_id, how would you know if the customer is still in the free trial phase? Is that association stored outside the Square system?

Is it possible to keep track of active subscriptions with an email address ?
What I mean is if I have an email address that was used on square, if I search for a customer with that email I will receive back whether they are actively subbed or not?

Its through square itself, there is no website built around it. Its just a link for the subscription plan.

I was hoping that a customer gets created in the square system when somebody joins with a free trial phase,and than with a search for customer I would receive back whether they are in free trial phase , already payed or cancelled.There arent any stores outside square. Everything is done in square.

With Square you’ll want to keep track of subscriptions with the Subscriptions API. In the subscription objects there will be a customer_id that you can use to map back to the customer profile with the Customers API. :slightly_smiling_face:

Alright, I will check it out.