njosefbeck/gatsby-source-stripe

Subscription Plan Query Example

Closed this issue · 5 comments

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Read through the README fully
    • Ensured you are running Node v.10 or above
    • Made sure you're using at least Gatsby v.2.0.15
    • Checked that your issue isn't already filed

Description

Is there a way to query the plans for Subscription objects?
It looks like I can only query allStripeSku for skus or allStripeProduct where I can get the product id of any type of product (product and services) but not the plan id.

Steps to Reproduce

  1. Search for an allStripeSubscription

Expected behavior: A way to query the different products that are plans of a subscription for a reoccurring payment

Actual behavior: Can't find it

Hello!
Thanks for reaching out. It looks like we just need to add Plans as an object that you can get via list from Stripe. Easy enough. Would be a good opportunity to make sure we're covering all the other Stripe object list methods, as it seems like they've done some updates :).

Once added, you'll be able to query for allStripePlan to get all of them and stripePlan(id: { eq: "plan_id_here" }) to get a a specific plan by its plan id.

I'll work on getting this into the plugin this week. Thanks for bringing it to our attention!

ah, whoops, I meant allStripePlan
Awesome, thank you!

just saw some of your github repos, love the terrace house social site 👌

Hey! So I don't know why I didn't check the README and the code before responding, but it looks like we already have support for getting a list of plans. Did you try getting them without succeeding? If you have a link to a repo or something that I could look at, maybe I can help you debug.

Oh, my bad.., in my config I had only added Subscription, but actually needed to add Plan.
thank you

Glad to help! And also glad you enjoyed the Terrace House site :). Anyway, if anything else comes up as you use the plugin, let us know!