条纹直接充电不记录

Stripe Direct Charge not recording

我将 Node 与 Firebase Cloud Functions 结合使用,以通过 Stripe Connect 触发直接费用的验证和捕获。

首先我创建电荷,而不是捕获它:

const charge = {
    capture: false,
    amount: 1000,
    currency: "eur",
    source: token,
    metadata: {order_id: rentID, some: "foo"},
  };
return stripe.charges.create(charge, {stripe_account: customAccount} )

一切顺利,我从回调中得到了收费对象:

 ch_1BGmUCLdU1UUJ0JXgMKI7Q:
   amount: 1000
   amount_refunded:  0
   application: "some"
   captured: false
   created: 1508928708
   currency: "eur"
   id: "ch_1BGmUCLdU1UUJ0JXgMKI7Qet"
   livemode: false
   metadata: {}
   object: "charge"
   outcome: {}
   paid: true
   refunded: false
   refunds: {}
   source: {}
   status: "succeeded"

我还从相应的网络钩子中获得费用:

-KxI9Dk-LVvM8Wth1TwC: {
   api_version: "2017-08-15"
   created: 1508928708
   data:
   object: 
     amount: 1000
     amount_refunded: 0
     application: "some"
     captured: false
     created: 1508928708
     currency: "eur"
     id: "ch_1BGmUCLdU1UUJ0JXgMKI7Qet"
     livemode: false
     metadata: {}
     object: "charge"
     outcome: {} 
     paid: true
     refunded: false
     refunds
     source
     status: "succeeded"
   id: "evt_1BGmUCLdU1UUJ0JXPRl5bvCx"
   livemode: false
   object: "event"
   pending_webhooks: 1
   request
     id: "req_4sR247IPJCeXMU"
   type: "charge.succeeded"
}

但是,当我想使用

捕获电荷时
return stripe.charges.capture("ch_1BGmUCLdU1UUJ0JXgMKI7Qet", {amount: 1000})

我明白了:

Error: No such charge: ch_1BGmUCLdU1UUJ0JXgMKI7Qet

这也很奇怪,因为在我的 Stripe Dashboard 中我看不到记录在 test/event 类别中的捕获。

知道是什么原因造成的吗?

此问题与 有关。 这笔费用不被认可,因为它没有记录在平台账户中,而是直接记录在关联账户中。

所以为了捕获电荷,这是要做的:

stripe.charges.capture(transactionID, {stripe_account: connectedAccount})

是的,您无法检索费用,因为直接费用是直接在连接的帐户中产生的。

您可以通过初始化连接帐户 API 您在连接到帐户时获得的凭据来检索在连接帐户中产生的直接费用

stripe_secret_key 和 stripe_publishable_key

通过这种方式,您可以查看从您的平台帐户收取的费用。