#nicefellow1234

1 messages · Page 1 of 1 (latest)

thin rivetBOT
vernal escarp
#

hello! can you share an example subscription id?

vague flame
#

Do you mean a subscription ID from the production account?

vernal escarp
#

from whichever account you're not getting the expected response from

vague flame
#

sub_1MI7QNJy0xivVYK74RQz98Kp

vernal escarp
vague flame
#

Thank you, it worked now.

#

$subscriptions = $stripe->subscriptions->search([
'query' => "status:'active'",
'expand' => ['data.customer.invoice_settings.default_payment_method']
]);

#

Is there any other way to do it?

vernal escarp
#

what's the context? like what's wrong with the current way?

vague flame
#

There is an another issue I am seeing around 600+ active subscriptions in account while the endpoint only returns around 11 subscriptions.

vernal escarp
#

i'm not exactly following - you use expand to reduce the number of requests that your application needs to make.

But if you want, you can always loop through the subscriptions, and make a subsequent request to retrieve the customer and expand invoice_setting.default_payment_method

vernal escarp
#

hmm, can you share the request id for your search request?

#

where you get only 11 subscriptions

vague flame
vernal escarp
vague flame
#

Here it is: req_wknuniapx8dC5W

#

Can you also confirm if subscriptions with active status only includes subscriptions which are active and not in trial?

vernal escarp
#

so yes, active doesn't cover subscriptions in a trial period

#

just checking, but did you paginate?

vague flame
vague flame
#

$subscriptions = $stripe->subscriptions->search([
'query' => "status:'active'",
'expand' => ['data.customer.invoice_settings.default_payment_method']
]);

vernal escarp
vague flame
#

Ok, sure.

#

Thank you it worked now

#

$counter = 1;
foreach ($subscriptions->autoPagingIterator() as $subscription) {
$counter++;
$card = $subscription->customer->invoice_settings->default_payment_method->card;
echo 'Subscription ID: '.$subscription->id." ".$counter."\n";
echo 'Card Last4: '.$card->last4."\n";
echo 'Card Bin: '.$card->iin."\n\n\n";
}

#

I like it alot being able to talk to devs directly without any support guys present in between. 🙂

#

It's very productive and can save alot of precious time.