hygraph / reference-remote-fields-stripe

Home Page:https://reference-remote-fields-stripe.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reference-remote-fields-stripe

Query product and price data from Stripe using GraphCMS Remote Fields 💳

About

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.

Usage

This assumes you have already created a GraphCMS project and have an existing Stripe account

  1. 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
  1. 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=
  1. 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.

  2. 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.

  3. Start the project!

yarn dev

About

https://reference-remote-fields-stripe.vercel.app

License:MIT License


Languages

Language:JavaScript 100.0%