gridsome-source-stripe

Gridsome Source Plugin for building websites using Stripe as a data source

Usage no npm install needed!

<script type="module">
  import gridsomeSourceStripe from 'https://cdn.skypack.dev/gridsome-source-stripe';
</script>

README

Gridsome Source for Stripe

Source plugin for fetching data from Stripe into Gridsome.

Install

npm install --save gridsome-source-stripe

How to use

// In your gridsome.config.js
plugins: [
  {
    use: 'gridsome-source-stripe',
    options: {
      objectTypes: { product: { expand: ['data.skus'] }, plans: {</* query options for plans */>} },
      secretKey: 'xxxxxxxxx',
      // optional params
      stripeOptions: {},
      downloadFiles: true,
      imageDirectory: 'stripe_images',
    },
  },
];

if downloadFiles is true the plugin will download all assets associated to fields image and images into imageDirectory.

How to query and filter

For example, you can query the product nodes created from Stripe with the following:

query products {
  allStripeProduct {
    edges {
      node {
        id
        name
        createdAt(format: "DD MMMM, YYYY")
      }
    }
  }
}

and you can filter specific node using this:

query product($id: String!) {
  stripeProduct(id: $id) {
    id
    name
  }
}

Sponsor

This plugin has been developed with the kind support of Fullstack Rocket