How this store connects:
- Front-End Display: Hosted on
buy.lopeznetwork.com, fetched from ColdFusion REST Endpoint.
- ColdFusion REST CFC:
inventory.cfc handles database CRUD for items & stock validation.
- Checkout Aggregation: Passes order items to either Square Web Payments API or Wix Headless Cart SDK.
- Post-Checkout Webhook: Square/Wix fires a webhook back to
/api/webhooks.cfc to decrement live inventory.
Sample ColdFusion REST Component (inventory.cfc)
<!--- ColdFusion REST Service Sample for buy.lopeznetwork.com --->
<cfcomponent restpath="/inventory" rest="true">
<cffunction name="getProducts" access="remote" returntype="array" httpmethod="GET" produces="application/json">
<cfquery name="qry" datasource="Lopez3DStore">
SELECT id, name, category, price, stock_qty, filament, image_url, description
FROM products
WHERE is_active = 1
</cfquery>
<return qry />
</cffunction>
<cffunction name="updateStock" access="remote" returntype="struct" httpmethod="POST" produces="application/json">
<cfargument name="productId" type="numeric" required="true">
<cfargument name="newQty" type="numeric" required="true">
<cfquery datasource="Lopez3DStore">
UPDATE products
SET stock_qty = <cfqueryparam value="#arguments.newQty#" cfsqltype="cf_sql_integer">
WHERE id = <cfqueryparam value="#arguments.productId#" cfsqltype="cf_sql_integer">
</cfquery>
<cfreturn {"status": "success", "productId": arguments.productId, "updatedStock": arguments.newQty} />
</cffunction>
</cfcomponent>