Node.js SDK

Official Declined.io client for Node.js. Source: Enoros/declined-sdk/declined-node

Install

bash
npm install declined

Initialize

node
import Declined from "declined";

const client = new Declined("decl_live_sk_...", {
  baseUrl: "https://api.declined.io/api",
});

Send a payment failed event

node
await client.events.create({
  event_id: "evt_" + Date.now(),
  type: "payment_failed",
  customer_id: "cus_123",
  invoice_id: "inv_456",
  amount: 24900,
  currency: "usd",
  provider: "stripe",
});

Mark payment as recovered

When a customer pays outside Declined, notify the platform using either approach below. See the full Recoveries guide.

Via event API

node
await client.events.markPaymentRecovered({
  event_id: "evt_" + Date.now(),
  customer_id: "cus_123",
  invoice_id: "inv_456",
  amount: 24900,
  currency: "usd",
  provider: "stripe",
});

Via recovery attempt ID

node
await client.recoveries.markRecovered("ra_abc123");

List resources

All SDKs expose customers, recoveries, sequences, webhooks, incentives, and analytics list methods. See the REST API reference for response shapes.