> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scalev.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Orders

## Digital Product Orders

### 1. Select a store

Use `GET /v3/stores/simplified`.

Runtime currently supports these filters:

* `search`: filter by store name
* `domain`: filter by store domain

The response also includes:

* `payment_methods`
* `sub_payment_methods`

If you want a dedicated payment-method lookup for a specific store, use:

* `GET /v3/stores/{store_id}/payment-methods`

### 2. Select products or bundles

Use:

* `GET /v3/stores/{store_id}/products` to retrieve individual products
* `GET /v3/stores/{store_id}/bundles` to retrieve bundles

### 3. Build the order payload

For digital product orders, the minimal payload is:

```json theme={null}
{
  "store_unique_id": "store_xxx",
  "customer_name": "John Doe",
  "customer_phone": "62812345678",
  "customer_email": "example@example.com",
  "ordervariants": [
    {
      "quantity": 1,
      "variant_unique_id": "variant_xxx"
    }
  ],
  "payment_method": "invoice"
}
```

Or if you want to use bundles instead of products:

```json theme={null}
{
  "store_unique_id": "store_xxx",
  "customer_name": "John Doe",
  "customer_phone": "62812345678",
  "customer_email": "example@example.com",
  "orderbundles": [
    {
      "quantity": 1,
      "bundle_price_option_unique_id": "bpo_xxx"
    }
  ],
  "payment_method": "invoice"
}
```

### 4. Send the request

Call `POST /v3/orders` with the payload above.

### 5. Redirect the customer to the payment page

The response includes:

* `id` - the canonical UUIDv7 order primary key
* `order_id` - the business-facing order number
* `secret_slug`
* `public_order_url`
* `payment_url`

Use `id` for later business API calls such as `GET /v3/orders/{id}` or `PATCH /v3/orders/{id}`. Legacy numeric order IDs for migrated orders are still accepted on ID routes, but new order responses return UUIDs.

Use `payment_url` for the customer redirect.

***

## Physical Product Orders

### 1–2. Same as digital orders

### 3. Add shipping information

Required additional fields:

* `address`
* `location_id`
* `warehouse_unique_id`
* `shipping_cost`
* `courier_service_id`

Optional fields:

* `postal_code`
* `shipment_provider_code`

How to obtain them:

* `address` -> provide the street address only, without district/city/province details
* `location_id` -> search district using `GET /v3/locations`
* `postal_code` -> if needed, use `GET /v3/locations/{location_id}/postal-codes` or provide the known postal code directly
* `warehouse_unique_id` -> use `POST /v3/shipping-costs/search-warehouse`
* `courier_service_id`, `shipping_cost`, `shipment_provider_code` -> use `POST /v3/shipping-costs/search-courier-service`

### 4. Build the order payload

Minimal example:

```json theme={null}
{
  "store_unique_id": "store_xxx",
  "customer_name": "John Doe",
  "customer_phone": "62812345678",
  "customer_email": "example@example.com",
  "ordervariants": [
    {
      "quantity": 1,
      "variant_unique_id": "variant_xxx"
    }
  ],
  "payment_method": "invoice",
  "address": "Jl. Pegangsaan Timur No. 28",
  "location_id": 1,
  "postal_code": "12345",
  "warehouse_unique_id": "warehouse_xxx",
  "courier_service_id": 1,
  "shipping_cost": 20000,
  "shipment_provider_code": "lincah"
}
```

### 5. Send the request

Call `POST /v3/orders` with the payload above.

### 6. Redirect the customer to the payment page

Use `id` for later business API calls such as `GET /v3/orders/{id}` or `PATCH /v3/orders/{id}`. Legacy numeric order IDs for migrated orders are still accepted on ID routes, but new order responses return UUIDs.

Use `payment_url` from the order-create response.
