Offers
A page the customer opens to accept and pay. Send it, or withdraw it.
List offers
GET /v1/offers
Key scope offers:read
Newest first, 20 at a time. See pagination.
Query: status, customer, number, limit, starting_after
curl "https://api.invoicing.respiresoft.com/v1/offers?limit=10" \
-H "Authorization: Bearer $RESPIRESOFT_KEY"const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers?limit=10", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers?limit=10");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("GET", "https://api.invoicing.respiresoft.com/v1/offers?limit=10",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
)
data = res.json()Retrieve offer
GET /v1/offers/{id}
Key scope offers:read
curl "https://api.invoicing.respiresoft.com/v1/offers/ID" \
-H "Authorization: Bearer $RESPIRESOFT_KEY"const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers/ID", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers/ID");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("GET", "https://api.invoicing.respiresoft.com/v1/offers/ID",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
)
data = res.json()Create offer
POST /v1/offers
Key scope offers:write. Send an Idempotency-Key header
| Field | Type | Meaning |
|---|---|---|
customer | string | |
currency required | string | ISO 4217 code, for example EUR. |
title | string | |
lines | array | Rows like those of an invoice. |
curl -X POST "https://api.invoicing.respiresoft.com/v1/offers" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"customer":"cus_…","currency":"EUR","title":"Annual plan"}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"customer": "cus_…",
"currency": "EUR",
"title": "Annual plan"
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"customer" => "cus_…",
"currency" => "EUR",
"title" => "Annual plan",
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/offers",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"customer": "cus_…",
"currency": "EUR",
"title": "Annual plan"
},
)
data = res.json()Update offer
PATCH /v1/offers/{id}
Key scope offers:write
Send only what changes. POST to the same address works too.
| Field | Type | Meaning |
|---|---|---|
customer | string | |
currency | string | ISO 4217 code, for example EUR. |
title | string | |
lines | array | Rows like those of an invoice. |
curl -X PATCH "https://api.invoicing.respiresoft.com/v1/offers/ID" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Content-Type: application/json" \
-d '{"customer":"cus_…","currency":"EUR","title":"Annual plan"}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers/ID", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"customer": "cus_…",
"currency": "EUR",
"title": "Annual plan"
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers/ID");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"customer" => "cus_…",
"currency" => "EUR",
"title" => "Annual plan",
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("PATCH", "https://api.invoicing.respiresoft.com/v1/offers/ID",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
json={
"customer": "cus_…",
"currency": "EUR",
"title": "Annual plan"
},
)
data = res.json()Delete offer
DELETE /v1/offers/{id}
Key scope offers:write
curl -X DELETE "https://api.invoicing.respiresoft.com/v1/offers/ID" \
-H "Authorization: Bearer $RESPIRESOFT_KEY"const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers/ID", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
},
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers/ID");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("DELETE", "https://api.invoicing.respiresoft.com/v1/offers/ID",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
},
)
data = res.json()Send an offer
POST /v1/offers/{id}/send
Key scope offers:write. Send an Idempotency-Key header
| Field | Type | Meaning |
|---|---|---|
email | boolean | Email it to the customer (default true). |
curl -X POST "https://api.invoicing.respiresoft.com/v1/offers/ID/send" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"email":true}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers/ID/send", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"email": true
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers/ID/send");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"email" => true,
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/offers/ID/send",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"email": True
},
)
data = res.json()Withdraw an offer
POST /v1/offers/{id}/withdraw
Key scope offers:write. Send an Idempotency-Key header
| Field | Type | Meaning |
|---|---|---|
reason | string |
curl -X POST "https://api.invoicing.respiresoft.com/v1/offers/ID/withdraw" \
-H "Authorization: Bearer $RESPIRESOFT_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"reason":"Replaced by a new offer"}'const res = await fetch("https://api.invoicing.respiresoft.com/v1/offers/ID/withdraw", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"reason": "Replaced by a new offer"
}),
})
const data = await res.json()
if (!res.ok) throw new Error(data.detail) // RFC 9457 problem document$ch = curl_init("https://api.invoicing.respiresoft.com/v1/offers/ID/withdraw");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("RESPIRESOFT_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"reason" => "Replaced by a new offer",
]),
]);
$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.request("POST", "https://api.invoicing.respiresoft.com/v1/offers/ID/withdraw",
headers={
"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"reason": "Replaced by a new offer"
},
)
data = res.json()