Späw Documentation
Ressources

Mandats

Le mandat est l'autorisation donnée par votre client de prélever son compte. Sans mandat actif, aucun prélèvement.

Enregistrer un mandat

POST/v1/mandates

L'IBAN est transmis au prestataire bancaire, puis oublié : il n'est jamais conservé ni renvoyé en entier. Un mandat identique déjà actif pour ce client est renvoyé tel quel.

Paramètres

customeridentifiantobligatoire
Le client titulaire du compte.
ibantexteobligatoire
IBAN d'un pays de la zone SEPA. Les espaces sont acceptés.
acceptance.typetexteobligatoire
online : le client a validé le mandat sur votre page. offline : vous détenez un mandat signé.
acceptance.iptexte
Adresse IP du client au moment de la validation. Obligatoire pour online.
acceptance.user_agenttexte
Navigateur du client, conservé comme preuve.
acceptance.signed_ondate
Date de signature, AAAA-MM-JJ. Obligatoire pour offline.
providertexte
Prestataire à utiliser (stripe, gocardless, mollie). Par défaut : celui de votre compte.
curl -X POST https://xn--spw-rla.com/v1/mandates \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "cus_42",
    "iban": "FR1420041010050500013M02606",
    "acceptance": {
      "type": "online",
      "ip": "203.0.113.7",
      "user_agent": "Mozilla/5.0"
    }
  }'
const res = await fetch('https://xn--spw-rla.com/v1/mandates', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "customer": "cus_42",
    "iban": "FR1420041010050500013M02606",
    "acceptance": {
      "type": "online",
      "ip": "203.0.113.7",
      "user_agent": "Mozilla/5.0"
    }
  }),
});
const data = await res.json();
Réponse · 201
{
  "id": "mdt_17",
  "object": "mandate",
  "customer": "cus_42",
  "status": "active",
  "scheme": "sepa_core",
  "reference": "PF0003-9C41D2E07A5B6F18",
  "bank_account": {
    "country": "FR",
    "last4": "2606"
  },
  "acceptance": {
    "type": "online",
    "accepted_at": "2026-11-16T09:13:02.000Z"
  },
  "provider": "gocardless",
  "created": "2026-11-16T09:13:02.000Z",
  "cancelled_at": null
}

Lire un mandat

GET/v1/mandates/:id

États possibles : active, cancelled (révoqué par vous ou par le client), failed (invalidé par la banque).

curl https://xn--spw-rla.com/v1/mandates/mdt_17 \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE"
const res = await fetch('https://xn--spw-rla.com/v1/mandates/mdt_17', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
  },
});
const data = await res.json();
Réponse · 200
{
  "id": "mdt_17",
  "object": "mandate",
  "customer": "cus_42",
  "status": "active",
  "scheme": "sepa_core",
  "reference": "PF0003-9C41D2E07A5B6F18",
  "bank_account": {
    "country": "FR",
    "last4": "2606"
  },
  "acceptance": {
    "type": "online",
    "accepted_at": "2026-11-16T09:13:02.000Z"
  },
  "provider": "gocardless",
  "created": "2026-11-16T09:13:02.000Z",
  "cancelled_at": null
}

Révoquer un mandat

POST/v1/mandates/:id/cancel

Le mandat est annulé chez le prestataire et tous ses abonnements sont arrêtés. Irréversible.

curl -X POST https://xn--spw-rla.com/v1/mandates/mdt_17/cancel \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE"
const res = await fetch('https://xn--spw-rla.com/v1/mandates/mdt_17/cancel', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
  },
});
const data = await res.json();
Réponse · 200
{
  "id": "mdt_17",
  "object": "mandate",
  "customer": "cus_42",
  "status": "cancelled",
  "scheme": "sepa_core",
  "reference": "PF0003-9C41D2E07A5B6F18",
  "bank_account": {
    "country": "FR",
    "last4": "2606"
  },
  "acceptance": {
    "type": "online",
    "accepted_at": "2026-11-16T09:13:02.000Z"
  },
  "provider": "gocardless",
  "created": "2026-11-16T09:13:02.000Z",
  "cancelled_at": "2026-12-01T10:00:00.000Z"
}

Lister les mandats

GET/v1/mandates

Paramètres de requête

customeridentifiant
statustexte
active, cancelled ou failed.
limitentier
starting_afteridentifiant
curl https://xn--spw-rla.com/v1/mandates?customer=cus_42&status=active \
  -H "Authorization: Bearer spaw_sk_VOTRE_CLE"
const res = await fetch('https://xn--spw-rla.com/v1/mandates?customer=cus_42&status=active', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.SPAW_SECRET_KEY}`,
  },
});
const data = await res.json();
Réponse · 200
{
  "object": "list",
  "data": [
    {
      "id": "mdt_17",
      "object": "mandate",
      "customer": "cus_42",
      "status": "active",
      "scheme": "sepa_core",
      "reference": "PF0003-9C41D2E07A5B6F18",
      "bank_account": {
        "country": "FR",
        "last4": "2606"
      },
      "acceptance": {
        "type": "online",
        "accepted_at": "2026-11-16T09:13:02.000Z"
      },
      "provider": "gocardless",
      "created": "2026-11-16T09:13:02.000Z",
      "cancelled_at": null
    }
  ],
  "has_more": false
}