【问题标题】:issue in stripe connected account to bank transfer在条带连接帐户中发出到银行转帐
【发布时间】:2017-06-17 18:31:05
【问题描述】:

我在转移中遇到问题。

我的条带连接账户可用余额为 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;
}

我需要解决方案。

【问题讨论】:

    标签: stripe-payments stripe-connect


    【解决方案1】:

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

    如果你发送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 请求。他们将能够查看您的交易、删除已保存的客户等。

    【讨论】:

    • 谢谢你,对我帮助很大:) 其实我错过了"source_type" => "bank_account",所以它查看卡并说余额不足。
    【解决方案2】:

    当任何费用在条带中成功时,需要一些时间才能在条带帐户中实际可用。

    如果您想根据任何费用收取的任何金额创建转账,那么您可以直接使用费用 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

    【讨论】:

      猜你喜欢
      • 2020-04-15
      • 2019-04-14
      • 1970-01-01
      • 1970-01-01
      • 2020-03-07
      • 2021-07-20
      • 1970-01-01
      • 2018-08-05
      • 1970-01-01
      相关资源
      最近更新 更多