Read a purchase turn that was still running
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>"
}Cards
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.
GET
/
get-purchase-turn
Read a purchase turn that was still running
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
Response
The turn.
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.
Available options:
needs_input, awaiting_approval, in_progress, order_placed, declined, conflict Was this page helpful?