Skip to content

Instantly share code, notes, and snippets.

@Aminejvm
Created August 24, 2019 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aminejvm/9859ef52b50998c19c703581c396b908 to your computer and use it in GitHub Desktop.
Save Aminejvm/9859ef52b50998c19c703581c396b908 to your computer and use it in GitHub Desktop.
[Gatsby stripe integration] #stripe #gatsby
//Infos
Skus = multiple types of the same product.
// yarn
yarn add gatsby-plugin-stripe
//gatsby-config
plugins: [
''gatsby-plugin-stripe
]
//Configuring checkout
const stripe = window.Stripe("apikey")
const handStripeRedirect = sku => {
stripe.redirectToCheckout({
items: [
{sku,//"sku from product"
quantity: 1
}
],
sucessUrl:,
cancelUrl:,
})}
//yarn
yarn add gatsny-source-stripe
//config
options:{
objects:['Product','Sku'],
secretKey: '',//global env ,
downloadFiles:true,
}
//graphql to get what you want.
// comfig in file for products
import React from "react"
import {graphql,staticQuery} from "gatsby"
const QUERY_NAME = graphql`
query ALL{
}
`
const Products = () =>{
<StaticQuery query={QUERY_NAME} render={
({allStripeSku})=>{
allStripeSku.edges.map(
}
}/>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment