0.0.5 • Published 6 months ago

modem-pay-cli v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Modem Pay CLI

The Modem Pay CLI is a tool designed to simplify integration testing by offering features like authentication, webhook management, and event simulation in a test environment.

Installation

Ensure that both Node.js and npm are installed on your machine.

Install the Modem Pay CLI globally:

npm install -g modem-pay-cli

Commands

1. Login

Authenticate with your Modem Pay account to access CLI features.

modempay login

You'll be prompted to enter your Modem Pay email and password. Upon successful authentication, your credentials will be saved for subsequent commands.

2. Listen

Create a secure public tunnel to forward webhooks to your local endpoint, facilitating testing during development.

modempay listen --forward-url=http://localhost:3000/webhook

Replace http://localhost:3000/webhook with your local endpoint. This command will provide a public URL that forwards incoming webhooks to your specified local endpoint.

Note: The CLI uses 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.

3. Trigger

Simulate events to test your webhook handling.

modempay trigger <event-type>

Supported event types include:

  • Customer Events: customer.created, customer.updated, customer.deleted
  • Payment Intent Events: payment_intent.created, payment_intent.cancelled
  • Charge Events: charge.succeeded, charge.cancelled

For example, to simulate a successful charge:

modempay trigger charge.succeeded

This will send a charge.succeeded event payload to your configured webhook endpoint for testing.

Important: Always respond to webhook events with an HTTP 200 OK status to confirm receipt. This ensures Modem Pay recognizes that your server has successfully processed the event.

Documentation

For detailed information on setting up and handling webhooks, please refer to the Modem Pay Webhooks Documentation.

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago