【发布时间】:2020-02-20 06:48:20
【问题描述】:
我已将 Wordpress 连接到 Stripe,并希望在其 Wordpress 管理用户页面中为每个用户显示 Stripe 事件历史记录。本质上,我希望在选择客户并单击“查看更多事件”时,Stripe 管理员中可用的视图相同:https://dashboard.stripe.com/test/events?related_object=cus_**********
我在 Stripe API 文档中的任何地方都找不到解决此问题的方法,因此我目前正在尝试获取所有事件,然后返回属于当前客户的任何事件。这似乎不必要地复杂,所以我希望有更好的方法。感谢您的帮助。
\Stripe\Stripe::setApiKey($stripe_api_key);
$stripe_customer = \Stripe\Customer::retrieve($stripe_customer_id);
$all_stripe_events = \Stripe\Event::all(['limit' => 10000]);
$event_data = $all_stripe_events->data;
foreach($event_data as $event) {
... compare every event against the current customer ...
}
【问题讨论】:
标签: php wordpress stripe-payments