njosefbeck / gatsby-source-stripe

Gatsby source plugin for building websites using Stripe as a data source
74 stars 17 forks source link

Subscription Plan Query Example #33

Closed buzzguy closed 5 years ago

buzzguy commented 5 years ago

Prerequisites

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

njosefbeck commented 5 years ago

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!

buzzguy commented 5 years ago

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

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

njosefbeck commented 5 years ago

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.

buzzguy commented 5 years ago

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

njosefbeck commented 5 years ago

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!