From 133c9e9658d741a1de7c62b0e4ad00bf31c9be8b Mon Sep 17 00:00:00 2001 From: Mario Hernandez Date: Sun, 17 Nov 2024 16:20:05 -0300 Subject: [PATCH] Stripe CLI testing --- docs/webhooks.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/webhooks.rst b/docs/webhooks.rst index 4012bfd9f..24e80bb6d 100644 --- a/docs/webhooks.rst +++ b/docs/webhooks.rst @@ -49,6 +49,21 @@ webhooks. Follow these steps to configure webhooks in your Stripe Dashboard: ensure your endpoint is correctly configured and can receive and process events from Stripe. + +Testing with Stripe CLI +---------------------- + +The `Stripe CLI `_ provides a simple way to test webhooks during local development by forwarding Stripe events to your local server. After installing and running ``stripe login``, you can start forwarding events to your local Django server with ``stripe listen --forward-to localhost:8000/payments/process/stripe/``. Use the webhook signing secret provided by the CLI in your development settings. + +.. code-block:: bash + + # Start webhook forwarding + stripe listen --forward-to localhost:8000/payments/process/stripe/ + + # In another terminal, trigger test events + stripe trigger checkout.session.completed + + .. note:: It's essential to secure your webhook endpoint and verify the authenticity of