Issue with Stripe.Subscription Documentation Example
See original GitHub issueHi There,
When utilizing the Node.JS Typescript bindings, when I copy/paste the Subscription object example from “https://stripe.com/docs/api/subscriptions/object” it seems that Typescript is returning an error.
TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
src/stripe/stripe.mocks.ts:89:11 - error TS2741: Property 'trial_period_days' is missing in type '{ aggregate_usage: null; interval: "month"; interval_count: number; usage_type: "licensed"; }' but required in type 'Recurring'.
89 "recurring": {
~~~~~~~~~~~
node_modules/stripe/types/2020-03-02/Prices.d.ts:123:9
123 trial_period_days: number | null;
~~~~~~~~~~~~~~~~~
'trial_period_days' is declared here.
node_modules/stripe/types/2020-03-02/Prices.d.ts:68:7
68 recurring: Price.Recurring | null;
~~~~~~~~~
The expected type comes from property 'recurring' which is declared here on type 'Price'
Now when I add this one (even though it shows as optional, I keep getting further errors. Main issues:
- “trial_period_days” seems to be required, even though the binding allows null. Now adding
null
gives a further error (see 2.) - “plan” seems to be missing (defined in SubscriptionItems.d.ts - line 45)
Am I doing something wrong here?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
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 retain ...
Read more >Stripe API reference – Subscriptions – curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >Subscriptions | Stripe Documentation
Create and manage subscriptions, recurring payments, and recurring revenue with the Stripe Billing APIs.
Read more >Build a subscriptions integration | Stripe Documentation
Create and manage subscriptions to accept recurring payments. ... This example uses a fixed-price service with two different service-level options: Basic ...
Read more >Cancel subscriptions | Stripe Documentation
When a subscription has pending invoice items you've created, the customer may still be billed for those if the cancellation is set 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 Free
Top 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
Awesome! And what about Plan? 😃
@remi-stripe Ok, thanks!