I’m following the steps described on Stripe Webohooks docs to setup a local server and test my Webhooks integration. The steps are simple
- Create and run a node server using Stripe test API key
- Install and login to Stripe CLI
- Run
stripe listen --forward-to localhost:4242/webhook
to listen for Webhooks events - Trigger the target Webhooks, in my case
stripe trigger charge.dispute.created
The steps are pretty simple, but when I try to run the last step, it outputs the following exception:
Trigger failed: Request failed, status=400, body={
"error": {
"message": "You cannot use the test ID 'pm_card_createDisputeInquiry' in livemode. If you are testing your integration, please use your testmode API keys instead.",
"param": "payment_method",
"request_log_url": "https://dashboard.stripe.com/logs/req_IF0F0YgB7954el?t=1722687021",
"type": "invalid_request_error"
}
}
Just like if I was using the CLI in live mode. I already tried running both stripe login
and stripe listen
using the flag --api-key
and sending my test api key but the result is the same. I have no idea why the CLI is using live mode, I just can’t test the Webhooks in test mode.
I can confirm that live mode is being used because I can see in Stripe dashboard my computer as a registered local listener as well as the temporary restricted keys that the CLI is automatically creating.
OBS: Yes, I’m using the test key in the node server application. No production key is being used in the entire process.