BedrockAgentCore / Client / get_payment_instrument_balance

get_payment_instrument_balance

BedrockAgentCore.Client.get_payment_instrument_balance(**kwargs)

Get the balance of a payment instrument.

See also: AWS API Documentation

Request Syntax

response = client.get_payment_instrument_balance(
    userId='string',
    agentName='string',
    paymentManagerArn='string',
    paymentConnectorId='string',
    paymentInstrumentId='string',
    chain='BASE'|'BASE_SEPOLIA'|'ETHEREUM'|'SOLANA'|'SOLANA_DEVNET',
    token='USDC'
)
Parameters:
  • userId (string) – The user ID associated with this payment instrument.

  • agentName (string) – The agent name associated with this request, used for observability.

  • paymentManagerArn (string) –

    [REQUIRED]

    The ARN of the payment manager that owns this payment instrument.

  • paymentConnectorId (string) –

    [REQUIRED]

    The ID of the payment connector associated with this instrument.

  • paymentInstrumentId (string) –

    [REQUIRED]

    The ID of the payment instrument to query balance for.

  • chain (string) –

    [REQUIRED]

    The specific blockchain chain to query balance on. Required because balances are chain-specific.

  • token (string) –

    [REQUIRED]

    The token to query balance for. Only tokens supported for X402 payments are returned.

Return type:

dict

Returns:

Response Syntax

{
    'paymentInstrumentId': 'string',
    'tokenBalance': {
        'amount': 'string',
        'decimals': 123,
        'token': 'USDC',
        'network': 'ETHEREUM'|'SOLANA',
        'chain': 'BASE'|'BASE_SEPOLIA'|'ETHEREUM'|'SOLANA'|'SOLANA_DEVNET'
    }
}

Response Structure

  • (dict) –

    Response structure for getting payment instrument balance.

    • paymentInstrumentId (string) –

      The ID of the payment instrument.

    • tokenBalance (dict) –

      The balance of the supported token on the requested chain.

      • amount (string) –

        Raw balance in the smallest denomination (e.g., USDC base units where 1 USDC = 1000000).

      • decimals (integer) –

        Number of decimal places for the token (e.g., 6 for USDC).

      • token (string) –

        The supported token for this balance.

      • network (string) –

        The blockchain network family (ETHEREUM or SOLANA).

      • chain (string) –

        The specific blockchain chain.

Exceptions

  • BedrockAgentCore.Client.exceptions.AccessDeniedException

  • BedrockAgentCore.Client.exceptions.ValidationException

  • BedrockAgentCore.Client.exceptions.ResourceNotFoundException

  • BedrockAgentCore.Client.exceptions.ThrottlingException

  • BedrockAgentCore.Client.exceptions.InternalServerException