question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Customer.subscribe` method appears to use outdated request

See original GitHub issue

I was writing tests for our app that uses dj-stripe. Thanks for writing and maintaining this complex package!!

We use stripe-mock for tests, which is pinned to the most recent API version. Using this version, a test was failing for an invalid request when attempting a Customer.subscribe(plan="<str>").

I checked the Stripe docs on creating a Subscription and it appears the items parameter is required, while plan is not supported.

Our app runs on an older version of the API so I haven’t seen this error in production. Hopefully I’m wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
remi-stripecommented, Nov 1, 2020

To provide a bit of context, passing plan as a parameter to the Subscription creation API has been deprecated for a few years. This happened when we introduced items to support multiple plans per subscription. While it still works in production, we undocumented it a few weeks ago to ensure new developers didn’t mistakenly integrate something actively deprecated. It will keep working though we do plan to release a new API version in the future blocking this, paired with the usage of Price instead of Plan overall in the API.

I would encourage you to move to using both items (which has existed for years now) and Price instead of Plan (though this is a newer introduction).

Hope it helps!

1reaction
therefromherecommented, Apr 26, 2020

PS, this is one of the reasons dj-stripe doesn’t currently use stripe-mock for testing - as you say stripe-mock only supports the latest stripe API version, whereas dj-stripe pins to a known-good version.

See #567 for discussion of stripe-mock, and #892 for the current implementation of test fixtures - this is my slightly hare-brained scheme which uses a real (test-mode) stripe account to generate fixtures.

For my own applications that use dj-stripe I’ve had success using https://github.com/kevin1024/vcrpy to record fixtures of the stripe API calls (and other out-bound REST API calls).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subscribe is deprecated: Use an observer instead of an error ...
It's not deprecated, they just deprecated one of the overloads and now it looks like everything is deprecated. It's a tooling issue mostly....
Read more >
How subscriptions work | Stripe Documentation
Learn how subscriptions work within Stripe. With Subscriptions, customers make recurring payments for access to a product. Subscriptions require you to ...
Read more >
Cancel, pause, or change a subscription on Google Play
Under “Subscriptions,” check the list of subscriptions for expired subscriptions or subscriptions with declined payment methods.
Read more >
Managing subscriptions - Shopify Help Center
To go to the subscription order that the customer placed, click View order. To go to the subscription information in your subscription app,...
Read more >
Subscriber's View - WooCommerce
When a new payment method is added and set as default, an option will appear to update all the customer's existing subscriptions to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found