· 6 years ago · Sep 04, 2019, 11:58 PM
1//Infos
2Skus = multiple types of the same product.
3// yarn
4yarn add gatsby-plugin-stripe
5//gatsby-config
6plugins: [
7 ''gatsby-plugin-stripe
8]
9//Configuring checkout
10const stripe = window.Stripe("apikey")
11const handStripeRedirect = sku => {
12 stripe.redirectToCheckout({
13 items: [
14 {sku,//"sku from product"
15 quantity: 1
16 }
17 ],
18 sucessUrl:,
19 cancelUrl:,
20})}
21
22//yarn
23yarn add gatsny-source-stripe
24//config
25options:{
26 objects:['Product','Sku'],
27 secretKey: '',//global env ,
28 downloadFiles:true,
29}
30//graphql to get what you want.
31
32// comfig in file for products
33import React from "react"
34import {graphql,staticQuery} from "gatsby"
35
36 const QUERY_NAME = graphql`
37 query ALL{
38
39 }
40`
41const Products = () =>{
42 <StaticQuery query={QUERY_NAME} render={
43 ({allStripeSku})=>{
44 allStripeSku.edges.map(
45 }
46 }/>
47}