Skip to content

Stripe: Fund a test mode cash balance

Stripe testHelpers.postTestHelpersCustomersCustomerFundCashBalance: arguments, response, policy and SDK examples.

← Test helpers operations · Get started

Operation stripe.posttesthelperscustomerscustomerfundcashbalance

Provider route: POST /v1/test_helpers/customers/{customer}/fund_cash_balance. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["testHelpers"]["postTestHelpersCustomersCustomerFundCashBalance"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.testHelpers.postTestHelpersCustomersCustomerFundCashBalance(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_stripe import StripeIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.test_helpers.post_test_helpers_customers_customer_fund_cash_balance(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.customerstringRequired within parentMaximum length: 5000
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyobjectRequired within parentAdditional keys: not allowed
body.amountintegerRequired within parentAmount to be used for this test cash balance transaction. A positive integer representing how much to fund in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal) (e.g., 100 cents to fund $1.00 or 100 to fund ¥100, a zero-decimal currency).
body.currencystringRequired within parentThree-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
Format: currency
body.expandarrayOptionalSpecifies which fields in the response should be expanded.
body.expand[]stringEach itemMaximum length: 5000
body.referencestringOptionalA description of the test funding. This simulates free-text references supplied by customers when making bank transfers to their cash balance. You can use this to test how Stripe’s [reconciliation algorithm](https://docs.stripe.com/payments/customer-balance/reconciliation) applies to different user inputs.
Maximum length: 5000

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Fund a test mode cash balance — response body

Referenced models: Fund a test mode cash balance — response body

701 more schemas are linked from the tables above, on the schema pages.

Fund a test mode cash balance — response body
FieldTypePresenceDescription and constraints
$objectRootCustomers with certain payments enabled have a cash balance, representing funds that were paid
by the customer to a merchant, but have not yet been allocated to a payment. Cash Balance Transactions
represent when funds are moved into or out of this balance. This includes funding by the customer, allocation
to payments, and refunds to the customer.
adjusted_for_overdraftModelOptionalExpand Fund a test mode cash balance — response body — adjusted for overdraft
applied_to_paymentModelOptionalExpand Fund a test mode cash balance — response body — applied to payment
createdJSONRequired within parent
created (anyOf 1)integerAlternativeTime at which the object was created. Measured in seconds since the Unix epoch.
Format: unix-time
created (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
currencystringRequired within parentThree-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
Maximum length: 5000
customerJSONRequired within parentThe customer whose available cash balance changed as a result of this transaction.
customer (anyOf 1)stringAlternativeMaximum length: 5000
customer (anyOf 2)ModelAlternativeExpand Create a customer — response body
customer_accountJSONOptional
customer_account (anyOf 1)stringAlternativeThe ID of an Account representing a customer whose available cash balance changed as a result of this transaction.
Maximum length: 5000
customer_account (anyOf 2)nullAlternative
ending_balanceJSONRequired within parent
ending_balance (anyOf 1)integerAlternativeThe total available cash balance for the specified currency after this transaction was applied. Represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
ending_balance (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
fundedModelOptionalExpand Fund a test mode cash balance — response body — funded
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
livemodebooleanRequired within parentIf the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
net_amountJSONRequired within parent
net_amount (anyOf 1)integerAlternativeThe amount by which the cash balance changed, represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal). A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance.
net_amount (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: customer_cash_balance_transaction
refunded_from_paymentModelOptionalExpand Fund a test mode cash balance — response body — refunded from payment
transferred_to_balanceModelOptionalExpand Fund a test mode cash balance — response body — transferred to balance
typestringRequired within parentThe type of the cash balance transaction. New types may be added in future. See [Customer Balance](https://docs.stripe.com/payments/customer-balance#types) to learn more about these types.
Known values: adjusted_for_overdraft, applied_to_payment, funded, funding_reversed, refunded_from_payment, return_canceled, return_initiated, transferred_to_balance, unapplied_from_payment
unapplied_from_paymentModelOptionalExpand Fund a test mode cash balance — response body — unapplied from payment

Referenced models: Create a customer — response body, Fund a test mode cash balance — response body — adjusted for overdraft, Fund a test mode cash balance — response body — applied to payment, Fund a test mode cash balance — response body — funded, Fund a test mode cash balance — response body — refunded from payment, Fund a test mode cash balance — response body — transferred to balance, Fund a test mode cash balance — response body — unapplied from payment

Fund a test mode cash balance — response body — adjusted for overdraft
FieldTypePresenceDescription and constraints
$objectRoot
balance_transactionJSONRequired within parentThe [Balance Transaction](https://docs.stripe.com/api/balance_transactions/object) that corresponds to funds taken out of your Stripe balance.
balance_transaction (anyOf 1)stringAlternativeMaximum length: 5000
balance_transaction (anyOf 2)ModelAlternativeExpand Retrieve a balance transaction — balance get Balance History Id — response body
linked_transactionJSONRequired within parentThe [Cash Balance Transaction](https://docs.stripe.com/api/cash_balance_transactions/object) that brought the customer balance negative, triggering the clawback of funds.
linked_transaction (anyOf 1)stringAlternativeMaximum length: 5000
linked_transaction (anyOf 2)ModelAlternativeExpand Fund a test mode cash balance — response body

Referenced models: Retrieve a balance transaction — balance get Balance History Id — response body, Fund a test mode cash balance — response body

Fund a test mode cash balance — response body — applied to payment
FieldTypePresenceDescription and constraints
$objectRoot
payment_intentJSONRequired within parentThe [Payment Intent](https://docs.stripe.com/api/payment_intents/object) that funds were applied to.
payment_intent (anyOf 1)stringAlternativeMaximum length: 5000
payment_intent (anyOf 2)ModelAlternativeExpand Cancel a Payment Intent — response body

Referenced models: Cancel a Payment Intent — response body

Fund a test mode cash balance — response body — funded
FieldTypePresenceDescription and constraints
$objectRoot
bank_transferModelRequired within parentExpand Fund a test mode cash balance — response body — funded bank transfer

Referenced models: Fund a test mode cash balance — response body — funded bank transfer

Fund a test mode cash balance — response body — refunded from payment
FieldTypePresenceDescription and constraints
$objectRoot
refundJSONRequired within parentThe [Refund](https://docs.stripe.com/api/refunds/object) that moved these funds into the customer's cash balance.
refund (anyOf 1)stringAlternativeMaximum length: 5000
refund (anyOf 2)ModelAlternativeExpand Cancel a refund — response body

Referenced models: Cancel a refund — response body

Fund a test mode cash balance — response body — transferred to balance
FieldTypePresenceDescription and constraints
$objectRoot
balance_transactionJSONRequired within parentThe [Balance Transaction](https://docs.stripe.com/api/balance_transactions/object) that corresponds to funds transferred to your Stripe balance.
balance_transaction (anyOf 1)stringAlternativeMaximum length: 5000
balance_transaction (anyOf 2)ModelAlternativeExpand Retrieve a balance transaction — balance get Balance History Id — response body

Referenced models: Retrieve a balance transaction — balance get Balance History Id — response body

Fund a test mode cash balance — response body — unapplied from payment
FieldTypePresenceDescription and constraints
$objectRoot
payment_intentJSONRequired within parentThe [Payment Intent](https://docs.stripe.com/api/payment_intents/object) that funds were unapplied from.
payment_intent (anyOf 1)stringAlternativeMaximum length: 5000
payment_intent (anyOf 2)ModelAlternativeExpand Cancel a Payment Intent — response body

Referenced models: Cancel a Payment Intent — response body

Pause a subscription — response body — presentment details
FieldTypePresenceDescription and constraints
$objectRoot
presentment_currencystringRequired within parentCurrency used for customer payments.
Maximum length: 5000

SDK function policy ID: stripe.posttesthelperscustomerscustomerfundcashbalance. Catalog operation: PostTestHelpersCustomersCustomerFundCashBalance. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"Stripe-Version": "2026-09-30.endive"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.