curl --request GET \
--url https://laso.finance/get-purchase-turn \
--header 'Authorization: <api-key>'import requests
url = "https://laso.finance/get-purchase-turn"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://laso.finance/get-purchase-turn', 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://laso.finance/get-purchase-turn",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <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"
"net/http"
"io"
)
func main() {
url := "https://laso.finance/get-purchase-turn"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://laso.finance/get-purchase-turn")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://laso.finance/get-purchase-turn")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"turn_id": "<string>",
"state": "running",
"created_at": 123,
"conversation_id": "<string>",
"status": "needs_input",
"reply": "<string>",
"cart": {
"merchant": "<string>",
"merchant_name": "<string>",
"items": [
{
"name": "<string>",
"quantity": 123,
"price_cents": 123,
"product_id": "<string>"
}
],
"fees_cents": 123,
"tip_cents": 123,
"total_cents": 123,
"approved_ceiling_cents": 123,
"hash": "<string>"
},
"carts": [
{
"merchant": "<string>",
"merchant_name": "<string>",
"items": [
{
"name": "<string>",
"quantity": 123,
"price_cents": 123,
"product_id": "<string>"
}
],
"fees_cents": 123,
"tip_cents": 123,
"total_cents": 123,
"approved_ceiling_cents": 123,
"hash": "<string>"
}
],
"catalog": [
{
"product_id": "<string>",
"name": "<string>",
"price_cents": 123,
"image_url": "<string>"
}
],
"unmatched": [
{
"merchant": "<string>",
"requested": "<string>",
"reason": "not_found",
"detail": "<string>"
}
],
"order_id": "<string>",
"decline_code": "<string>",
"approval_url": "<string>",
"charge_status": "none",
"card_last4": "<string>",
"error_code": "<string>",
"error": "<string>",
"note": "<string>"
}Read a purchase turn that was still running
Reads back a turn from POST /buy-with-saved-card that came back state: running. Poll every few seconds until state is done or failed; the response has the same shape as the POST.
A failed confirm may still have placed the order. Read GET /get-purchase-conversation before sending it again.
curl --request GET \
--url https://laso.finance/get-purchase-turn \
--header 'Authorization: <api-key>'import requests
url = "https://laso.finance/get-purchase-turn"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://laso.finance/get-purchase-turn', 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://laso.finance/get-purchase-turn",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <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"
"net/http"
"io"
)
func main() {
url := "https://laso.finance/get-purchase-turn"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://laso.finance/get-purchase-turn")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://laso.finance/get-purchase-turn")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"turn_id": "<string>",
"state": "running",
"created_at": 123,
"conversation_id": "<string>",
"status": "needs_input",
"reply": "<string>",
"cart": {
"merchant": "<string>",
"merchant_name": "<string>",
"items": [
{
"name": "<string>",
"quantity": 123,
"price_cents": 123,
"product_id": "<string>"
}
],
"fees_cents": 123,
"tip_cents": 123,
"total_cents": 123,
"approved_ceiling_cents": 123,
"hash": "<string>"
},
"carts": [
{
"merchant": "<string>",
"merchant_name": "<string>",
"items": [
{
"name": "<string>",
"quantity": 123,
"price_cents": 123,
"product_id": "<string>"
}
],
"fees_cents": 123,
"tip_cents": 123,
"total_cents": 123,
"approved_ceiling_cents": 123,
"hash": "<string>"
}
],
"catalog": [
{
"product_id": "<string>",
"name": "<string>",
"price_cents": 123,
"image_url": "<string>"
}
],
"unmatched": [
{
"merchant": "<string>",
"requested": "<string>",
"reason": "not_found",
"detail": "<string>"
}
],
"order_id": "<string>",
"decline_code": "<string>",
"approval_url": "<string>",
"charge_status": "none",
"card_last4": "<string>",
"error_code": "<string>",
"error": "<string>",
"note": "<string>"
}Authorizations
Firebase ID token from /auth or any paid route, sent as a Bearer token: Authorization: Bearer <id_token> (the Bearer prefix is required).
Query Parameters
The turn_id from POST /buy-with-saved-card.
Response
The turn.
This turn's id. Poll GET /get-purchase-turn with it while state is running.
running means the turn is still talking to the merchant; the fields below appear once it is done.
running, done, failed Milliseconds since the epoch.
Send it back on every follow-up and on the confirm.
What to do next. needs_input: a question or a cart waiting on a confirm. awaiting_approval: send approval_url to the holder, then repeat the same confirm. in_progress: the order is already being placed; read GET /get-purchase-conversation instead of confirming again. order_placed. declined: see decline_code. conflict: nothing ran, see error_code and confirm the fresh cart's hash. Never branch on reply.
needs_input, awaiting_approval, in_progress, order_placed, declined, conflict The shopping assistant's turn as prose, ready to show the holder.
The most recently shown cart.
Show child attributes
Show child attributes
Every open cart in the conversation, oldest first.
Show child attributes
Show child attributes
The last product search. Empty on a turn that did not search again, so keep the previous one.
Show child attributes
Show child attributes
Things asked for that did not make it into a cart, with a reason. Show these rather than guessing from reply.
Show child attributes
Show child attributes
Set when this turn placed an order.
The machine reason behind declined, e.g. items_unavailable.
Send to the holder when status is awaiting_approval. Never open it yourself.
Whether money moved: none, confirming, settled, or unknown (do not retry; read the conversation).
none, confirming, settled, unknown, null The saved card that paid, for naming it to the holder.
On conflict: cart_changed, turn_in_progress, delivery_address_changed, or delivery_address_bound_after_cart.
Present when state is failed.
The next step.
Was this page helpful?