System relying only on the synchronous response

This error occurs when the integration treats the API's immediate response as the final confirmation of the operation.

The synchronous response represents only the result of that request. The operation may change later, and those changes need to be tracked through events or reconciliation queries.

How to identify

  • the local status is set only at creation time;
  • the initial response is treated as definitive confirmation;
  • the ID returned by Asaas is not stored or linked to the internal record;
  • the system does not track subsequent events;
  • changes made in Asaas do not show up in the system;
  • there is no routine to identify and fix mismatches.

How to fix

  1. Map the full lifecycle of the operation.
  2. Identify the initial, intermediate, and final states.
  3. Store the ID returned by Asaas.
  4. Link that ID to the internal record.
  5. Record the synchronous response as the initial state, when applicable.
  6. Track subsequent changes through webhooks.
  7. Update the local state as new events are received.
  8. Implement a reconciliation routine to fix mismatches.
  9. Execute critical actions only after the expected state has been confirmed.

Recommended flow: create → store the ID → record the initial state → track events → reconcile.

Diagnostic flow

1. Modeling the operation

%%{init: {"flowchart": {"nodeSpacing": 18,"rankSpacing": 24,"diagramPadding": 4,"padding": 7
}}}%%
flowchart TD
    A["The API returned success on creation"] --> B{"Is the initial response treated as final confirmation?"}

    B --> BSim(("Yes"))
    B --> BNao(("No"))
    B --> BDuvida(("Not sure"))

    BSim --> C["Map the operation lifecycle"]
    BDuvida --> C

    BNao --> D{"Was the returned ID stored?"}
    C --> D

    D --> DSim(("Yes"))
    D --> DNao(("No"))

    DNao --> E["Save the ID and link it to the internal record"]

    DSim --> F{"Are the possible states defined?"}
    E --> F

    F --> FSim(("Yes"))
    F --> FNao(("No"))
    F --> FDuvida(("Not sure"))

    FNao --> G["Define initial, intermediate, and final states"]
    FDuvida --> H["Check the documentation and the operation rules"]
    H --> G

    FSim --> I["Record the initial state without closing the cycle"]
    G --> I

    I --> J["Proceed to tracking the operation"]

    classDef inicio fill:#DBEAFE,stroke:#2563EB,color:#1E3A8A,stroke-width:3px
    classDef decisao fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:3px
    classDef correcao fill:#FFEDD5,stroke:#EA580C,color:#7C2D12,stroke-width:2px
    classDef validacao fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E,stroke-width:2px
    classDef sucesso fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:3px
    classDef analise fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-width:3px

    classDef respostaSim fill:#22C55E,stroke:#15803D,color:#FFFFFF,stroke-width:3px
    classDef respostaNao fill:#EF4444,stroke:#B91C1C,color:#FFFFFF,stroke-width:3px
    classDef respostaDuvida fill:#8B5CF6,stroke:#6D28D9,color:#FFFFFF,stroke-width:3px

    class A inicio
    class B,D,F decisao
    class C,E,G correcao
    class I validacao
    class J sucesso
    class H analise

    class BSim,DSim,FSim respostaSim
    class BNao,DNao,FNao respostaNao
    class BDuvida,FDuvida respostaDuvida

    linkStyle default stroke:#94A3B8,stroke-width:2px

    linkStyle 1,8,13 stroke:#22C55E,stroke-width:4px
    linkStyle 2,9,14 stroke:#EF4444,stroke-width:4px
    linkStyle 3,15 stroke:#8B5CF6,stroke-width:4px

2. Tracking and reconciliation

%%{init: {"flowchart": {"nodeSpacing": 18,"rankSpacing": 24,"diagramPadding": 4,"padding": 7
}}}%%
flowchart TD
    A["Operation created and initial state recorded"] --> B{"Are subsequent changes tracked?"}

    B --> BSim(("Yes"))
    B --> BNao(("No"))

    BNao --> C["Configure and process webhooks"]

    BSim --> D{"Is the local state updated by events?"}
    C --> D

    D --> DSim(("Yes"))
    D --> DNao(("No"))
    D --> DDuvida(("Not sure"))

    DNao --> E["Link the event to the operation ID"]

    DDuvida --> G["Compare received events with the local history"]
    G --> E

    E --> F["Update the local state idempotently"]

    DSim --> H{"Is there a reconciliation routine?"}
    F --> H

    H --> HSim(("Yes"))
    H --> HNao(("No"))

    HNao --> I["Implement periodic API queries"]

    HSim --> J{"Is there a mismatch between the states?"}
    I --> J

    J --> JSim(("Yes"))
    J --> JNao(("No"))

    JSim --> K["Fix the local state and record the mismatch"]
    JNao --> L["Maintain monitoring and history"]

    K --> L

    classDef inicio fill:#DBEAFE,stroke:#2563EB,color:#1E3A8A,stroke-width:3px
    classDef decisao fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:3px
    classDef correcao fill:#FFEDD5,stroke:#EA580C,color:#7C2D12,stroke-width:2px
    classDef validacao fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E,stroke-width:2px
    classDef sucesso fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:3px
    classDef analise fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-width:3px

    classDef respostaSim fill:#22C55E,stroke:#15803D,color:#FFFFFF,stroke-width:3px
    classDef respostaNao fill:#EF4444,stroke:#B91C1C,color:#FFFFFF,stroke-width:3px
    classDef respostaDuvida fill:#8B5CF6,stroke:#6D28D9,color:#FFFFFF,stroke-width:3px

    class A inicio
    class B,D,H,J decisao
    class C,E,F,I,K correcao
    class G analise
    class L sucesso

    class BSim,DSim,HSim,JSim respostaSim
    class BNao,DNao,HNao,JNao respostaNao
    class DDuvida respostaDuvida

    linkStyle default stroke:#94A3B8,stroke-width:2px

    linkStyle 1,6,15,20 stroke:#22C55E,stroke-width:4px
    linkStyle 2,7,16,21 stroke:#EF4444,stroke-width:4px
    linkStyle 8 stroke:#8B5CF6,stroke-width:4px

The first flow validates how the operation was modeled, while the second checks how subsequent changes are tracked and reconciled.


How to prevent

Model the lifecycle of the entities before implementation. Define which responses represent only the initial state and which confirm the completion of the operation. Configure webhooks, maintain a reconciliation routine, and validate the full flow before go-live.

The API response confirms the request. The final state of the operation may be defined later.



Did this page help you?