条纹连接 - 错误退还申请费?

时间:2016-12-12 20:58:27

标签: php stripe-payments stripe-connect

在我的应用程序中,我正在创建一个收费,如下:

$appFee = 100;
$depositCharge = 2000;

\Stripe\Stripe::setApiKey('sk_test_xxxxxx');

$charge = \Stripe\Charge::create(array(
     "amount" => (int) $depositCharge,
     "currency" => "usd",
     "capture" => "true",
     "destination" => $providerID,
     "application_fee" => (int) $appFee,
     "customer" => $customerID
));

稍后,我正在尝试使用API​​处理退款,并退还申请费(因此我的关联帐户不会收取费用)

$re = \Stripe\Refund::create(array(
     "charge" => $chargeID,
     "refund_application_fee" => "true"
));

但是当我这样做时,我收到以下错误:

{
  "error": {
    "type": "invalid_request_error",
    "message": "Attempting to refund_application_fee on charge ch_xxxxxx, but it has no application fee. To refund the application fee on the associated transfer, set reverse_transfer=true."
  }
}

如果我省略'refund_application_fee'参数,它可以正常工作。为什么这个参数会导致错误?

1 个答案:

答案 0 :(得分:1)

基本上,您需要在创建退款时提供已连接帐户的条带帐户ID,我认为 $ providerID

我没有测试过您的情况,但我也遇到了同样的问题,当我设置 refund_application_fee 时,退款会给出错误并将其保留正常。

之后,我提供了已创建费用的已连接帐户的条带帐户ID,并且 refund_application_fee 设置为true,退款成功。