PHP SDK

Official Declined.io client for PHP. Source: Enoros/declined-sdk/declined-php

Install

bash
composer require declined/sdk

Initialize

php
use Declined\Declined;

$client = new Declined("decl_live_sk_...", ["baseUrl" => "https://api.declined.io/api"]);

Send a payment failed event

php
$client->events->create([
    "event_id" => "evt_123",
    "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

php
$client->events->markPaymentRecovered([
    "event_id" => "evt_124",
    "customer_id" => "cus_123",
    "invoice_id" => "inv_456",
]);

Via recovery attempt ID

php
$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.