When you use the interface to “create a checkout link” for any item in your store, square creates a referral link to “https://checkout.square.site/buy/”.
I can not seem to nail down the time to live on that link, after creating a product, variation, and associating stock. Sometimes the link is up quickly, sometimes not.
The project requires that the sale of a specific product, be purchased during a limited window of time (10-15 minutes max).
My workflow, which i am open for suggestions on how to modify, is as follows:
just befor the timed sale is to begin, the the api is utilized to
create a product and variation, associated to a pre-existing category and location
a modifier for a shipping fee is created (some customers are local and will want to pick up)
available stock is assigned to the product.
the response for these actions is recorded in our db,
during the timed sale, when a customer navigates to a static url on our site, the currently active sale item’s id’s are used to forward the customer to the active checkout link
when a sale occurs, a webhook for stock adjustment is used to adjust the available quantity in our db which we display to customers.
7 .once the timer on the sale runs out, or sales have depleted the stock the sale ends.
- Product, variation, and modifier are then deleted via api.
The issue is that the checkout link sometimes works during the sale window, and sometimes does not.
The sales occur over live stream and can vary, so on-the-fly creation or atleast activation, needs to occur. Customers need to have a single link that they can click on that directs them to the active sale item, which we handle via redirect from our site, but the active sale link need to be live.
Ive considered instead of creating parent, and variation, simply using static parent object, and creating a variation. As well the same function with a modifer may work…
@Lance-Square you suggest, ill code and test…lol.