Stripe Mock

Mock Stripe payment API for testing without real transactions. Includes customers, payment intents, subscriptions, webhooks, and error simulation. Perfect for local development and CI/CD testing.

Mock the Stripe payment API for testing payment integrations without real transactions, API keys, or network calls. Perfect for local development, CI/CD pipelines, and automated testing.

📋 What You'll Get

  • ✅ Customers API (create, retrieve, update)

  • ✅ Payment Intents (create, confirm, capture)

  • ✅ Subscriptions management

  • ✅ Webhook events simulation

  • ✅ Error scenarios (declined cards, etc.)

  • ✅ Realistic Stripe response format

🎯 Stripe API Coverage

Architecture Diagram

graph LR
    A[Your App] -->|API Calls| B[moclojer Stripe Mock]
    B --> C[Customers]
    B --> D[Payment Intents]
    B --> E[Subscriptions]
    B --> F[Webhooks]

    C -->|Simulated Response| A
    D -->|Simulated Response| A
    E -->|Simulated Response| A
    F -->|Simulated Events| A

    style B fill:#635BFF,stroke:#333,stroke-width:2px,color:#fff

🔑 Supported Endpoints

Resource
Method
Path
Description

Customers

POST

/v1/customers

Create customer

GET

/v1/customers/:id

Retrieve customer

POST

/v1/customers/:id

Update customer

Payment Intents

POST

/v1/payment_intents

Create payment intent

GET

/v1/payment_intents/:id

Retrieve payment intent

POST

/v1/payment_intents/:id/confirm

Confirm payment

Subscriptions

POST

/v1/subscriptions

Create subscription

GET

/v1/subscriptions/:id

Retrieve subscription

DELETE

/v1/subscriptions/:id

Cancel subscription

Webhooks

POST

/v1/webhook

Receive webhook events

📁 Configuration File

Create stripe-mock.yml:

🚀 Usage Examples

Start Server

Customer Operations

Payment Intents

Subscriptions

Test Error Scenarios

🔍 Integration Example (Node.js)

🎓 Use Cases

1. Local Development

Test payment flows without real Stripe account or internet connection.

2. CI/CD Pipelines

Run automated tests without external dependencies or API rate limits.

3. Frontend Development

Build payment UIs before backend integration is ready.

4. Error Handling Testing

Simulate all error scenarios (declined cards, insufficient funds, etc.).

5. Load Testing

Test payment performance without hitting Stripe API limits.

⚠️ Important Notes

Limitations

  • Not a complete Stripe implementation - Only core endpoints

  • No real validation - Mock accepts any input

  • No persistence - Data isn't saved between requests

  • Simplified responses - Some fields may be missing

Security

  • Never use in production - This is for testing only

  • No PCI compliance - Not designed to handle real card data

  • No encryption - Use only in local/test environments


💡 Tip: Use this mock during development, then switch to Stripe Test Mode for integration testing, and finally to production mode for live transactions.

Last updated

Was this helpful?