Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] StripeClient subscriptions & autoPagingIterator - missing parameters #939

Closed
armetiz opened this issue May 23, 2020 · 4 comments · Fixed by #942
Closed

[bug] StripeClient subscriptions & autoPagingIterator - missing parameters #939

armetiz opened this issue May 23, 2020 · 4 comments · Fixed by #942
Assignees

Comments

@armetiz
Copy link

armetiz commented May 23, 2020

Hi there.

I'm migrating from 6.41 to 7.36.
Problem occurred when using autoPagingIterator on a subscriptions collection coming from a StripeClient. I didn't try on other types.

Usages

// legacy code with singleton
$subscriptions = Stripe\Subscription::all([
    'status' => 'all',
    'limit' => 100,
]);

/** @var Stripe\Subscription $subscription */
foreach ($subscriptions->autoPagingIterator() as $subscription) {
    // subscription processing
}
// StripeClient version
$subscriptions = $this->client->subscriptions->all([
    'status' => 'all',
    'limit' => 100,
]);

/** @var Stripe\Subscription $subscription */
foreach ($subscriptions->autoPagingIterator() as $subscription) {
    // subscription processing
}

Problem

The last subscription status from first iteration is cancelled.
When using StripeClient version, I get the following error : "No such subscription: sub_XXXX"

Explanation

StripeClient autoPagingIterator does not forward $param from the initial request.

See $param argument values from the ApiRequestor::request() function.

Legacy version

// first iteration
array:2 [
    "status" => "all"
    "limit" => 100
]

// second iteration
array:3 [
    "status" => "all"
    "limit" => 100
    "starting_after" => "sub_XXXX"
]

StripeClient version

// first iteration
array:2 [
    "status" => "all"
    "limit" => 100
]

// second iteration
// note that status & limit are missing.
array:1 [
    "starting_after" => "sub_XXXX"
]

Edit : Explanation legacy / StripeClient have been inverted. Problem is still the same.

@armetiz armetiz changed the title StripeClient subscriptions & autoPagingIterator - missing parameters [bug] StripeClient subscriptions & autoPagingIterator - missing parameters May 26, 2020
@remi-stripe
Copy link
Contributor

@armetiz Thanks a lot for the detailed report, we're looking into it!

@armetiz
Copy link
Author

armetiz commented May 26, 2020

I've just edited the explanation. Explanation have been inverted between legacy & StripeClient parameter values.

@richardm-stripe
Copy link
Contributor

Should be fixed as of v7.36.1. Again, thank you @armetiz for the great write-up. It was very straightforward to understand and debug the issue.

@armetiz
Copy link
Author

armetiz commented May 28, 2020

Welcome @richardm-stripe ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants