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.

Issue with Stripe.Subscription Documentation Example

See original GitHub issue

Hi 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:

  1. “trial_period_days” seems to be required, even though the binding allows null. Now adding null gives a further error (see 2.)
  2. “plan” seems to be missing (defined in SubscriptionItems.d.ts - line 45)

Am I doing something wrong here?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
XavierGeerinckcommented, Aug 12, 2020

Awesome! And what about Plan? 😃

0reactions
Minishlinkcommented, Sep 18, 2020

@remi-stripe Ok, thanks!

Read more comments on GitHub >

github_iconTop 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 >

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