create-order
Method: POST
Path: /orders
Tags: Orders
Summary
Create order
Description
Create new order
Storefront SDK Usage
SDK Method: sdk.order.createOrder()
Example:
typescript
// Example with PayU payment gateway
const { data, error } = await sdk.order.createOrder({
cart_id: "cart_01H9XYZ12345ABCDE",
payment_gateway: "PAYU",
payment_gateway_params: {
payment_gateway: "PAYU",
furl: "https://yourapp.com/payment/failure",
surl: "https://yourapp.com/payment/success"
}
});
// Example with Juspay payment gateway
const { data, error } = await sdk.order.createOrder({
cart_id: "cart_01H9XYZ12345ABCDE",
payment_gateway: "JUSPAY",
payment_gateway_params: {
payment_gateway: "JUSPAY",
action: "paymentPage",
integration_type: "hyper-checkout",
return_url: "https://yourapp.com/payment/return",
gateway_reference_id: "juspay_gateway_ref_123"
}
});
if (error) {
console.error("Failed to create order:", error.message);
} else {
console.log("Order created:", data.order.id);
console.log("Payment required:", data.payment_required);
console.log("Payment info:", data.payment_info);
}TypeScript Definition
typescript
"create-order": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** @description Request body */
requestBody: {
content: {
"application/json": {
cart_id: string;
payment_method?: components["schemas"]["PaymentMethodPayload"];
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
order: components["schemas"]["Order"];
payment_required: boolean;
payment_info: components["schemas"]["JusPayHyperCheckoutResponse"] | components["schemas"]["JusPayExpressCheckoutResponse"] | components["schemas"]["PayuPaymentInfo"];
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["PaymentMethodPayload"] | PaymentMethodPayload |
components["schemas"]["Order"] | Order |
components["schemas"]["JusPayHyperCheckoutResponse"] | JusPayHyperCheckoutResponse |
components["schemas"]["JusPayExpressCheckoutResponse"] | JusPayExpressCheckoutResponse |
components["schemas"]["PayuPaymentInfo"] | PayuPaymentInfo |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
Request Body
Request body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
OpenAPI Definition
json
{
"tags": [
"Orders"
],
"operationId": "create-order",
"summary": "Create order",
"description": "Create new order",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/create-order",
"description": "API reference for the create-order operation"
},
"requestBody": {
"description": "Request body",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"cart_id"
],
"properties": {
"cart_id": {
"type": "string"
},
"payment_method": {
"$ref": "#/components/schemas/PaymentMethodPayload"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"order": {
"$ref": "#/components/schemas/Order"
},
"payment_required": {
"type": "boolean"
},
"payment_info": {
"oneOf": [
{
"$ref": "#/components/schemas/JusPayHyperCheckoutResponse"
},
{
"$ref": "#/components/schemas/JusPayExpressCheckoutResponse"
},
{
"$ref": "#/components/schemas/PayuPaymentInfo"
}
]
}
},
"required": [
"order",
"payment_required",
"payment_info"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "orders",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "createOrder"
}Auto-generated from OpenAPI spec and TypeScript definitions