Aller au contenu principal

Webhooks CLI

Gérez les endpoints webhook et écoutez les événements entrants en local pendant le développement.

Gérer les endpoints

Lister les endpoints

ikw webhooks list

Inspecter un endpoint

ikw webhooks inspect we_abc123

Créer un endpoint

ikw webhooks create \
--url https://yoursite.com/webhooks/ikawaari \
--enabled-events payment_intent.succeeded,payment_intent.payment_failed

Mettre à jour un endpoint

ikw webhooks update we_abc123 \
--url https://yoursite.com/webhooks/v2 \
--enabled-events payment_intent.succeeded,refund.created \
--enabled true

Faire tourner le secret de signature

ikw webhooks rotate-secret we_abc123

Listener webhook local

La commande webhooks listen démarre un serveur HTTP local qui reçoit les événements webhook — parfait pour le développement et les tests.

Utilisation de base

ikw webhooks listen
listening: http://localhost:4242/webhooks
hint: expose this port with a tunnel (ngrok/localtunnel) then set your webhook endpoint URL to /webhooks

Options

FlagDéfautDescription
--port <n>4242Port local d’écoute
--path <path>/webhooksChemin URL à écouter
--secret <secret>Secret de signature webhook (ou définir la variable d’env IKW_WEBHOOK_SECRET)
--tolerance-seconds <n>300Tolérance temporelle pour la vérification de signature
--print-headersfalseAffiche les headers de requête

Avec vérification de signature

ikw webhooks listen --secret whsec_your_signing_secret

Ou via variable d’environnement :

export IKW_WEBHOOK_SECRET=whsec_your_signing_secret
ikw webhooks listen

Sortie JSON pour le scripting

ikw webhooks listen --json

Chaque événement reçu est affiché comme objet JSON :

{
"received_at": "2026-02-19T10:30:00.000Z",
"path": "/webhooks",
"event": "payment_intent.succeeded",
"signature_present": true,
"signature_verified": true,
"payload": {
"id": "evt_abc123",
"type": "payment_intent.succeeded",
"data": { "id": "pi_xyz789", "amount": 5000, "currency": "xof", "status": "succeeded" }
}
}

Avec un tunnel (ngrok)

Pour recevoir de vrais webhooks Ikawaari pendant le développement :

# Terminal 1: Démarrer le listener
ikw webhooks listen --port 4242

# Terminal 2: Démarrer ngrok
ngrok http 4242

Définissez ensuite l’URL de votre endpoint webhook dans le dashboard sur https://your-ngrok-url.ngrok.io/webhooks.

Vérification de signature

Le listener vérifie automatiquement le header Ikawaari-Signature avec HMAC-SHA256 :

StatutSignification
signature_verified: trueLa signature est valide
missing_signature_headerAucun header de signature présent
missing_secretAucun secret configuré
timestamp_out_of_toleranceHorodatage de l’événement trop ancien (protection contre le rejeu)
signature_mismatchLa signature ne correspond pas