Sample - Stripe API
POST/v1/test_helpers/customers/{customer}/fund_cash_balance

Fund a test-mode cash balance

Creates a test-mode cash balance transaction that simulates an incoming bank transfer for a customer. Supply amount and currency, and optionally provide a free-text reference for reconciliation testing. The response identifies the resulting customer cash balance transaction and its ending balance.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 4 body fields
customerstringrequired
The unique identifier of the customer whose test-mode cash balance to fund. Maximum 5000 characters.

Test-mode funding details for creating an incoming bank transfer against a customer's cash balance.

amountintegerrequired
Amount 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).
currencystringrequired
Three-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).
expandarray<string>optional
Specifies which fields in the response should be expanded.
referencestringoptional
A 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.

2 status codes
200Returns the created customer cash balance transaction, including its identifier, currency, net amount, ending balance, transaction type, and creation time.
adjusted_for_overdraftobjectoptional
applied_to_paymentobjectoptional
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
currencystringrequired
Three-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).
customerstringrequired
The customer whose available cash balance changed as a result of this transaction.
customer_accountstringoptional
The ID of an Account representing a customer whose available cash balance changed as a result of this transaction.
ending_balanceintegerrequired
The 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).
fundedobjectoptional
idstringrequired
Unique identifier for the object.
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
net_amountintegerrequired
The 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.
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:customer_cash_balance_transaction
refunded_from_paymentobjectoptional
transferred_to_balanceobjectoptional
typestringrequired
The 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.
Allowed:adjusted_for_overdraftapplied_to_paymentfundedfunding_reversedrefunded_from_paymentreturn_canceledreturn_initiatedtransferred_to_balanceunapplied_from_payment
unapplied_from_paymentobjectoptional
defaultError response.
errorobjectrequired

Error handling

amount and currency must be provided; amount must be a positive integer in the smallest currency unit, and currency must be a lowercase three-letter ISO currency code supported by the API. customer and reference values must be no longer than 5000 characters when supplied.