2017-02-01 9 views
1

私は振込で問題があります。ストライプ接続の口座が銀行振り込みになります

私のストライプ接続アカウント利用可能balは$ 200.00で、私は$ 200.00を転送しており、pandding残高は$ 150.00です。

\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" 
)); 

は、出力を参照してください:

{ 
    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; 
} 

私は解決策をしてください必要があります。あなたのストライプにエラーinsuficient資金を示すに

は私のコードを参照してくださいアカウントを接続しました

答えて

2

お客様のアカウントには実際に複数の残高があります。 - 資金は、支払元タイプ別に分割されています。

あなたがbalance retrievalリクエストを送信した場合、あなたはこのような結果を取得します:

{ 
    "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 
     } 
    } 
    ] 
} 

あなたがcreate a transfer、あなたがsource_type属性を介してソースタイプを指定する必要があります。例えば。 PHPで、あなたはこのような何かしたい:無関係なノートで

\Stripe\Transfer::create(array(
    "amount" => 8000, 
    "currency" => "usd", 
    "destination" => "default_for_currency", 
    "source_type" => "bank_account" 
)); 

を、あなたがクライアント側のパラメータを経由してAPIキーを設定しているようだ:

\Stripe\Stripe::setApiKey($_REQUEST['secret_id']); 

あなたが共有することはありませんシークレットAPIキーをクライアントサイドのコードに置き換えます。攻撃者がそれを取得して、それを使用してあなたのためにAPIリクエストを発行するのは非常に簡単です。彼らはあなたのトランザクションを見て、保存された顧客を削除することができるでしょう

+1

ありがとう、それは私を助けてくれました:) 実際には、私は '' source_type "=>" bank_account "'を見逃しました。カード&不十分なバランスを言う。 –

関連する問題