Created
August 24, 2019 01:24
-
-
Save Aminejvm/9859ef52b50998c19c703581c396b908 to your computer and use it in GitHub Desktop.
[Gatsby stripe integration] #stripe #gatsby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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