Gridsome Source Plugin for building websites using Stripe as a data source
npm install gridsome-source-stripeSource plugin for fetching data from Stripe into Gridsome.
npm install --save gridsome-source-stripe
``javascript`
// 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.
For example, you can query the product nodes created from Stripe with the following:
`javascript`
query products {
allStripeProduct {
edges {
node {
id
name
createdAt(format: "DD MMMM, YYYY")
}
}
}
}
and you can filter specific node using this:
`javascript``
query product($id: String!) {
stripeProduct(id: $id) {
id
name
}
}
This plugin has been developed with the kind support of Fullstack Rocket