square/connect-php-sdk

Need clarification on creating a checkout with CheckoutAPI.

Closed this issue · 1 comments

Created this issue on SO.

Basically I need to know what name should be passed to the name property of the object contained in the line_items array. Is this the item name or is this the variation name?

Does the square checkout page handle the selection of variation items? I wouldn't think so because the pricing information needs to be passed to the initial post request... Or should I simply use the item name and set the price to be equal to the variation the user selects?

Hello, thanks for your question. You can add two types of items to an order for processing using the checkout page (or for that matter, the charge API). Those items can be ad hoc where you set the name and other properties (such as price, variation name, etc) manually and they don't get identified with any other items in catalog. If you already have items defined in your Square store (catalog), all you need to do is specify the catalog_object_id property with the variation ID (If you have a variation with a variable rather than fixed pricing type, you should also set base_price_money). For more information about the difference between ad hoc and catalog items in orders, see the https://docs.connect.squareup.com/articles/orders-api-overview?q=ad%20hoc#using-ad-hoc-definitions-versus-catalog-references page. Hope this helps.