Authorize payment. Commit order.

Create bank holds and commit the cart for processing. The cart must be associated with a user session or JWT.

Request Parameters

🏷️ header · unmarked parameters are query params

ParameterTypeRequiredDescription
Locally-Api-Token 🏷️stringYesLocally API token must be passed in the header to authenticate the API consumer.
Locally-Api-Session-Id 🏷️stringYesSession ID must be passed in the header to authorize the user.
Locally-Pl-Jwt 🏷️stringNoJSON Web Token passed in the header to identify the user. Does not expire.
hashstringYesThe cart hash.
first_namestringYesFirst name of the customer.
last_namestringYesLast name of the customer.
full_namestringYesFull name of the customer.
emailstringYesEmail address of the customer.
phonestringNoPhone number with country code of the customer.
addressstringYesAddress of the customer.
citystringYesCity of the customer.
statestringNoState of the customer.
zipintegerYesZIP code of the customer.
countrystringYesCountry code of the customer.
is_opt_in_consentintegerYesFlag indicating customer's consent for marketing emails. 1 for true, 0 for false. One of: 0, 1.
is_opt_in_consent_brandintegerYesFlag indicating customer's consent for brand marketing emails. 1 for true, 0 for false. One of: 0, 1.
setup_intent_idstringYesStripe setup intent ID.

Example Request

curl 'https://www.locally.com/headless/api/1.0/cart/order' \
--request POST \
--header 'Locally-Api-Token: {{API_TOKEN}}' \
--header 'Locally-Api-Session-Id: {{SESSION_ID}}' \
--url-query 'hash={{CART_HASH}}' \
--url-query 'first_name=Jane' \
--url-query 'last_name=Doe' \
--url-query 'full_name=Jane Doe' \
--url-query '[email protected]' \
--url-query 'phone=+15555555555' \
--url-query 'address=123 W Madison St' \
--url-query 'city=Chicago' \
--url-query 'state=IL' \
--url-query 'zip=60602' \
--url-query 'country=US' \
--url-query 'is_opt_in_consent=1' \
--url-query 'is_opt_in_consent_brand=1' \
--url-query 'setup_intent_id={{SETUP_INTENT_ID}}'
const params = new URLSearchParams({
  hash: '{{CART_HASH}}',
  first_name: 'Jane',
  last_name: 'Doe',
  full_name: 'Jane Doe',
  email: '[email protected]',
  phone: '+15555555555',
  address: '123 W Madison St',
  city: 'Chicago',
  state: 'IL',
  zip: '60602',
  country: 'US',
  is_opt_in_consent: '1',
  is_opt_in_consent_brand: '1',
  setup_intent_id: '{{SETUP_INTENT_ID}}'
});

const response = await fetch(`https://www.locally.com/headless/api/1.0/cart/order?${params}`, {
  method: 'POST',
  headers: {
    'Locally-Api-Token': '{{API_TOKEN}}',
    'Locally-Api-Session-Id': '{{SESSION_ID}}'
  }
});
const data = await response.json();
import requests

params = {
    "hash": "{{CART_HASH}}",
    "first_name": "Jane",
    "last_name": "Doe",
    "full_name": "Jane Doe",
    "email": "[email protected]",
    "phone": "+15555555555",
    "address": "123 W Madison St",
    "city": "Chicago",
    "state": "IL",
    "zip": 60602,
    "country": "US",
    "is_opt_in_consent": 1,
    "is_opt_in_consent_brand": 1,
    "setup_intent_id": "{{SETUP_INTENT_ID}}",
}

response = requests.post(
    "https://www.locally.com/headless/api/1.0/cart/order",
    params=params,
    headers={
        "Locally-Api-Token": "{{API_TOKEN}}",
        "Locally-Api-Session-Id": "{{SESSION_ID}}",
    },
)
data = response.json()

The cart identified by hash must already be associated with the shopper's session (Locally-Api-Session-Id) or with a cart JWT passed in the optional Locally-Pl-Jwt header. setup_intent_id is a Stripe setup intent ID — see Creating a BOPIS order for how it is constructed.

Example Response

{
  "success": true,
  "data": {
    "message": "Your order has been placed",
    "target_uri": "/order/QE3QL6/U8KM2P",
    "status_code": 200,
    "session": {
      "id": "vD2kq9mXw4bT7nR5cJ1sL8fA3gH6pZ0yE2uN4iK9"
    }
  },
  "msg": ""
}

Response Explanation

  • success — Boolean outcome of the call. When false, the response also carries a top-level error_code and explanatory msg — always check success, not just the HTTP status.
  • data.message — Shopper-facing order outcome (here Your order has been placed). Placing an order does not capture funds — in most cases Locally captures only after the store confirms stock.
  • data.target_uri — Relative URI of the shopper's order status page on locally.com, built from the cart hash and a buyer-only secret. Send the shopper here to track the order.
  • data.status_code — HTTP-style result of order processing duplicated inside the payload; 200 means the order was placed. Failures surface as a non-200 HTTP response with an error envelope instead.
  • data.session.id — Locally session ID, returned on every response. Replay it via the Locally-Api-Session-Id header to persist the shopper's session between calls; expired IDs are transparently replaced with fresh ones.
  • msg — Human-readable error text; empty string on success. In production, unexpected server errors are masked as App server error with a lookup reference — see Handling Errors in Production.
Query Params
string
required

The cart hash

string
required

First name of the customer

string
required

Last name of the customer

string
required

Full name of the customer

string
required

Email address of the customer

string

Phone number with country code of the customer.

string
required

Address of the customer

string
required

City of the customer

string

State of the customer

int32
required

ZIP code of the customer

string
required

Country code of the customer.

int32
enum
required
Allowed:
int32
enum
required
Allowed:
string
required

Stripe setup intent ID.

Headers
string
required

Locally API token must be passed in the header to authenticate the API consumer

string
required

Session ID must be passed in the header to authorize the user

string

JSON Web Token passed in the header to identify the user. Does not expire.

Responses
200

Successful

400

Bad Request

401

Unauthorized

402

Request Failed

403

Forbidden

404

Not Found

429

Too Many Requests

500

Server Error

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here!