`Customer.subscribe` method appears to use outdated request
See original GitHub issueI 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:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To provide a bit of context, passing
plan
as a parameter to theSubscription
creation API has been deprecated for a few years. This happened when we introduceditems
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) andPrice
instead ofPlan
(though this is a newer introduction).Hope it helps!
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).