Émettre un reçu
curl --request POST \
--url https://api.truthlocks.com/v1/receipts \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-API-Key: <api-key>' \
--data '
{
"issuer_id": "<string>",
"kid": "<string>",
"payload": "<unknown>",
"receipt_type": "<string>",
"subject": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
issuer_id: '<string>',
kid: '<string>',
payload: '<unknown>',
receipt_type: '<string>',
subject: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/receipts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/receipts"
payload = {
"issuer_id": "<string>",
"kid": "<string>",
"payload": "<unknown>",
"receipt_type": "<string>",
"subject": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/receipts"
payload := strings.NewReader("{\n \"issuer_id\": \"<string>\",\n \"kid\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"receipt_type\": \"<string>\",\n \"subject\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"receipt_id": "<string>",
"receipt_type": "<string>",
"status": "<string>",
"issuer_id": "<string>",
"subject": "<string>",
"signature": {
"alg": "<string>",
"kid": "<string>",
"value": "<string>"
},
"issued_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Reçus
Émettre un reçu
Créer un événement de reçu signé cryptographiquement et ancré dans un journal de transparence.
POST
/
v1
/
receipts
Émettre un reçu
curl --request POST \
--url https://api.truthlocks.com/v1/receipts \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-API-Key: <api-key>' \
--data '
{
"issuer_id": "<string>",
"kid": "<string>",
"payload": "<unknown>",
"receipt_type": "<string>",
"subject": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
issuer_id: '<string>',
kid: '<string>',
payload: '<unknown>',
receipt_type: '<string>',
subject: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/receipts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/receipts"
payload = {
"issuer_id": "<string>",
"kid": "<string>",
"payload": "<unknown>",
"receipt_type": "<string>",
"subject": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/receipts"
payload := strings.NewReader("{\n \"issuer_id\": \"<string>\",\n \"kid\": \"<string>\",\n \"payload\": \"<unknown>\",\n \"receipt_type\": \"<string>\",\n \"subject\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"receipt_id": "<string>",
"receipt_type": "<string>",
"status": "<string>",
"issuer_id": "<string>",
"subject": "<string>",
"signature": {
"alg": "<string>",
"kid": "<string>",
"value": "<string>"
},
"issued_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Crée un événement de reçu signé cryptographiquement et ancré dans le journal de transparence. Les reçus sont validés par rapport au schéma de type de reçu enregistré avant la signature.
Types de reçus
| Type | Nom | Champs obligatoires |
|---|---|---|
payment_receipt | Reçu de paiement | amount, currency, provider, provider_reference, subject |
security_event_receipt | Reçu d’événement de sécurité | event_type, severity, subject, outcome |
delivery_receipt | Accusé de réception | item_reference, recipient, delivery_method, delivered_at |
compliance_receipt | Reçu de conformité | check_type, subject, result, framework |
custom_receipt | Reçu personnalisé | subject, event |
En-têtes
Réponse
Événement de webhook
Un événement de webhookreceipt.created est livré à tous les points de terminaison configurés après une frappe réussie.Corps
application/json

