英文:
Stripe API 2022-11-15 charge .refunds and charge.refunded webhook event
问题
在我的应用中,我监听 charge.refunded
(https://stripe.com/docs/api/events/types#event_types-charge.refunded)Webhook,并读取接收到的对象的 .refunds
,以查看截至日期确切退款了多少。
然而,使用新的Stripe API版本https://stripe.com/docs/upgrades#2022-11-15,他们从charge
对象中删除了.refunds
。
这似乎导致了一个看似荒谬的情况,在“退款”事件中,我必须额外调用Stripe API来扩展对charge的.refunds
的了解。
这看起来至少是不合理的。
我想知道我对从charge.refunded
事件中获取.refunds
的理解是否正确,我们现在确实必须以这种方式做。
英文:
In my app, I listen for charge.refunded (https://stripe.com/docs/api/events/types#event_types-charge.refunded) webhook and read .refunds of the received object to see how much exactly was refunded up to the date.
With the new Stripe API version https://stripe.com/docs/upgrades#2022-11-15 they removed .refunds from the charge
object though.
This seems to lead to a seemingly absurd situation, where in a 'refund' event I have to go around calling Stripe API additionally expanding on .refunds of the charge.
This looks unreasonable at the least.
I wonder if my understanding of getting .refunds from a charge.refunded event is indeed correct, and we absolutely have to do it this way now.
Note that not upgrading API version is not an option for me, I'd like to keep it the last version.
答案1
得分: 2
是的,你对当前行为的理解是正确的。Stripe的工作人员在Discord的dev-help频道上确认过:
> 那个事件是获取该信息的唯一途径。话虽如此,
> 退款列表必须要扩展(请参见这里:
> https://stripe.com/docs/expand),以便退款显示出来。
>
> 由于无法扩展Webhook事件,因此必须单独调用Stripe的API
> 以检索具有扩展退款列表的Charge对象。
来源:https://discord.com/channels/841573134531821608/1045113399719247903/1045117243412975686
英文:
Yes, you are correct about the current behavior. It has been confirmed by Stripe staff member on their dev-help channel on Discord:
> That event is the only one to get that information. That being said,
> the refunds list has to be expanded (see here:
> https://stripe.com/docs/expand) in order for the Refunds to show up.
>
> Since you can't expand webhook events, you have to make a separate API
> call to Stripe to retrieve the Charge object with the refunds list
> expanded instead.
Source: https://discord.com/channels/841573134531821608/1045113399719247903/1045117243412975686
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论