Skip to content

Place Order

Create an order from the shopping cart. This completes the checkout process.

Endpoint

POST /api/shop/checkout/order

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationYesBearer token (customer login required)

Request Body

json
{
  "shippingMethodCode": "flatrate_flatrate",
  "paymentMethod": "paypal"
}

Request Parameters

ParameterTypeRequiredDescription
shippingMethodCodestringYesCode of selected shipping method
paymentMethodstringYesSelected payment method

Response Fields (200-201 Created)

FieldTypeDescription
orderobjectCreated order details
redirectstringPayment redirect URL (if needed)
messagestringSuccess message

Order Fields

FieldTypeDescription
idintegerOrder ID
incrementIdstringOrder increment ID
statusstringOrder status
grandTotaldecimalTotal amount
itemsCountintegerNumber of items
createdAtstringCreation timestamp
invoiceUrlstringInvoice download URL

Order Status Values

  • pending - Awaiting payment confirmation
  • processing - Payment confirmed, preparing shipment
  • shipped - Order shipped
  • delivered - Order delivered
  • canceled - Order canceled
  • failed - Payment failed

Pre-requisites

All of these must be completed before placing order:

  1. Cart must have items
  2. Shipping address must be set
  3. Shipping method must be selected
  4. Billing address must be set
  5. Payment method must be selected
  6. All items in stock

After Order Placement

  • Cart is automatically cleared
  • Customer receives confirmation email
  • Order status can be tracked
  • Invoice becomes available
  • Payment processing may redirect customer

Validation Rules

  • Cart cannot be empty
  • All addresses must be complete
  • Inventory must be available for all items
  • Shipping method must match location
  • Payment method must be valid

Use Cases

  • Complete customer checkout
  • Create order for in-store pickup
  • Process cash on delivery
  • Execute payment gateway transaction
  • Generate order confirmation and invoice

Released under the MIT License.