stripe-paymentslaravel-cashier

Retrieve multiple prices by price_ids array from stripe using laravel Cashier


For some reason, I need to fetch multiple (not all) stripe prices at once. I have an array with price_ids such as:

$stripe = Cashier::stripe();

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

// do something...

How I can fetch those prices? Thanks in advance.

Here's what I tried. But it doesn't work properly.

$stripe = Cashier::stripe();
$prices = $stripe->prices->all(
    [
        'lookup_keys' => $priceIds
    ]
);

Solution

  • That isn't supported in the Stripe API, you just have to loop through the list and call $stripe->prices->retrieve() each one.