条纹直接充电不记录

时间:2017-10-25 11:41:37

标签: node.js stripe-connect

我正在使用Node with Firebase Cloud Functions来触发Auth&使用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"

我也从相应的webhook收取费用:

-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中,我无法看到测试/事件类别中记录的捕获。

知道是什么原因引起的吗?

2 个答案:

答案 0 :(得分:1)

此问题与this one有关。 该费用无法识别,因为它未记录在平台帐户中,而是直接记录在已连接的帐户中。

因此,为了捕获费用,这是做什么的:

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

答案 1 :(得分:1)

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

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

stripe_secret_key和stripe_publishable_key

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