bling.settle-receivable
Convenience wrapper: settles a receivable by creating an INCOME lançamento at Bling and refreshing the parent receivable. Used by the Stripe webhook handler when a charge succeeds.
Overview
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | App-bling |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
receivable_uuid | uuid | No | — | commerce_entity UUID of the receivable to settle |
receivable_external_ref | string | No | — | Bling-side receivable id (use if no commerce_entity row exists yet) |
amount | string | Yes | — | Decimal as string |
posted_date | string | No | — | — |
competence_date | string | No | — | — |
description | string | No | — | — |
document_number | string | No | — | External ref (Stripe charge id, NF number, etc.) |
payment_method_external_ref | string | No | — | — |
financial_category_external_ref | string | No | — | — |
bank_account_external_ref | string | No | — | — |
idempotency_key | string | No | — | Caller-provided key to dedupe retries (e.g. Stripe event id) |
actor | string | No | — | — |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
receivable_uuid | uuid | No | — | commerce_entity UUID of the receivable to settle |
receivable_external_ref | string | No | — | Bling-side receivable id (use if no commerce_entity row exists yet) |
amount | string | Yes | — | Decimal as string |
posted_date | string | No | — | — |
competence_date | string | No | — | — |
description | string | No | — | — |
document_number | string | No | — | External ref (Stripe charge id, NF number, etc.) |
payment_method_external_ref | string | No | — | — |
financial_category_external_ref | string | No | — | — |
bank_account_external_ref | string | No | — | — |
idempotency_key | string | No | — | Caller-provided key to dedupe retries (e.g. Stripe event id) |
actor | string | No | — | — |
resolved_receivable_external_ref | string | No | — | — |
journal_entry_uuid | uuid | No | — | commerce_entity UUID of the created lançamento |
journal_entry_external_ref | string | No | — | Bling-side lançamento id |
refreshed_receivable_status | string | No | — | — |
refresh_skipped | boolean | No | — | — |
refresh_error | string | No | — | — |
settled_at | string | No | — | — |
completed_at | string | No | — | — |
failure_reason | string | No | — | — |
failed_at | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | json | No | — | — |
failed_layer | json | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | resolve | Settle requested |
refreshing | No | No | — | complete | Re-fetching the parent receivable to surface new status |
resolving | No | No | — | settle | Resolving Bling-side receivable id |
settling | No | No | — | refresh | Creating the lançamento at Bling |
completed | No | Yes | Yes | — | Receivable settled |
failed | No | Yes | No | — | Settle failed |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
initiated | resolve | resolving | — |
resolving | settle | settling | — |
settling | refresh | refreshing | — |
refreshing | complete | completed | — |
initiated | fail | failed | — |
resolving | fail | failed | — |
settling | fail | failed | — |
refreshing | fail | failed | — |
Business Errors
| Code | Message Template |
|---|---|
BLING_CONNECTION_NOT_FOUND | Bling connection {connection_uuid} not found in organization |
BLING_CONNECTION_WRONG_PROVIDER | Connection {connection_uuid} is not a Bling connection |
BLING_SETTLE_RECEIVABLE_NO_REF | Provide one of receivable_uuid or receivable_external_ref |
BLING_SETTLE_RECEIVABLE_NOT_FOUND | No commerce_entity row found for receivable |
BLING_SETTLE_RECEIVABLE_WRONG_TYPE | commerce_entity {uuid} is entity_type={entity_type!r}; settle-receivable requires entity_type='receivable' |
BLING_SETTLE_FAILED | bling.create-journal-entry failed during settle: |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "bling.settle-receivable",
"initial_data": {
"organization_uuid": "value",
"connection_uuid": "value",
"amount": "value"
}
}