core-payments-crypto

NOWPayments cryptocurrency payment provider for the core-payments system.

core-payments-crypto

Primitive Paid

core-payments-crypto adds a cryptocurrency payment provider, powered by NOWPayments, to the core-payments registry. It registers itself as the nowpayments provider and handles invoice creation and IPN webhooks.

⚠️ Warning

This is a paid module. Adding it requires a valid Indigo license.

What it does

  • Registers a NOWPayments crypto payment provider with the core-payments factory.
  • Creates crypto invoices for plan checkout.
  • Verifies IPN webhooks with HMAC-SHA512 signature checks and timing-safe comparison.
  • Maps NOWPayments payment statuses to subscription/payment events.

ℹ️ Info

Crypto payments are one-time, not recurring. NOWPayments supports only the yearly interval — a confirmed payment activates the subscription for 365 days.

Installation

bun run indigo add core-payments-crypto

After installing, generate and apply any schema changes:

bun run db:generate
bun run db:migrate

core-payments-crypto depends on core-payments being installed. It declares no schema or routers of its own — it reuses the core-payments transaction and event tables.

Configuration

The module auto-registers the provider via registerPaymentProvider('nowpayments', ...) when its register entrypoint is imported as a side-effect in server.ts. The factory returns null when NOWPAYMENTS_API_KEY is missing, so the provider stays disabled until configured.

  1. Register the provider

    Import @/core-payments-crypto/register as a side-effect in server.ts.

  2. Add the provider config

    Add a NOWPayments entry to config/payment-providers.ts.

  3. Keep the webhook route

    The scaffolded webhook route at app/api/webhooks/nowpayments/route.ts must stay in place for Next.js routing.

  4. Set environment variables

    Configure the env vars below.

Environment variables

Variable Purpose
NOWPAYMENTS_API_KEY NOWPayments API key — required to enable the provider
NOWPAYMENTS_IPN_SECRET IPN secret used to verify webhook signatures
NOWPAYMENTS_SANDBOX Set to false to use the production API (defaults to sandbox)

Integration

  • The webhook route verifies the IPN signature, enforces idempotency via saas_subscription_events, and on a confirmed payment activates the subscription, finalizes any discount usage, sends notifications, and runs the payment.conversion hook (consumed by core-affiliates if installed).
  • Status mapping: finished/confirmed → subscription activated; failed/expired → payment failed; refunded → payment refunded.
Last updated: 5/27/2026Source: mdx file