Installation
Ensure that both Node.js and npm are installed on your machine before proceeding.
bash
Commands
1. Login
Authenticates a user and generates an access token, business ID, and account ID. Authentication is required to access other CLI features. Usage:bash
2. Listen
Thelisten command creates a secure public tunnel using Localtunnel to forward webhooks to a local endpoint. This is particularly useful for testing webhooks during development.
Disclaimer:
- The CLI leverages Localtunnel to generate the public URL. In some cases, a public URL might not be provisioned successfully due to network issues.
- This feature should only be used in test environments.
bash
--forward-url: Specifies your local endpoint to receive webhook events.
bash
http://localhost:3000/webhook.
3. Trigger
Simulates events for testing purposes. Usage:bash
- Customer Events:
"customer.created","customer.updated","customer.deleted" - Payment Intent Events:
"payment_intent.created","payment_intent.cancelled" - Charge Events:
"charge.succeeded","charge.failed","charge.cancelled","charge.created","charge.updated"
The
listen command captures both manually triggered events and automatically triggered events from the Modem Pay system. For testing purposes, always use the webhook secret generated by the listen command. This secret is displayed in the terminal and can also be found in the Modem Pay dashboard, but only in test mode.Important: Production secrets and endpoints remain unaffected and are not impacted by the test mode configuration.bash
charge.succeeded event payload to the configured webhook endpoint for testing.