16

My stripe account has following balance in test mode:

$958,395.72
Available balance

$2,659.48
Pending balance

$3,010,474.35
Total volume (HKD)

This balance is in HKD.
Now I have to transfer money in USD.
If I try to transfer USD $4.25 then it gives me following error:

Type: Stripe\Error\InvalidRequest

Message: Insufficient funds in Stripe account. In test mode, you can add funds to your available balance (bypassing your pending balance) by creating a charge with 4000 0000 0000 0077 as the card number. You can use the the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance).

Transfer Code:

$check_balnace = \Stripe\Balance::retrieve();
$balanceArr = $check_balnace->__toArray(true);
$available_amount = $balanceArr['available']['0']['amount'];
echo $available_amount; // $958,395.72
$amount = 4.25*100;
$amount = 425;
\Stripe\Transfer::create(array("amount" => $amount, "currency" => "usd", "destination" => 'stripr_uid', "description" => 'test'));

Why this error is occurring even I have enough balance?

Greg Chabala
  • 1,125
  • 2
  • 23
  • 35
Pathik Vejani
  • 4,263
  • 8
  • 57
  • 98

5 Answers5

58

You can do one more thing to add funds to your test account.

Just login into your stripe account and go to Payments and click on Create your first payment or new payment button.
When you click on it you can see a popup window that opens, here you can fill your amount.
Just remember to use card number: 4000000000000077
and click on Create payment button.

Your payment will be added directly (bypassing the pending state) and you can make transfers with your stripe testing account.

TOPKAT
  • 6,667
  • 2
  • 44
  • 72
Manish Silawat
  • 900
  • 5
  • 7
5

Your Stripe account only has a HKD bank account, and thus it only has a HKD balance. You can't create transfers in USD because your account doesn't have a USD balance.

In order for your account to have a USD balance, you'd need to link a USD bank account to it. However, at this time, HK Stripe accounts can only have HKD bank accounts, as noted here.

Ywain
  • 16,854
  • 4
  • 51
  • 67
2
\Stripe\Stripe::setApiKey("sk_test_vKA2W1UsnAfPfDsA1dfdK04n3dfr6");

\Stripe\Charge::create(array(
    'currency' => 'USD',
    'amount'   => 10000,
    'card'     => 4000000000000077
));

You can use this code and add balance for make transfer operation for your test account.

Manish Silawat
  • 900
  • 5
  • 7
  • Showing error as below No Such Token:4000000000000077 – Mahesh Yadav Sep 14 '18 at 11:39
  • You must use the associated card token, not the card number. For example, that card has a token `tok_bypassPending`. So you must use `'source' => 'tok_bypassPending'` Source: https://stripe.com/docs/testing#cards-responses – sequielo Feb 29 '20 at 17:26
2

If you are getting Insufficient funds error then you can use the below card number to transfer the payment in Test mode. Card Number : 4000000000000077

Mahak Choudhary
  • 1,286
  • 1
  • 16
  • 13
0
$stripe = new \Stripe\StripeClient('Your_Test_SK');
$stripe->charges->create([
  'amount' => 425,
  'currency' => 'usd',
  'source' => 'tok_bypassPending',
  'description' => 'My First Test Charge (created for API docs)',
]);
svikramjeet
  • 1,779
  • 13
  • 27
  • 3
    While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply. – Roman Aug 30 '22 at 06:44