Skip to main content
POST
/
locations
/
{locationId}
/
ordering-sessions
Start an ordering session
curl --request POST \
  --url https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "fulfillmentMethod": "pickup",
  "marketplaceId": "web",
  "metadata": {
    "channel": "qr"
  }
}
'
import requests

url = "https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions"

payload = {
"fulfillmentMethod": "pickup",
"marketplaceId": "web",
"metadata": { "channel": "qr" }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fulfillmentMethod: 'pickup', marketplaceId: 'web', metadata: {channel: 'qr'}})
};

fetch('https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fulfillmentMethod' => 'pickup',
'marketplaceId' => 'web',
'metadata' => [
'channel' => 'qr'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions"

payload := strings.NewReader("{\n \"fulfillmentMethod\": \"pickup\",\n \"marketplaceId\": \"web\",\n \"metadata\": {\n \"channel\": \"qr\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fulfillmentMethod\": \"pickup\",\n \"marketplaceId\": \"web\",\n \"metadata\": {\n \"channel\": \"qr\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.craveup.com/api/v1/locations/{locationId}/ordering-sessions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fulfillmentMethod\": \"pickup\",\n \"marketplaceId\": \"web\",\n \"metadata\": {\n \"channel\": \"qr\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "cartId": "cart_123",
  "errorMessage": ""
}
{
"success": false,
"message": "Unauthorized access",
"code": "UNAUTHORIZED"
}
{
"success": false,
"message": "An unexpected error occurred",
"code": "GENERIC_ERROR"
}

Authorizations

X-API-Key
string
header
required

API Key required to authenticate requests

Path Parameters

locationId
string
required

Body

application/json
fulfillmentMethod
string
required

Fulfillment method requested by the shopper (for example pickup, delivery).

Example:

"pickup"

marketplaceId
string | null

Optional identifier describing the sales channel initiating the session.

Example:

"web"

existingCartId
string | null

Resume an existing cart when provided. If not found, a new cart is created.

Example:

"cart_123"

metadata
object | null

Arbitrary metadata to persist on the cart. Keys must be strings.

Example:
{ "referrer": "homepage" }
returnUrl
string | null

URL to redirect the shopper after a hosted checkout flow finishes.

Example:

"https://yourapp.com/checkout/success"

Response

Ordering session created.

cartId
string | null

ID of the active cart. Null when ordering is unavailable.

Example:

"cart_123"

errorMessage
string

Message describing why ordering is unavailable. Empty string on success.

Example:

""