Lock the Files That Charge Customers
Description and use
Separating the public catalog from a charge stub prevents accidental real payments while enabling safe demos.
Problem
Ensuring that only authorized code paths handle real payments while keeping a safe, testable stub for development and demo purposes.
Outcome
A clear separation between public catalog and charge logic prevents accidental real payments while allowing safe demos and development.
Workflow
- 1. Create two separate Node services: one for the public catalog, one for the charge stub.
- 2. In the catalog service, expose a listSkus function that returns demo SKUs.
- 3. In the money-path module, implement verifyWebhook to check HMAC signatures and recordIntent to log charge intents.
- 4. In the server module, route GET /health for health checks, and POST /webhook to process incoming events using verifyWebhook and recordIntent.
- 5. Set the WEBHOOK_SECRET environment variable for signature verification.
- 6. Deploy the catalog service publicly; keep the charge stub service isolated for internal use.
- 7. Use the stub to record intents during demos, ensuring no real charges are made.
- 8. When ready for production, replace the stub with a real payment processor integration.
- 9. Test the entire flow locally before deployment.
Evidence
Create a tiny Node service with two rooms. One room holds public catalog chrome only. The other room holds the charge stub.
The stub does not talk to a processor. It records intent and refuses extra cleverness.
- Record date: 2026-09-22T12:15:45.684Z