使用 laravel Cashier 通过 Price_ids 数组从条带中检索多个价格

问题描述 投票:0回答:1

出于某种原因,我需要一次获取多个(不是全部)条带价格。我有一个包含 Price_ids 的数组,例如:

$stripe = Cashier::stripe();

$priceIds = [
    'price_1Ow....'., 
    'price_12lsd...'
];

// do something...

我如何获取这些价格?预先感谢。

这是我尝试过的。但它不能正常工作。

$stripe = Cashier::stripe();
$prices = $stripe->prices->all(
    [
        'lookup_keys' => $priceIds
    ]
);
stripe-payments laravel-cashier
1个回答
0
投票

Stripe API 不支持这一点,您只需循环遍历列表并调用

$stripe->prices->retrieve()
每一个即可。

© www.soinside.com 2019 - 2024. All rights reserved.