Menu

Accept crypto payments in Express
📰

Accept crypto payments in Express

DEV Community: node·Moonvex News·4 days ago
#SEoODwuI
#devtonodejs#devto#dev#payment#moonvex
Reading 0:00
15s threshold

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 server as MOONVEX_SECRET_KEY. On the same page add a webhook pointing to an https URL on your server and store its signing secret as MOONVEX_WEBHOOK_SECRET.

npm install express pg

# .env — server only, never commit it MOONVEX_SECRET_KEY = sk_live_... MOONVEX_WEBHOOK_SECRET = whsec_... DATABASE_URL = postgres://user:pass@localhost:5432/shop

Enter fullscreen mode

Exit fullscreen mode

2. Create a payment

POST /v1/payments with the Authorization: Bearer and Idempotency-Key headers. Required fields are orderId, amount (as a string), currency and network; for a USD price add asset, the coin to pay with.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.