E-commerce
E-commerce
The e-commerce API provides comprehensive shopping cart and payment processing capabilities with Stripe integration.
POST/ecommerce/createOrder
Creates a new order in the system.
Request Body
{
"customerID": 123,
"items": [
{
"productID": 101,
"quantity": 2,
"price": 299.99
},
{
"productID": 102,
"quantity": 1,
"price": 399.99
}
],
"shippingAddress": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"zip": "10001",
"country": "USA"
},
"billingAddress": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"zip": "10001",
"country": "USA"
}
}
Success Response (201 Created)
{
"status": "Success",
"data": {
"orderID": 5001,
"orderNumber": "ORD-2024-5001",
"total": 999.97,
"status": "pending"
}
}
Cart Management
POST/ecommerce/addCart
Adds an item to the shopping cart.
{
"sessionID": "cart_session_123",
"productID": 101,
"quantity": 1,
"price": 299.99
}
POST/ecommerce/removeCart
Removes an item from the shopping cart.
{
"sessionID": "cart_session_123",
"productID": 101
}
POST/ecommerce/getOrder
Retrieves order details.
{
"orderID": 5001
}
Payment Processing
POST/ecommerce/createPaymentIntent
Creates a Stripe payment intent for processing payment.
Request Body
{
"amount": 99997,
"currency": "usd",
"orderID": 5001,
"customerID": 123
}
Success Response (200 OK)
{
"status": "Success",
"data": {
"clientSecret": "pi_xxxxxxxxxxxxx_secret_xxxxxxxxxxxxx",
"paymentIntentID": "pi_xxxxxxxxxxxxx"
}
}
POST/ecommerce/paymentComplete
Confirms payment completion and updates order status.
Request Body
{
"paymentIntentID": "pi_xxxxxxxxxxxxx",
"orderID": 5001
}
POST/ecommerce/submitOrder
Finalizes and submits the order for processing.
Request Body
{
"orderID": 5001,
"paymentMethod": "stripe",
"notes": "Please deliver after 5 PM"
}
GET/ecommerce/genCode/:id
Generates a QR code for an order or product.
URL Parameters
-
id
number
required
Order ID or product ID for QR code generation.
Success Response
Returns a QR code image in PNG format.