【问题标题】:Application Fee Error - Stripe申请费错误 - 条纹
【发布时间】:2017-01-30 21:10:47
【问题描述】:

当我尝试使用以下代码收取申请费时

$charge = \Stripe\Charge::create(array(
    'amount' => $amtincents,
    'currency' => 'usd',
    'source' => $stripetoken,
    'application_fee' => $appfee,
    'description' => 'Campaign Donation',
    'metadata' => array("Campaign Id" => $id)
    ), array('stripe_account' => $stripe_connected_user_id)
);

我收到以下错误

Array
(
    [error] => Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
)

我之前和上一次都曾在 Stripe 工作过,但我没有遇到过这个问题。我的捐赠表格(用于收取我正在使用条带的捐赠)和我正在执行条带操作的页面位于同一站点中。我目前只是在测试。

【问题讨论】:

  • @Ywain 我现在尝试使用以下代码使用目标参数而不是帐户标题进行收费。收费代码如下所示 $charge = \Stripe\Charge::create(array( 'amount' => $amtincents, 'currency' => 'usd', 'source' => $stripetoken, 'destination' = > $_POST['stripe_connected_user_id'], 'application_fee' => $appfee, 'description' => 'Campaign Donation', 'metadata' => array("Campaign Id" => $id) ));我现在得到 Array ( [error] => The 'destination' param cannot be set to your own account.)
  • @Ywain 我现在尝试使用以下代码进行收费,并使用目标参数而不是帐户标题。收费代码如下所示 $charge = \Stripe\Charge::create(array( 'amount' => $amtincents, 'currency' => 'usd', 'source' => $stripetoken, 'destination' = > $_POST['stripe_connected_user_id'], 'application_fee' => $appfee, 'description' => 'Campaign Donation', 'metadata' => array("Campaign Id" => $id) ));我现在收到错误消息([error] => 'destination' 参数不能设置为您自己的帐户。)

标签: stripe-payments stripe-connect


【解决方案1】:

您可能正在使用不支持 Stripe-Account 标头的旧版 Stripe's PHP library。理想情况下,您应该使用最新版本(此时为 4.4.0)。

如果这不是问题,那么很可能$stripe_connected_user_id 变量的值是空的。确保该变量包含有效的帐户 ID ("acct_...")。

【讨论】:

  • 我现在尝试使用以下代码使用目标参数而不是帐户标题进行收费。收费代码如下所示 $charge = \Stripe\Charge::create(array( 'amount' => $amtincents, 'currency' => 'usd', 'source' => $stripetoken, 'destination' = > $_POST['stripe_connected_user_id'], 'application_fee' => $appfee, 'description' => 'Campaign Donation', 'metadata' => array("Campaign Id" => $id) ));我现在明白了。 Array ( [error] => 'destination' 参数不能设置为您自己的帐户。)
  • 我现在尝试使用以下代码进行收费,并使用目标参数而不是帐户标题。收费代码如下所示 $charge = \Stripe\Charge::create(array( 'amount' => $amtincents, 'currency' => 'usd', 'source' => $stripetoken, 'destination' = > $_POST['stripe_connected_user_id'], 'application_fee' => $appfee, 'description' => 'Campaign Donation', 'metadata' => array("Campaign Id" => $id) ));我现在收到错误消息([error] => 'destination' 参数不能设置为您自己的帐户。)
  • @jai 此错误消息表示您提供的帐户 ID 是平台的帐户 ID(即您自己的帐户 ID)。您需要提供连接到平台的帐户的 ID,而不是平台本身的 ID。
  • 当我尝试按照下页stripe.com/docs/connect/standalone-accounts 中给出的步骤创建此帐户 ID 时,我已经存储了上面页面中返回的进程的 stripe_user_id,并将其存储在我的数据库中。我正在尝试用它来收取申请费。抱歉给您带来了麻烦,但您能否更详细地解释一下,或者指向一个链接,该链接清楚地告诉我有什么区别?
  • 请注意我上面的评论。等待您的解释。是否只是此处给出的测试环境问题。 stackoverflow.com/questions/31909342/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多