在 stripe 关联账户中发行银行转账

issue in stripe connected account to bank transfer

我在传输中遇到问题。

我的 stripe 关联账户可用 bal 是 200.00 美元,我的 200.00 美元和 panding 余额是 150.00 美元到我的银行账户。

在您的 stripe 关联账户中显示错误资金不足

查看我的代码:

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

我需要解决方案。

您的帐户实际上有不止一笔余额 -- 资金按付款来源类型拆分。

如果您发送 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, you should specify the source type via the source_type属性。例如。在 PHP,你会做这样的事情:

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

在一个不相关的说明中,您似乎正在通过 client-side 参数设置 API 键:

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

您永远不应与 client-side 代码共享 API 密钥。攻击者很容易检索它并使用它代表您发出 API 请求。他们将能够查看您的交易、删除已保存的客户等。

在stripe中充值成功后,在stripe账户中实际可用需要一定的时间。

如果您想根据任何费用收取的任何金额创建转账,那么您可以直接使用费用 ID。 所以你的代码应该是这样的:

\Stripe\Stripe::setApiKey("your_secret_key");

$transfer = \Stripe\Transfer::create(array(
  "amount" => 1000,
  "currency" => "usd",
  "source_transaction" => "{CHARGE_ID}",
  "destination" => "{CONNECTED_STRIPE_ACCOUNT_ID}",
));

通过使用 source_transaction,无论您的可用余额如何,转账请求都会成功,并且转账本身只会在收费资金可用后才会发生。

已记录 here