【问题标题】:No such customer: cus_************ (Stripe::InvalidRequestError) when customer exists没有这样的客户:客户存在时的 cus_************ (Stripe::InvalidRequestError)
【发布时间】:2015-11-26 20:17:33
【问题描述】:

我在一个名为 foody 的电子商务市场工作。我为此目的使用stripe connect。连接帐户是使用stripe-connect-omniauth 创建的。 Foodsy 有几个顾客。 Sku 的订单由

在 rails 控制器中创建
 Stripe.api_key = "sk_test_************"
    Stripe::Order.create(
      {:currency => 'usd',
      :items => [
        {
          :type => 'sku',
          :parent => "sku_************"
        }
      ] },
    {  :stripe_account => "acct_************" }
    )

它创建一个 ID 为 or_************ 的订单。

存在于美食平台上的客户购买它,

order=Stripe::Order.retrieve("or_************",stripe_account: "acct_************")
order.pay(customer: "cus_************")

但是这段代码返回错误No such customer: cus_************ (Stripe::InvalidRequestError).

客户存在,我可以在仪表板上看到他,并且源属性设置在条带上。那么为什么会出错呢?

【问题讨论】:

  • 对于任何通过错误消息进行搜索的人:确保使用正确的 API 密钥和密码。

标签: ruby-on-rails stripe-payments


【解决方案1】:

问题是客户存在于平台的帐户中,但不在您尝试创建费用的关联帐户中。

您需要从平台账号share the customer到关联账号:

# Create a token from the customer on the platform account
token = Stripe::Token.create(
  {:customer => "cus_7QLGXg0dkUYWmK"},
  {:stripe_account => "acct_17BTxDCioT3wKMvR"}
)

# Retrieve the order on the connected account and pay it using the token
order = Stripe::Order.retrieve("or_17BUNHCioT3wKMvREWdDBagG",
  stripe_account: "acct_17BTxDCioT3wKMvR"
)
order.pay(source: token.id)

【讨论】:

  • 好的..这解决了问题。文档非常混乱。似乎他们已经记录了它。但是我在 stripe-connect 文档中找不到链接,但它们在 stripe-api 文档中。 [stripe.com/docs/connect/shared-customers]
【解决方案2】:

如果您使用了错误的 APiKey,也会发生这种情况

【讨论】:

    猜你喜欢
    • 2018-07-26
    • 2018-11-19
    • 2021-01-06
    • 2016-06-23
    • 2015-11-16
    • 2016-05-22
    • 1970-01-01
    • 2019-03-31
    • 2016-06-24
    相关资源
    最近更新 更多