#nadeem_transfer-balance

1 messages ยท Page 1 of 1 (latest)

ruby sentinelBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1401938292043157556

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

wicked lava
#

Hi there ๐Ÿ‘‹

What you're describing sounds like expected behavior. Creating a Transfer from a Platform Account to a Connected Account is expected to pull funds from the Platform's Stripe balance, not their associated bank account.

Stripe may allow the Stripe Account's balance to go negative, and in those cases may debit the associated bank account to recover those funds. But the specifics about whether that will be allowed, and how far negative you can go if so, are account-specific so they aren't something we're able to review or discuss in this forum. You'd need to speak with our Support team to discuss those limits for your Platform:
https://support.stripe.com/?contact=true
https://support.stripe.com/questions/reserves-for-connect-platforms-and-connected-accounts

#

I've heard of people building payroll systems on Stripe before, but it's going to be a bit different since Stripe is intended for processing payments rather than be a payroll system. You'll need to explore the best approach for getting funds into your Stripe account (assuringly from the employer using your system).

Topping up your Platform balance may be a good option, if you're in a region where that is supported:
https://docs.stripe.com/connect/top-ups

noble prairie
#

i have balance on platform bank but it uses card balance why?

wicked lava
#

What does that mean?

noble prairie
#

it menns i charged the customer bank and get balance on stripe platform and now want to transfer some amount of it to any connected account. it show you have insufficient balance in card, where i want to transfer from amount present on platform's bank that i received form my customer earlier

wicked lava
noble prairie
#

{
"available": [
{
"amount": 43302,
"currency": "usd",
"source_types": {
"bank_account": 2282,
"card": 41020
}
}
],
"pending": [
{
"amount": 102634,
"currency": "usd",
"source_types": {
"bank_account": 0,
"card": 102634
}
}
],
"connectReserved": [
{
"amount": 0,
"currency": "usd",
"source_types": null
}
],
"instantAvailable": null
}

wicked lava
#

Can you also share the ID of the request that is failing, so I can take a closer look at how much you're trying to Transfer?

noble prairie
#

request is not completing therfore id is not present

wicked lava
noble prairie
#

"error": "You have insufficient available funds in your Stripe account. Try adding funds directly to your available balance by creating Charges using the 4000000000000077 test card. See: https://stripe.com/docs/testing#available-balance"
}

Use test cards to validate your Stripe integration without moving real money. Test a variety of international scenarios, including successful and declined payments, card errors, disputes, and bank authentication. You can also test non-card payment methods and redirects.

wicked lava
#

Can you share your Account ID, I'll find the ID that way.

noble prairie
#

yes, just a min.

#

acct_1Rjk2LABglXEEQBS

#

are you there?

noble prairie
#

@wicked lava are you there?

wicked lava
#

Please refrain from pinging our team members directly. I was bouncing around to other threads while waiting for you to share the relevant information.

#

I don't see any requests to create Transfers coming from that account at all. What code are you running that is leading to an error?

noble prairie
#

[HttpPost("transfer-to-connected-account")]
public async Task<IActionResult> TransferToConnectedAccount([FromBody] TransferRequestDto dto)
{
if (dto == null || dto.AmountInCents <= 0 || string.IsNullOrEmpty(dto.Currency)
|| string.IsNullOrEmpty(dto.ConnectedAccountId))
{
return BadRequest("Invalid request.");
}

try
{
    var transferService = new TransferService();
    var transfer = await transferService.CreateAsync(new TransferCreateOptions
    {
        Amount = dto.AmountInCents,
        Currency = dto.Currency.ToLower(),
        Destination = dto.ConnectedAccountId,
        Description = $"Platform โ†’ Connected Account transfer"
    });

    return Ok(new
    {
        transferId = transfer.Id,
        status = "TRANSFER_CREATED"
    });
}
catch (StripeException ex)
{
    return StatusCode(500, new { error = ex.StripeError?.Message ?? ex.Message });
}

}

wicked lava
#

Is the API key you're using to run that one from the account you shared? There aren't any logs on the Account you shared that align with that code.

noble prairie
#

i am using API with api keys provided by stripe

wicked lava
#

From which Stripe Account?

noble prairie
wicked lava
#

Please double check that the API keys that you're using match the API keys you see when logged into your Stripe dashboard in the Account you're referring to.

Right now there seems to be a misalignment. Your code is for creating Transfer objects, but there are no requests on the Account you shared to our /v1/transfers endpoint, which indicates the requests being made from your code are being made to a different Stripe Account.

noble prairie
#

where i can find info about Stripe Account?

wicked lava
#

What do you mean?

noble prairie
#

Stripe Account about which you want to know
i think this is the acct_1Rjk2LABglXEEQBS

wicked lava
#

I don't believe it is. That doesn't seem to be the account that your code is running for, since there are no requests in the account's logs that align with your code.

noble prairie
#

SANDBOX ID: wksp_test_6St7zu2LSQIyfjFIu84lJm4

#

please check this

#

wksp_test_6St7zu2LSQIyfjFIu84lJm4

#

@wicked lava are u there?

wicked lava
#

Please refrain from pinging our team members directly. I was bouncing around to other threads while waiting for you to share the relevant information.

#

I'm unfortunately not sure what ID you're sharing with me, but now knowing you're working in a Sandbox may give me the insight I needed to find where you're testing this.

noble prairie
#

what kind of id you need to checking log. and where i can find it on dashboard?

#

there is a SANDBOX ID: wksp_test_6St7zu2LSQIyfjFIu84lJm4

#

i also got SecretKey and PublishableKey

wicked lava
noble prairie
#

then what is the solution?

wicked lava
#

I'm still piecing that together

noble prairie
#

waiting....

ruby sentinelBOT
noble prairie
#

is anybody there?

wicked lava
#

Yes, I'm looking

#

Unless you have the exact output of the Balance requests that you made before and after the Transfer creation request I shared, so I can have more context over the state of the balance's of your account when our system said its balance was insufficient.

noble prairie
#

{
"available": [
{
"amount": 2282,
"currency": "usd",
"source_types": {
"bank_account": 2282,
"card": 0
}
}
],
"pending": [
{
"amount": 102634,
"currency": "usd",
"source_types": {
"bank_account": 0,
"card": 102634
}
}
],
"connectReserved": [
{
"amount": 0,
"currency": "usd",
"source_types": null
}
],
"instantAvailable": null
}

wicked lava
#

Which request was that from? The one you made before the transfer creation request that failed, or the one after?

#

Neither of the source types in the available hash look like they have the funds to cover the Transfer you're trying to create.

noble prairie
#

[HttpPost("charge-bank-account")]
public async Task<IActionResult> ChargeBankAccount([FromBody] ChargeBankAccountDto dto)
{
if (dto == null ||
string.IsNullOrEmpty(dto.CustomerId) ||
string.IsNullOrEmpty(dto.BankAccountId) ||
dto.AmountInCents <= 0 ||
string.IsNullOrEmpty(dto.Currency))
{
return BadRequest("Invalid input.");
}

var chargeService = new ChargeService();

try
{
    var chargeOptions = new ChargeCreateOptions
    {
        Amount = dto.AmountInCents,
        Currency = dto.Currency,
        Customer = dto.CustomerId,
        Source = dto.BankAccountId, // ACH bank account source
        Description = dto.Description ?? "ACH bank account charge"
    };

    var charge = await chargeService.CreateAsync(chargeOptions);

    return Ok(new
    {
        charge.Id,
        charge.Status,
        charge.Amount,
        charge.Currency,
        charge.Description,
        charge.PaymentMethodDetails
    });
}
catch (StripeException ex)
{
    // Stripe-specific errors (e.g., failed payment)
    return StatusCode(500, new { error = ex.StripeError?.Message ?? ex.Message });
}
catch (System.Exception ex)
{
    // General errors
    return StatusCode(500, new { error = ex.Message });
}

}

for charging customer's bank

ruby sentinelBOT
noble prairie
#

and then for transfring to connected id
[HttpPost("transfer-to-connected-account")]
public async Task<IActionResult> TransferToConnectedAccount([FromBody] TransferRequestDto dto)
{
if (dto == null || dto.AmountInCents <= 0 || string.IsNullOrEmpty(dto.Currency)
|| string.IsNullOrEmpty(dto.ConnectedAccountId))
{
return BadRequest("Invalid request.");
}

 try
 {
     var transferService = new TransferService();
     var transfer = await transferService.CreateAsync(new TransferCreateOptions
     {
         Amount = dto.AmountInCents,
         Currency = dto.Currency.ToLower(),
         Destination = dto.ConnectedAccountId,
         Description = $"Platform โ†’ Connected Account transfer"
     });

     return Ok(new
     {
         transferId = transfer.Id,
         status = "TRANSFER_CREATED"
     });
 }
 catch (StripeException ex)
 {
     return StatusCode(500, new { error = ex.StripeError?.Message ?? ex.Message });
 }

}

quaint dune
#

Sorry you're dumping a large amount of code one by one

#

nadeem_transfer-balance

noble prairie
#

it was asked from your side

quaint dune
#

Am I understanding correctly that the Transfer is failing because you don't have enough balance? Because you shared 2 separate pieces of code. One creates a Charge (which is a legacy API we deprecated multiple years ago) and then the other creates a Transfer, but with no "link" to the existing Charge

noble prairie
#

then please prvide solution for cgarging customer's bank and getting payment on platform and then transfer to connected account external bank or on its platform balance

quaint dune
#

Question 1: Why are you using the legacy API here? Is this an existing integration or are you starting from scratch?

noble prairie
#

i am starting from scratch and testing required senario

quaint dune
#

Perfect so the first part of your code is mostly wrong. You are following an API recommendation from many years ago.
If you are trying to charge a customer's bank account in the US via ACH Debit, use the PaymentIntents API. See: https://docs.stripe.com/payments/ach-direct-debit

#

Question 2: Why are you creating a "Charge" and then after creating aTransfer? Are you trying to hold funds in your own balance?

noble prairie
#

no i dont want to hold , if possible transfer directly

quaint dune
#

So really if you combine both docs it should work!