PT EN

Planos de pagamento

URL base: $BUSINESS_API

O objecto

idstring · obrigatório
tenant_idstring · obrigatório
case_idstring · obrigatório
account_idstring · obrigatório
account_numberstring · opcional

Number of the referenced account, e.g. CTA-000044. Omitted when unknown.

account_holder_namestring · opcional

Display name of the customer who holds the referenced account. Omitted when unknown.

total_amount_centsinteger (int64) · obrigatório
installment_countinteger · obrigatório
installment_amount_centsinteger (int64) · obrigatório
remaining_amount_centsinteger (int64) · obrigatório
next_due_datestring (date-time) · obrigatório
statusstring · obrigatório

um de active, completed, defaulted, cancelled

interest_basis_pointsinteger · opcional
interest_amount_centsinteger (int64) · opcional
installmentsarray of PlanInstallment · opcional
Mostrar atributos filhos
idstring · obrigatório
tenant_idstring · obrigatório
plan_idstring · obrigatório
numberinteger · obrigatório
due_datestring (date-time) · obrigatório
amount_centsinteger (int64) · obrigatório
statusstring · obrigatório

um de pending, paid, overdue

paid_atstring · opcional · anulável
created_atstring (date-time) · obrigatório
created_atstring (date-time) · obrigatório
updated_atstring (date-time) · obrigatório
O objecto
{
  "id": "pay_2Y8DroSLB6irBEM756sHb0qz5Mk",
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "case_id": "cas_2gmnNK0lRMC9tOMtZsWDhKGHpGe",
  "account_id": "act_2JFioNDgIfvkgflk8RtcqhBaARP",
  "account_number": "ACC-2026-000142",
  "account_holder_name": "Ana Matsinhe",
  "total_amount_cents": 125000,
  "installment_count": 1,
  "installment_amount_cents": 125000,
  "remaining_amount_cents": 125000,
  "next_due_date": "2026-11-19T09:30:00Z",
  "status": "active",
  "interest_basis_points": 1,
  "interest_amount_cents": 125000,
  "installments": [
    {
      "id": "pla_2HjiILFe8bV48DfMmhxs4j54up1",
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "plan_id": "pla_2lVU4nTwUfHw6nxUwjbOeRn8u5D",
      "number": 1,
      "due_date": "2026-11-19T09:30:00Z",
      "amount_cents": 125000,
      "status": "pending",
      "paid_at": "2026-11-19T09:30:00Z",
      "created_at": "2026-11-19T09:30:00Z"
    }
  ],
  "created_at": "2026-11-19T09:30:00Z",
  "updated_at": "2026-11-19T09:30:00Z"
}

Listar planos de pagamento

Registos

GET /payment-plans

Returns one cursor-paginated page (limit, after) of the tenant's debt payment plans. The account_id, case_id and status (active, completed, defaulted or cancelled) query parameters narrow the list. Requires read access to collections.

Parâmetros

limitinteger · consulta · opcional

Maximum resources to return (default 20, maximum 100).

afterstring · consulta · opcional

Opaque cursor returned by the previous page.

Devolve

200 Payment plans

Permissões collections:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/payment-plans" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200

Payment plans

Criar um plano de pagamento

Registos

POST /payment-plans

Turns a collection case's total debt into a payment plan and returns it with 201. Simple interest from interest_basis_points is added and the total is split into equal installments (default 3), with the rounding remainder on the last one. Installments fall due every interval_months (default 1) from first_due_date (default one month from now). Any interest is charged to the account's receivables, a payment plan created event is emitted, and the case moves to payment_plan_active. Requires the collections:write permission. Returns 404 for an unknown case and 400 for negative interest.

Corpo application/json

case_idstring · obrigatório
installment_countinteger · opcional · predefinição 3
first_due_datestring (date-time) · opcional
interest_basis_pointsinteger · opcional
interval_monthsinteger · opcional · predefinição 1

Devolve

201 Payment plan created

Permissões collections:write · Funções: admin, finance, owner

curl -X POST "$BUSINESS_API/payment-plans" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "case_id": "cas_2gmnNK0lRMC9tOMtZsWDhKGHpGe",
  "installment_count": 3,
  "first_due_date": "2026-11-19T09:30:00Z",
  "interest_basis_points": 0,
  "interval_months": 1
}'
Resposta 201

Payment plan created

Obter um plano de pagamento

Registos

GET /payment-plans/{id}

Returns a payment plan with its installments, including each installment's due date, amount and status. Requires read access to collections in the tenant, and returns 404 when the plan does not exist.

Parâmetros

idstring · caminho · obrigatório

ID of the payment plan (prefixed pln_).

Devolve

200 Payment plan details

Mostrar atributos
idstring · obrigatório
tenant_idstring · obrigatório
case_idstring · obrigatório
account_idstring · obrigatório
account_numberstring · opcional

Number of the referenced account, e.g. CTA-000044. Omitted when unknown.

account_holder_namestring · opcional

Display name of the customer who holds the referenced account. Omitted when unknown.

total_amount_centsinteger (int64) · obrigatório
installment_countinteger · obrigatório
installment_amount_centsinteger (int64) · obrigatório
remaining_amount_centsinteger (int64) · obrigatório
next_due_datestring (date-time) · obrigatório
statusstring · obrigatório

um de active, completed, defaulted, cancelled

interest_basis_pointsinteger · opcional
interest_amount_centsinteger (int64) · opcional
installmentsarray of PlanInstallment · opcional
Mostrar atributos filhos
idstring · obrigatório
tenant_idstring · obrigatório
plan_idstring · obrigatório
numberinteger · obrigatório
due_datestring (date-time) · obrigatório
amount_centsinteger (int64) · obrigatório
statusstring · obrigatório

um de pending, paid, overdue

paid_atstring · opcional · anulável
created_atstring (date-time) · obrigatório
created_atstring (date-time) · obrigatório
updated_atstring (date-time) · obrigatório

Erros 403 · 404

Permissões collections:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/payment-plans/{id}" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "id": "pay_2Y8DroSLB6irBEM756sHb0qz5Mk",
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "case_id": "cas_2gmnNK0lRMC9tOMtZsWDhKGHpGe",
  "account_id": "act_2JFioNDgIfvkgflk8RtcqhBaARP",
  "account_number": "ACC-2026-000142",
  "account_holder_name": "Ana Matsinhe",
  "total_amount_cents": 125000,
  "installment_count": 1,
  "installment_amount_cents": 125000,
  "remaining_amount_cents": 125000,
  "next_due_date": "2026-11-19T09:30:00Z",
  "status": "active",
  "interest_basis_points": 1,
  "interest_amount_cents": 125000,
  "installments": [
    {
      "id": "pla_2HjiILFe8bV48DfMmhxs4j54up1",
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "plan_id": "pla_2lVU4nTwUfHw6nxUwjbOeRn8u5D",
      "number": 1,
      "due_date": "2026-11-19T09:30:00Z",
      "amount_cents": 125000,
      "status": "pending",
      "paid_at": "2026-11-19T09:30:00Z",
      "created_at": "2026-11-19T09:30:00Z"
    }
  ],
  "created_at": "2026-11-19T09:30:00Z",
  "updated_at": "2026-11-19T09:30:00Z"
}

Declarar um plano de pagamento em incumprimento

Registos

POST /payment-plans/{id}/default

Changes an active plan's status to defaulted and returns it, which makes the account eligible for cutoff again. Only an active plan can default; any other status returns 409. Requires the collections:write permission.

Parâmetros

idstring · caminho · obrigatório

ID of the active payment plan to mark as defaulted.

Devolve

200 Payment plan declared in default

Mostrar atributos
idstring · obrigatório
tenant_idstring · obrigatório
case_idstring · obrigatório
account_idstring · obrigatório
account_numberstring · opcional

Number of the referenced account, e.g. CTA-000044. Omitted when unknown.

account_holder_namestring · opcional

Display name of the customer who holds the referenced account. Omitted when unknown.

total_amount_centsinteger (int64) · obrigatório
installment_countinteger · obrigatório
installment_amount_centsinteger (int64) · obrigatório
remaining_amount_centsinteger (int64) · obrigatório
next_due_datestring (date-time) · obrigatório
statusstring · obrigatório

um de active, completed, defaulted, cancelled

interest_basis_pointsinteger · opcional
interest_amount_centsinteger (int64) · opcional
installmentsarray of PlanInstallment · opcional
Mostrar atributos filhos
idstring · obrigatório
tenant_idstring · obrigatório
plan_idstring · obrigatório
numberinteger · obrigatório
due_datestring (date-time) · obrigatório
amount_centsinteger (int64) · obrigatório
statusstring · obrigatório

um de pending, paid, overdue

paid_atstring · opcional · anulável
created_atstring (date-time) · obrigatório
created_atstring (date-time) · obrigatório
updated_atstring (date-time) · obrigatório

Erros 403 · 404 · 409

Permissões collections:write · Funções: admin, finance, owner

curl -X POST "$BUSINESS_API/payment-plans/{id}/default" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "id": "pay_2Y8DroSLB6irBEM756sHb0qz5Mk",
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "case_id": "cas_2gmnNK0lRMC9tOMtZsWDhKGHpGe",
  "account_id": "act_2JFioNDgIfvkgflk8RtcqhBaARP",
  "account_number": "ACC-2026-000142",
  "account_holder_name": "Ana Matsinhe",
  "total_amount_cents": 125000,
  "installment_count": 1,
  "installment_amount_cents": 125000,
  "remaining_amount_cents": 125000,
  "next_due_date": "2026-11-19T09:30:00Z",
  "status": "active",
  "interest_basis_points": 1,
  "interest_amount_cents": 125000,
  "installments": [
    {
      "id": "pla_2HjiILFe8bV48DfMmhxs4j54up1",
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "plan_id": "pla_2lVU4nTwUfHw6nxUwjbOeRn8u5D",
      "number": 1,
      "due_date": "2026-11-19T09:30:00Z",
      "amount_cents": 125000,
      "status": "pending",
      "paid_at": "2026-11-19T09:30:00Z",
      "created_at": "2026-11-19T09:30:00Z"
    }
  ],
  "created_at": "2026-11-19T09:30:00Z",
  "updated_at": "2026-11-19T09:30:00Z"
}