Prepoulate cart using an API

I have been given an API endpoint. I am looking to perform a POSTrequest to get a shopping list order and populate this into our webshop and put items from our shop into the basket showing what is in stock and what is out of stock so people can order.

IE people log into a system they choose the requirements they want they click buy and it comes through to our webshop and the cart is prepoulated with what they have chosen, shows what is in and out of stock and the customer can then order direct from us.

How do I achieve this?

: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

Take a Pickup Order and Pay for It
Inventory API Requirements
Order-Ahead Sample Application

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 achieve this, you can use the Square Inventory API and Orders API.

Firstly, you would need to use the Inventory API to track the stock levels of your items. This API allows you to build inventory management solutions, including adding products to inventory, updating inventory by removing damaged items, and viewing inventory counts and changes.

When a customer chooses their requirements and clicks buy, you would then use the Orders API to create an order with these items. The Orders API allows you to create Order objects with line items, fulfillment details, and order summary data.

To show whether an item is in stock or out of stock, you would need to check the inventory count of the item variation in your Square product catalog. If the inventory count is greater than zero, the item is in stock. If the inventory count is zero, the item is out of stock.

Once the order is created, you can then populate the customer’s cart in your webshop with the items from the order. The customer can then proceed to checkout and place the order directly from your webshop.

Remember, you need to have item variations defined in your Square product catalog and your application must have the necessary permissions to read inventory information and update inventory states.

This answer was reviewed by @Bryan-Square.

Also you’ll be using the Catalog API for managing the Catalog items. :slightly_smiling_face:

So, more complicated than I first thought. Is there an easy step by step guide on how to do this?

When you get the order from the customer through your endpoint ideally they should map to the item variations in the Square Catalog.

Then you can call the Inventory API to see if it’s in stock. If the item is in stock then you add the item to an order using the Orders API.

Once the order is fully built you’ll use the Payments API to pay for the order.

There are other things you will have to take into consideration. For example how the customer is going to pay. Are they using a stored card on file or will they be keying the card information in. For storing a card on file you’ll use the Cards API and if the customer needs to key the card in you’ll use the Web Payments SDK. :slightly_smiling_face:

Where can I hire somebody to do this for me as I cant seem to get it to work and need someone wiht a good knowledge to build it

You can source developers from our Solutions Directory. :slightly_smiling_face: