i have an issue in transfer.
my stripe connected account available bal is $200.00 and i have an transfer my $200.00 and pandding balance is $150.00 balance to my bank account.
to showing error insuficient funds in your stripe connected account
see my code:
\Stripe\Stripe::setApiKey($_REQUEST['secret_id']);
$transfer = \Stripe\Transfer::create(array(
"amount" => 20000,
"currency" => "usd",
"destination" => "default_for_currency",
"description" => $_REQUEST['description'],
"source_type" => "bank_account"
));
see output :
{
msg = "You have insufficient funds in your Stripe account for this transfer. Your ACH balance is too low. You can use the the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance).";
status = 0;
}
i need solution please.
Your account actually has more than one balance -- funds are split by payment source type.
If you send a balance retrieval request, you will get a result similar to this:
{
"available": [
{
"amount": 20000,
"currency": "usd",
"source_types": {
"card": 12000,
"bank_account": 8000
}
}
],
"livemode": false,
"object": "balance",
"pending": [
{
"amount": 0,
"currency": "usd",
"source_types": {
"card": 0,
"bank_account": 0
}
}
]
}
When you create a transfer, you should specify the source type via the source_type
attribute. E.g. in PHP, you'd do something like this:
\Stripe\Transfer::create(array(
"amount" => 8000,
"currency" => "usd",
"destination" => "default_for_currency",
"source_type" => "bank_account"
));
On an unrelated note, it seems you're setting the API key via a client-side parameter:
\Stripe\Stripe::setApiKey($_REQUEST['secret_id']);
You should never share the secret API key with your client-side code. It would be very easy for an attacker to retrieve it and use it to issue API requests on your behalf. They'd be able to look at your transactions, delete saved customers, etc.