Documentation
POST /api/samples/checkout
Order a physical sample of a product.
| Request | POST /api/samples/checkout |
|---|---|
| Authentication | Session cookie required |
| Handler | backend/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
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ff_session | cookie | string | Optional | The 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_id | body | string | Required | The product to sample. |
recipient_name | body | string | Required | Who the sample is for. |
address_line | body | string | Required | Street address. |
city | body | string | Required | City. |
postcode | body | string | Required | Postal code. |
country | body | string | Required | Country. |
email | body | string | Required | Where 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
200 — A payment session opened.
| Field | Type | Description |
|---|---|---|
status | string | `checkout_started`. |
payment_url | string | Where to send the browser. |
product_id | string | The product. |
price_eur | number | The sample price. |
Errors
| Status | Reason | When |
|---|---|---|
400 | delivery_required | A delivery field is missing. |
409 | sample_unpriced | The product has no sample price. |
503 | payment_unavailable | Payments are not configured on this machine. |
Related
GET /api/suppliers— Sourcing options for a named product.GET /api/supplier-connection— Which supplier this account is connected to.POST /api/supplier-connection— Connect or disconnect a supplier.
Back to the API reference index, or read the cookbook for recipes that compose this endpoint with others.