Skip to content

digitalcube/gatsby-source-stripe-shifter-product

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gatsby Source Stripe Shifter Products

Simple source plugin to get Shifter product and plans from Stripe.

Install

$ npm install -D gatsby-source-stripe-shifter-product

Config

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-stripe-shifter-product',
      options: {
        stripeAPISecret: process.env.STRIPE_API_SECRET,
        stripeConfig: {
          apiVersion: '2020-08-27'
        }
      }
    },
...

View

export default (props) => {
    return (
          <ul>
            {props.data.allShifterStripeProduct.nodes.map(product => (
              <li key={product.id}>
                <b>{product.name}</b>
                <dl>
                  {product.plans.map(plan => (
                    <React.Fragment key={plan.id}>
                      <dd key={plan.id}><b>{plan.nickname}</b> {plan.amount / 100} per {plan.interval}</dd>
                    </React.Fragment>
                  ))}
                </dl>
              </li>
            ))}
          </ul>
    )
}

export const pageQuery = graphql`
  query IndexQuery {
    allShifterStripeProduct {
      nodes {
        productId
        productType
        name
        plans {
          id
          amount
          nickname
          interval
        }
      }
    }
  }
`

Query

Get All

allShifterStripeProduct {
      nodes {
        productId
        productType
        name
        plans {
          id
          amount
          nickname
          interval
        }
      }
}

Get Static

allShifterStripeProduct(filter: {productType: {eq: "static"}}) {
      nodes {
        productId
        productType
        name
        plans {
          id
          amount
          nickname
          interval
        }
      }
}

Get Headless

allShifterStripeProduct(filter: {productType: {eq: "headless"}}) {
      nodes {
        productId
        productType
        name
        plans {
          id
          amount
          nickname
          interval
        }
      }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages