Layermod

Credits

Guthaben abfragen und Credits kaufen

GET /v1/credits/

Ruft den aktuellen Kontostand und die Transaktionshistorie ab.

Antwort

200 OK
{
  "balance": "15000.00",
  "transactions": [
    {
      "id": "ctx_abc123",
      "orgId": "org_xyz",
      "amount": "10000.00",
      "type": "purchase",
      "description": "Credit-Paket: Starter",
      "createdAt": "2026-03-08T12:00:00.000Z"
    },
    {
      "id": "ctx_def456",
      "orgId": "org_xyz",
      "amount": "-27.00",
      "type": "deduction",
      "description": "API-Nutzung: gpt-5.4",
      "createdAt": "2026-03-08T12:05:00.000Z"
    }
  ],
  "packages": [
    {
      "id": "starter",
      "label": "Starter",
      "credits": 10000,
      "price": "9.99"
    }
  ]
}

POST /v1/credits/purchase

Startet einen Credit-Kauf über Mollie.

Anfrage

Request Body
{
  "packageId": "starter"
}
ParameterTypPflichtBeschreibung
packageIdstringJaID des Credit-Pakets

Antwort

200 OK
{
  "paymentId": "tr_abc123",
  "checkoutUrl": "https://checkout.mollie.com/..."
}

Der Benutzer wird zur checkoutUrl weitergeleitet, um die Zahlung abzuschließen.

Fehlercodes

CodeBeschreibung
400Ungültiges Paket
503Zahlungsanbieter nicht konfiguriert

On this page