Documentation

POST /api/samples/checkout

Order a physical sample of a product.

RequestPOST /api/samples/checkout
AuthenticationSession cookie required
Handlerbackend/sample_market.py

What it does

Opens a payment session for a sample shipped to a real address. A product whose sample cannot be priced is refused as `sample_unpriced` rather than quoted at a guess, and a missing delivery field is refused as `delivery_required`.

Authentication

Session cookie required. Send the ff_session cookie. Without one the engine treats the caller as a new visitor with no holds and no claims, and returns a new cookie to use from then on.

Parameters

ParameterInTypeRequiredDescription
ff_sessioncookiestringOptionalThe session identifier. Omit it on the first call and store the value the response sets; every later call must send the same one or the engine treats the caller as a new visitor with no holds and no claims.
product_idbodystringRequiredThe product to sample.
recipient_namebodystringRequiredWho the sample is for.
address_linebodystringRequiredStreet address.
citybodystringRequiredCity.
postcodebodystringRequiredPostal code.
countrybodystringRequiredCountry.
emailbodystringRequiredWhere the confirmation goes.

Request

The cookie jar carries the session between calls. Angle-bracketed values are the parameter types from the table above.

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"product_id":"<string>","recipient_name":"<string>","address_line":"<string>","city":"<string>","postcode":"<string>","country":"<string>","email":"<string>"}' \
  "https://flowfinds.ai/api/samples/checkout"
const res = await fetch("https://flowfinds.ai/api/samples/checkout", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "product_id": "<string>",
    "recipient_name": "<string>",
    "address_line": "<string>",
    "city": "<string>",
    "postcode": "<string>",
    "country": "<string>",
    "email": "<string>"
  }),
});
const data = await res.json();
import requests

s = requests.Session()
r = s.post("https://flowfinds.ai/api/samples/checkout", json={
    "product_id": "<string>",
    "recipient_name": "<string>",
    "address_line": "<string>",
    "city": "<string>",
    "postcode": "<string>",
    "country": "<string>",
    "email": "<string>"
  })
data = r.json()

Recorded example

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"product_id":"…","recipient_name":"…","address_line":"…","city":"…","postcode":"…","country":"…","email":"[email protected]"}' \
  "$FLOWFINDS_ORIGIN/api/samples/checkout"

Responses

200A payment session opened.

FieldTypeDescription
statusstring`checkout_started`.
payment_urlstringWhere to send the browser.
product_idstringThe product.
price_eurnumberThe sample price.

Errors

StatusReasonWhen
400delivery_requiredA delivery field is missing.
409sample_unpricedThe product has no sample price.
503payment_unavailablePayments are not configured on this machine.

Related

Back to the API reference index, or read the cookbook for recipes that compose this endpoint with others.