{
  "id": 19626222,
  "title": "Accept crypto payments in Express",
  "url": "https://urgent.news/2026/11/12/accept-crypto-payments-in-express",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-12T09:01:42.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/moonvex/accept-crypto-payments-in-express-2lce"
  },
  "original_language": "en",
  "account": "To incorporate crypto payments in an Express app, follow these steps:\n\n1. Obtain an API key and webhook secret from the Moonvex dashboard. Store the key and webhook secret as `MOONVEX_SECRET_KEY` and `MOONVEX_WEBHOOK_SECRET` respectively in a `.env` file.\n\n2. Install the required dependencies using `npm install express pg`. Create a `.env` file to store server-specific secrets such as `MOONVEX_SECRET_KEY`, `MOONVEX_WEBHOOK_SECRET`, and `DATABASE_URL`.\n\n3. Set up the server with Express by importing necessary modules and creating an instance of Express. Define an asynchronous function `createPayment` to send a POST request to Moonvex API with required headers and payload. Handle errors and return the payment object if successful.\n\n4. Define the Express route for `/orders/:id/pay` to handle payment requests. Retrieve the order details from the database using the `orderId` parameter. If the order exists, call the `createPayment` function to generate a payment and redirect the customer to the `paymentUrl` provided by Moonvex.\n\n5. Implement a webhook endpoint to process incoming Moonvex webhooks. Verify the signature of the webhook using the provided secret and compare it with the received signature in constant time. Ensure the webhook event is received within the last 5 minutes. If valid, mark the order as paid in the database using a function like `markOrderPaidOnce`.",
  "summary": "A Moonvex integration for an Express app with no extra dependencies: the built-in fetch creates payments, node:crypto verifies webhook signatures, and a PostgreSQL transaction marks each order paid exactly once. Step by step 1. Get an API key and a webhook secret In the Moonvex dashboard go to “Integration” → “Create key” → type “Secret” (sk_live_…). The key is shown only once: store it on your…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}