'Stripe Connect "No such balance transaction: txn_" on Get Balance by Id after Successful Charge Creation
So in our workflow, we need to do a stripe direct charge, followed by getting the transaction so that we can see the exact fee that stripe charged.
The charge comes back as successful:
var chargeObj = new StripeChargeCreateOptions
{
ApplicationFee = appFee,
Amount = stripeAmount, //Amount Value in Cents
Currency = "usd",
Description = request.Message,
SourceTokenOrExistingSourceId = stripeToken.Id,
Capture = true
};
StripeCharge stripeCharge = _stripeService.InitiateCharge(chargeObj, organization.StripeAccount);
response.ChargeId = stripeCharge.Id;
response.TransferId = stripeCharge.BalanceTransactionId;
if (!stripeCharge.Status.Equals("succeeded", StringComparison.CurrentCultureIgnoreCase))
throw new StripeClientException("Failed To Initiate Charge", response);
// Error HERE vv
StripeBalanceTransaction stripeBalance = _stripeService.GetTransaction(stripeCharge.BalanceTransactionId);
We did also make sure to set the global SetApiKey so that isn't the issue:
StripeConfiguration.SetApiKey(WebConfigurationManager.AppSettings["topsecret"]);
The error we keep getting is "No such balance transaction: txn_xxxxxxxxxx". Doesn't make sense to me, I just got that txn back from stripe on a successful charge, why wouldn't it be able to find it?
Thanks
Solution 1:[1]
To get a balance transaction for your own account, you only need to provide your transaction id.
However, for a connected account you need to pass in the account id as well:
const stripe = require('stripe')('YOUR_KEY');
const balance = await stripe.balanceTransactions.retrieve({
stripeAccount: CONNECTED_STRIPE_ACCOUNT_ID
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shaya Ulman |
