【发布时间】:2020-12-02 06:29:56
【问题描述】:
我一直在阅读有关如何从给定付款here 中检索 Stripe 费用的文档:
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
const stripe = require('stripe')('sk_test_xyz');
const paymentIntent = await stripe.paymentIntents.retrieve(
'pi_1Gpl8kLHughnNhxyIb1RvRTu',
{
expand: ['charges.data.balance_transaction'],
}
);
const feeDetails = paymentIntent.charges.data[0].balance_transaction.fee_details;
但是,我想检索支付给关联帐户的 Stripe 费用。如果我使用链接帐户的付款意图尝试上述代码,则会收到错误消息:
Error: No such payment_intent: 'pi_1Gpl8kLHughnNhxyIb1RvRTu'
但是,当我从 webhook 收到发布的数据时,我实际上可以看到列出的付款意图:
{ id: 'evt_1HFJfyLNyLwMDlAN7ItaNezN',
object: 'event',
account: 'acct_1FxPu7LTTTTMDlAN',
api_version: '2019-02-11',
created: 1597237650,
data:
{ object:
{ id: 'pi_1Gpl8kLHughnNhxyIb1RvRTu',
object: 'payment_intent',
有什么建议吗?
【问题讨论】: