gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.28k stars 10.31k forks source link

Creating a Stripe Plan Programmatically #17797

Closed jjazzymane closed 5 years ago

jjazzymane commented 5 years ago

Hello all!

Summary

I'm currently testing the possibility of writing to stripe's Plan. stripe.plan.create() is not a supported object yet on the gatsby-source-stripe plug-in, hence my search for a workaround, if possible. A list of all supported stripe objects are here https://www.gatsbyjs.org/packages/gatsby-source-stripe/. The goal is that when a button is clicked, stripe creates new plans with the fields built into that button. I am using airtable for the list of products and plans that will be created. That repo is listed below. My issue is with connecting to the Plans API. I get an error. Should I initialize stripe differently from gatsbys checkout examples?

Relevant information

Documentation: https://www.gatsbyjs.org/tutorial/ecommerce-tutorial/

Environment

Using: ecommerce-gatsby-tutorial. Repo: https://github.com/jjazzymane/airtable-gatsby-stripe

Issue

test 1 stripe plans

I expect to have a new plan created in stripe

LekoArts commented 5 years ago

If I read your question correctly, the actions you want to execute are during runtime on the client-side of things and thus the Stripe source plugin unfortunately won't help you with this as it only runs during build time. The tutorial you linked uses a specialized JS package from Stripe to add the checkout form: https://www.gatsbyjs.org/tutorial/ecommerce-tutorial/#how-does-the-stripejs-plugin-work

You'll need to use a different package from Stripe to connect to the desired API. Please consult their documentation for that or ask their support. I'm closing this issue as it's not directly related to Gatsby – thanks for using Gatsby!