Pular para o conteúdo principal

Documentation Index

Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt

Use this file to discover all available pages before exploring further.

Eventos de Webhook de Assinatura

Os seguintes eventos de webhook estão disponíveis para rastrear mudanças no ciclo de vida da assinatura:
EventDescription
subscription.activeA assinatura é ativada com sucesso
subscription.updatedO objeto da assinatura foi atualizado (qualquer alteração em um campo dispara este evento)
subscription.on_holdA assinatura é suspensa devido à falha na renovação
subscription.renewedA assinatura é renovada para o próximo período de faturamento
subscription.plan_changedO plano da assinatura foi atualizado, rebaixado ou modificado
subscription.cancelledA assinatura é cancelada
subscription.failedA criação da assinatura falhou durante a criação do mandate
subscription.expiredA assinatura chegou ao fim do seu prazo

Usando subscription.updated para sincronização em tempo real

O webhook subscription.updated é acionado sempre que qualquer campo da assinatura muda, permitindo que você mantenha o estado da sua aplicação sincronizado sem precisar fazer polling:
app.post('/webhooks/dodo', async (req, res) => {
  const event = req.body;
  
  if (event.type === 'subscription.updated') {
    const subscription = event.data;
    
    // Sync subscription changes to your database
    await syncSubscription(subscription.subscription_id, {
      status: subscription.status,
      next_billing_date: subscription.next_billing_date,
      metadata: subscription.metadata,
      // ... other fields you want to track
    });
    
    console.log(`Subscription ${subscription.subscription_id} updated`);
  }
  
  res.json({ received: true });
});
Inscreva-se em subscription.updated para receber notificações em tempo real sobre qualquer alteração na assinatura, eliminando a necessidade de fazer polling na API para atualizações.

Esquema de Carga Útil do Webhook

Response struct representing subscription details

addons
Addon Cart Response Item · object[]
obrigatório

Addons associated with this subscription

billing
object
obrigatório

Billing address details for payments

cancel_at_next_billing_date
boolean
obrigatório

Indicates if the subscription will cancel at the next billing date

created_at
string<date-time>
obrigatório

Timestamp when the subscription was created

credit_entitlement_cart
object[]
obrigatório

Credit entitlement cart settings for this subscription

currency
enum<string>
obrigatório

Currency used for the subscription payments

Opções disponíveis:
AED,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BWP,
BYN,
BZD,
CAD,
CHF,
CLP,
CNY,
COP,
CRC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SEK,
SGD,
SHP,
SLE,
SLL,
SOS,
SRD,
SSP,
STN,
SVC,
SZL,
THB,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
USD,
UYU,
UZS,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW
customer
object
obrigatório

Customer details associated with the subscription

metadata
object
obrigatório

Additional custom data associated with the subscription

meter_credit_entitlement_cart
object[]
obrigatório

Meter credit entitlement cart settings for this subscription

meters
object[]
obrigatório

Meters associated with this subscription (for usage-based billing)

next_billing_date
string<date-time>
obrigatório

Timestamp of the next scheduled billing. Indicates the end of current billing period

on_demand
boolean
obrigatório

Wether the subscription is on-demand or not

payment_frequency_count
integer<int32>
obrigatório

Number of payment frequency intervals

payment_frequency_interval
enum<string>
obrigatório

Time interval for payment frequency (e.g. month, year)

Opções disponíveis:
Day,
Week,
Month,
Year
previous_billing_date
string<date-time>
obrigatório

Timestamp of the last payment. Indicates the start of current billing period

product_id
string
obrigatório

Identifier of the product associated with this subscription

quantity
integer<int32>
obrigatório

Number of units/items included in the subscription

recurring_pre_tax_amount
integer<int32>
obrigatório

Amount charged before tax for each recurring payment in smallest currency unit (e.g. cents)

status
enum<string>
obrigatório

Current status of the subscription

Opções disponíveis:
pending,
active,
on_hold,
cancelled,
failed,
expired
subscription_id
string
obrigatório

Unique identifier for the subscription

subscription_period_count
integer<int32>
obrigatório

Number of subscription period intervals

subscription_period_interval
enum<string>
obrigatório

Time interval for the subscription period (e.g. month, year)

Opções disponíveis:
Day,
Week,
Month,
Year
tax_inclusive
boolean
obrigatório

Indicates if the recurring_pre_tax_amount is tax inclusive

trial_period_days
integer<int32>
obrigatório

Number of days in the trial period (0 if no trial)

cancellation_comment
string | null

Free-text cancellation comment, if any

cancellation_feedback
null | enum<string>

Customer-supplied churn reason, if any

Opções disponíveis:
too_expensive,
missing_features,
switched_service,
unused,
customer_service,
low_quality,
too_complex,
other
cancelled_at
string<date-time> | null

Cancelled timestamp if the subscription is cancelled

custom_field_responses
object[] | null

Customer's responses to custom fields collected during checkout

discount_cycles_remaining
integer<int32> | null

DEPRECATED: Use discounts[].cycles_remaining instead.

discount_id
string | null

DEPRECATED: Use discounts instead. Returns the first discount's ID if present.

discounts
object[] | null

All stacked discounts applied, ordered by position

expires_at
string<date-time> | null

Timestamp when the subscription will expire

payment_method_id
string | null

Saved payment method id used for recurring charges

scheduled_change
object

Scheduled plan change details, if any

tax_id
string | null

Tax identifier provided for this subscription (if applicable)

Last modified on February 27, 2026