首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >传递application_fee时出现条带接口错误

传递application_fee时出现条带接口错误
EN

Stack Overflow用户
提问于 2015-08-10 06:13:16
回答 2查看 7.4K关注 0票数 14

我正在尝试使用条纹API收取应用程序费用。我确信我在请求中遗漏了一些东西。

条带抱怨它需要以下两个参数之一: OAuth密钥、条带帐户头或目标参数。

我传入了Stripe-Account标头。

你能给我指个方向吗?

这是我的curl请求:

代码语言:javascript
复制
curl https://api.stripe.com/v1/charges \
    -u sk_test_<key>: \
    -H "Stripe-Account: acct_<key>" \
    -d amount=2000 -d currency=usd -d capture=true \
    -d card=tok_<key> -d description="curl" -d application_fee=48

这是我得到的回应:

代码语言:javascript
复制
{
  "error": {
    "type": "invalid_request_error",
    "message": "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).",
    "param": "application_fee"
  }
}
EN

回答 2

Stack Overflow用户

发布于 2017-09-02 00:54:56

为了将我在这个问题上的经验添加到上面的评论中-当您在请求中包含应用程序费用时,Stripe预计您将代表连接的帐户向客户收费。申请费用是指应转入您的平台账户的金额,作为您提供的服务的费用。

如果Stripe认为正在支付的帐户是平台帐户,则它会抛出此错误,因此对同一帐户单独处理应用程序费用是没有意义的。发生这种情况的方法包括在请求中传递您的平台帐号而不是连接的帐号,或者将目标参数设置为空。

解决方案是仔细检查您正在付款的账户不是您的平台账户,或者如果费用将流向您的平台,则不包括应用程序费用。我会在文档的相关部分添加一个链接,但我不知道有什么地方涉及到这一点。

票数 10
EN

Stack Overflow用户

发布于 2020-11-29 12:15:54

当我意外地为收件人的条带帐号设置了nil值时,就会发生这种情况。

解决方案是确保destination是有效的条带帐户代码:例如"acct_1HtSHv7fgYVxT5fZ"

代码语言:javascript
复制
    Stripe.api_key = 'sk_test_4eC39kjhkhgkhlhj1zdp7dc'

    payment_intent = Stripe::PaymentIntent.create({
      payment_method_types: ['card'],
      amount: @amount_minor_unit,
      currency: @currency,
      application_fee_amount: 123, 
      transfer_data: {
        destination: @stripe_account,
      },
    })

Stripe::InvalidRequestError (Can only apply an application_fee_amount when the
PaymentIntent is attempting a direct payment (using an OAuth key or Stripe-Account header)
or destination payment (using `transfer_data[destination]`).)

一旦我有了正确的@stripe_account (而不是nil)值,上面的代码就可以工作了

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31909342

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档