RespireSoft InvoicingAPI docsReferenceWebhooks

Idempotency

A network can fail after we did the work. A retry with the same key gives you the same answer instead of doing it twice.

Add Idempotency-Key: <a unique value> to every POST, for example a UUID or an id from your own order. It is required: a POST without it gets 400 idempotency_key_required. The value can be up to 255 characters. We keep the answer of the first request with that key for 24 hours.

curl
curl -X POST https://api.invoicing.respiresoft.com/v1/payment_requests \
  -H "Authorization: Bearer $RESPIRESOFT_KEY" \
  -H "Idempotency-Key: order-1042-deposit" \
  -H "Content-Type: application/json" \
  -d '{"amount":2500,"currency":"EUR","title":"Deposit"}'
Node
await fetch("https://api.invoicing.respiresoft.com/v1/payment_requests", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}`,
    "Idempotency-Key": "order-1042-deposit", // derive it from your own order id so a retry reuses it
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ amount: 2500, currency: "EUR", title: "Deposit" }),
})
PHP
$ch = curl_init("https://api.invoicing.respiresoft.com/v1/payment_requests");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("RESPIRESOFT_KEY"), "Idempotency-Key: order-1042-deposit", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => json_encode(["amount" => 2500, "currency" => "EUR", "title" => "Deposit"]),
]);
$data = json_decode(curl_exec($ch), true);
Python
import os, requests
requests.post("https://api.invoicing.respiresoft.com/v1/payment_requests",
              headers={"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"], "Idempotency-Key": "order-1042-deposit"},
              json={"amount": 2500, "currency": "EUR", "title": "Deposit"})

GET, PATCH and DELETE are safe to repeat and need no key.