Skip to main content
GET
/
payments
/
balance_changes
import cobo_waas2
from cobo_waas2.models.list_balance_changes200_response import (
    ListBalanceChanges200Response,
)
from cobo_waas2.models.payment_balance_change_source_type import (
    PaymentBalanceChangeSourceType,
)
from cobo_waas2.models.payment_balance_flow_direction import PaymentBalanceFlowDirection
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.PaymentApi(api_client)
    source_account = "developer"
    limit = 10
    before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
    after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
    token_id = "ETH_USDT"
    flow_direction = cobo_waas2.PaymentBalanceFlowDirection("in")
    min_created_timestamp = 1744689600
    max_created_timestamp = 1744776000
    source_type = cobo_waas2.PaymentBalanceChangeSourceType("OrderIn")
    source_id = "po_1234567890"

    try:
        # List balance changes
        api_response = api_instance.list_balance_changes(
            source_account,
            limit=limit,
            before=before,
            after=after,
            token_id=token_id,
            flow_direction=flow_direction,
            min_created_timestamp=min_created_timestamp,
            max_created_timestamp=max_created_timestamp,
            source_type=source_type,
            source_id=source_id,
        )
        print("The response of PaymentApi->list_balance_changes:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PaymentApi->list_balance_changes: %s\n" % e)

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.PaymentApi;
import com.cobo.waas2.model.*;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with
    // `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    PaymentApi apiInstance = new PaymentApi();
    String sourceAccount = "developer";
    Integer limit = 10;
    String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
    String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
    String tokenId = "ETH_USDT";
    PaymentBalanceFlowDirection flowDirection = PaymentBalanceFlowDirection.fromValue("in");
    Long minCreatedTimestamp = 1744689600L;
    Long maxCreatedTimestamp = 1744776000L;
    PaymentBalanceChangeSourceType sourceType =
        PaymentBalanceChangeSourceType.fromValue("OrderIn");
    String sourceId = "po_1234567890";
    try {
      ListBalanceChanges200Response result =
          apiInstance.listBalanceChanges(
              sourceAccount,
              limit,
              before,
              after,
              tokenId,
              flowDirection,
              minCreatedTimestamp,
              maxCreatedTimestamp,
              sourceType,
              sourceId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling PaymentApi#listBalanceChanges");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

package main

import (
	"context"
	"fmt"
	coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
	"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
	"os"
)

func main() {
	sourceAccount := "developer"
	limit := int32(10)
	before := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
	after := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
	tokenId := "ETH_USDT"
	flowDirection := coboWaas2.PaymentBalanceFlowDirection("in")
	minCreatedTimestamp := int64(1744689600)
	maxCreatedTimestamp := int64(1744776000)
	sourceType := coboWaas2.PaymentBalanceChangeSourceType("OrderIn")
	sourceId := "po_1234567890"

	configuration := coboWaas2.NewConfiguration()
	// Initialize the API client
	apiClient := coboWaas2.NewAPIClient(configuration)
	ctx := context.Background()

	// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
	ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
	// Replace `<YOUR_PRIVATE_KEY>` with your private key
	ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
		Secret: "<YOUR_PRIVATE_KEY>",
	})
	resp, r, err := apiClient.PaymentAPI.ListBalanceChanges(ctx).
		SourceAccount(sourceAccount).
		Limit(limit).
		Before(before).
		After(after).
		TokenId(tokenId).
		FlowDirection(flowDirection).
		MinCreatedTimestamp(minCreatedTimestamp).
		MaxCreatedTimestamp(maxCreatedTimestamp).
		SourceType(sourceType).
		SourceId(sourceId).
		Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PaymentAPI.ListBalanceChanges``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListBalanceChanges`: ListBalanceChanges200Response
	fmt.Fprintf(os.Stdout, "Response from `PaymentAPI.ListBalanceChanges`: %v\n", resp)
}

const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.PaymentApi();
const source_account = "developer";
const opts = {
  limit: 10,
  before: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
  after: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
  token_id: "ETH_USDT",
  flow_direction: "in",
  min_created_timestamp: 1744689600,
  max_created_timestamp: 1744776000,
  source_type: "OrderIn",
  source_id: "po_1234567890",
};
apiInstance.listBalanceChanges(source_account, opts).then(
  (data) => {
    console.log("API called successfully. Returned data: " + data);
  },
  (error) => {
    console.error(error);
  },
);

{
  "data": [
    {
      "source_id": "po_1234567890",
      "source_type": "OrderIn",
      "token_id": "ETH_USDT",
      "amount": "100.00",
      "amount_raw": "100.123456",
      "balance_before": "900.00",
      "balance_before_raw": "900.123456",
      "balance_after": "1000.00",
      "balance_after_raw": "1000.123456",
      "flow_direction": "in",
      "created_timestamp": 1744689600
    }
  ],
  "pagination": {
    "before": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
    "after": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
    "total_count": 10000
  }
}
{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}
{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}
import cobo_waas2
from cobo_waas2.models.list_balance_changes200_response import (
    ListBalanceChanges200Response,
)
from cobo_waas2.models.payment_balance_change_source_type import (
    PaymentBalanceChangeSourceType,
)
from cobo_waas2.models.payment_balance_flow_direction import PaymentBalanceFlowDirection
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.PaymentApi(api_client)
    source_account = "developer"
    limit = 10
    before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
    after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
    token_id = "ETH_USDT"
    flow_direction = cobo_waas2.PaymentBalanceFlowDirection("in")
    min_created_timestamp = 1744689600
    max_created_timestamp = 1744776000
    source_type = cobo_waas2.PaymentBalanceChangeSourceType("OrderIn")
    source_id = "po_1234567890"

    try:
        # List balance changes
        api_response = api_instance.list_balance_changes(
            source_account,
            limit=limit,
            before=before,
            after=after,
            token_id=token_id,
            flow_direction=flow_direction,
            min_created_timestamp=min_created_timestamp,
            max_created_timestamp=max_created_timestamp,
            source_type=source_type,
            source_id=source_id,
        )
        print("The response of PaymentApi->list_balance_changes:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PaymentApi->list_balance_changes: %s\n" % e)

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.PaymentApi;
import com.cobo.waas2.model.*;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with
    // `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    PaymentApi apiInstance = new PaymentApi();
    String sourceAccount = "developer";
    Integer limit = 10;
    String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
    String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
    String tokenId = "ETH_USDT";
    PaymentBalanceFlowDirection flowDirection = PaymentBalanceFlowDirection.fromValue("in");
    Long minCreatedTimestamp = 1744689600L;
    Long maxCreatedTimestamp = 1744776000L;
    PaymentBalanceChangeSourceType sourceType =
        PaymentBalanceChangeSourceType.fromValue("OrderIn");
    String sourceId = "po_1234567890";
    try {
      ListBalanceChanges200Response result =
          apiInstance.listBalanceChanges(
              sourceAccount,
              limit,
              before,
              after,
              tokenId,
              flowDirection,
              minCreatedTimestamp,
              maxCreatedTimestamp,
              sourceType,
              sourceId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling PaymentApi#listBalanceChanges");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

package main

import (
	"context"
	"fmt"
	coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
	"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
	"os"
)

func main() {
	sourceAccount := "developer"
	limit := int32(10)
	before := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
	after := "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
	tokenId := "ETH_USDT"
	flowDirection := coboWaas2.PaymentBalanceFlowDirection("in")
	minCreatedTimestamp := int64(1744689600)
	maxCreatedTimestamp := int64(1744776000)
	sourceType := coboWaas2.PaymentBalanceChangeSourceType("OrderIn")
	sourceId := "po_1234567890"

	configuration := coboWaas2.NewConfiguration()
	// Initialize the API client
	apiClient := coboWaas2.NewAPIClient(configuration)
	ctx := context.Background()

	// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
	ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
	// Replace `<YOUR_PRIVATE_KEY>` with your private key
	ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
		Secret: "<YOUR_PRIVATE_KEY>",
	})
	resp, r, err := apiClient.PaymentAPI.ListBalanceChanges(ctx).
		SourceAccount(sourceAccount).
		Limit(limit).
		Before(before).
		After(after).
		TokenId(tokenId).
		FlowDirection(flowDirection).
		MinCreatedTimestamp(minCreatedTimestamp).
		MaxCreatedTimestamp(maxCreatedTimestamp).
		SourceType(sourceType).
		SourceId(sourceId).
		Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PaymentAPI.ListBalanceChanges``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListBalanceChanges`: ListBalanceChanges200Response
	fmt.Fprintf(os.Stdout, "Response from `PaymentAPI.ListBalanceChanges`: %v\n", resp)
}

const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.PaymentApi();
const source_account = "developer";
const opts = {
  limit: 10,
  before: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
  after: "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
  token_id: "ETH_USDT",
  flow_direction: "in",
  min_created_timestamp: 1744689600,
  max_created_timestamp: 1744776000,
  source_type: "OrderIn",
  source_id: "po_1234567890",
};
apiInstance.listBalanceChanges(source_account, opts).then(
  (data) => {
    console.log("API called successfully. Returned data: " + data);
  },
  (error) => {
    console.error(error);
  },
);

Authorizations

BIZ-API-KEY
string
header
required

The API key. For more details, refer to API key.

In the API playground, enter your API secret, and your API key will be accordingly calculated.

Query Parameters

limit
integer<int32>
default:10

The maximum number of objects to return. For most operations, the value range is [1, 50].

before
string

A cursor indicating the position before the current page. This value is generated by Cobo and returned in the response. If you are paginating forward from the beginning, you do not need to provide it on the first request. When paginating backward (to the previous page), you should pass the before value returned from the last response.

after
string

A cursor indicating the position after the current page. This value is generated by Cobo and returned in the response. You do not need to provide it on the first request. When paginating forward (to the next page), you should pass the after value returned from the last response.

source_account
string
required

The source account for which to retrieve balance changes. Currently, use developer.

token_id
string

The token ID used to filter balance changes. For a complete list of supported tokens, see Cobo Payments Guide.

flow_direction
enum<string>

The direction of the balance change relative to the source account. Possible values include:

  • in: Funds flow into the source account.
  • out: Funds flow out of the source account.
Available options:
in,
out
Example:

"in"

min_created_timestamp
integer<int64>

The minimum creation time of balance changes, represented as a UNIX timestamp in seconds. Balance changes created on or after this time are returned.

max_created_timestamp
integer<int64>

The maximum creation time of balance changes, represented as a UNIX timestamp in seconds. Balance changes created on or before this time are returned.

source_type
enum<string>

The source type used to filter balance changes. Possible values include:

  • Init: Balance change caused by initialization.
  • OrderIn: Balance change from an order-in payment.
  • LatePayment: Balance change from a late payment.
  • TopUp: Balance change from a top-up.
  • UnexceptedIn: Balance change from an unexpected incoming payment.
  • RefundOut: Balance change from a refund payout.
  • Payout: Balance change from a payout.
  • UnexceptedOut: Balance change from an unexpected outgoing payment.
  • Allocation: Balance change from an allocation.
  • SettlementNetwork: Balance change from the settlement network.
  • BulkSend: Balance change from a bulk send.

When specifying source_id, you must also specify source_type.

The source type of the balance change. Possible values include:

  • Init: Balance change caused by initialization.
  • OrderIn: Balance change from an order-in payment.
  • LatePayment: Balance change from a late payment.
  • TopUp: Balance change from a top-up.
  • UnexceptedIn: Balance change from an unexpected incoming payment.
  • RefundOut: Balance change from a refund payout.
  • Payout: Balance change from a payout.
  • UnexceptedOut: Balance change from an unexpected outgoing payment.
  • Allocation: Balance change from an allocation.
  • SettlementNetwork: Balance change from the settlement network.
  • BulkSend: Balance change from a bulk send.
Available options:
Init,
OrderIn,
LatePayment,
TopUp,
UnexceptedIn,
RefundOut,
Payout,
UnexceptedOut,
Allocation,
SettlementNetwork,
BulkSend
Example:

"OrderIn"

source_id
string

The source ID used to filter balance changes.

When specifying source_id, you must also specify source_type.

Response

The request was successful. The response contains balance changes and pagination information.

The response containing balance changes and pagination information.

data
object[]

The list of balance changes.

pagination
object

The pagination information of the returned data.