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 withdrawal method for ScaleTrade manager API integrations. Use this endpoint when a CRM, bonus system, cashier, or backoffice connector must decrease account credit and receive the resulting finance trade transaction by order.

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.