Query product and price data from Stripe using GraphCMS Remote Fields 💳
This reference is basic example of Content Federation, using Remote Fields to connect a PricingPlan
type with third-party product and pricing data from Stripe. A common use case would be to enrich recurring or one-time Stripe products with data from GraphCMS (such as images or additional text content).
Built with Next.js and Tailwind CSS.
This assumes you have already created a GraphCMS project and have an existing Stripe account
- Clone with repository with
degit
and install project dependencies.
npx degit GraphCMS/reference-remote-fields-stripe#main reference-remote-fields-stripe
cd reference-remote-fields-stripe
yarn
- Add a
.env
file by cloning the provided.env.sample
and providing the required variable values.
GRAPHCMS_MIGRATION_TOKEN=
GRAPHCMS_TOKEN=
GRAPHCMS_URL=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
-
Build the required GraphCMS schema, including Remote Fields, using the Management SDK. This repository includes the migration script that was used to bootstrap this project. You can run the provided migration with
yarn migrate
. -
Populate your GraphCMS project with
PricingPlan
content entries. Be sure you to provide the relevant IDs (stripeMonthlyPriceId
,stripeAnnualPriceId
) for the Stripe prices created in your Stripe dashboard. -
Start the project!
yarn dev