Skip to content

Decrease credit sync

CreditOutSync

Description: Creates or updates a credit-out operation and keeps the TCP request open until the matching trade:event is broadcast by the trading runtime.

CreditOutSync is a manager TCP API method for integrations that need the final credit decrease trade payload in the command response instead of accepting an order and waiting for a separate event subscription.

SEO

CreditOutSync is the synchronous TCP credit revocation method for ScaleTrade manager API integrations. Use this endpoint when a CRM, cashier, or backoffice connector must decrease broker credit and receive the resulting finance trade transaction by order.

Access Control

Requires set_accounts_balance for manager/dealer sessions. The target account must also match the manager groups and brand scope loaded from the cached manager record. Token payload is used only for manager id and session type.

Request Parameters

Name Type Required Description
login int Yes Account login ID
amount double Yes Negative credit amount
comment string Yes Description or reason for the credit decrease
order int No Existing finance transaction order to update. If omitted or not found, the server creates a new finance transaction
open_time int No Optional open timestamp
close_time int No Optional close timestamp

Success Response

On success the response contains only the data object from the matching trade:event; it does not wrap the full event envelope.

{
  "extID": "credit-out-req-1001",
  "status": 200,
  "data": {
    "order": 1242282,
    "login": 1001,
    "cmd": 9,
    "state": 3,
    "profit": -100.0
  }
}

Event Matching

New finance transactions wait for EV_RECORD_ADD. Existing finance transaction updates wait for EV_RECORD_UPDATE. Both are matched by trade:event.data.order.

Timeout

The default timeout is 5000 ms. If no matching trade event arrives before timeout, TCP returns status = 504 with SYNC_TIMEOUT.

Credit Safety

The server performs projected credit, equity, free-margin, Margin Call, and Stop Out checks before applying the operation. A revocation that violates these invariants does not change the account. See Credit and Withdrawal Policy.