Skip to content

Instantly share code, notes, and snippets.

View cookernetes's full-sized avatar

cookernetes cookernetes

View GitHub Profile
@cookernetes
cookernetes / stripe_payload_hook_integration.ts
Last active January 27, 2023 22:16
Stripe + Payload CMS Integration for easy product management :)
import { CollectionBeforeChangeHook } from "payload/types";
import Stripe from "stripe";
export const syncWithStripe: CollectionBeforeChangeHook = async ({
operation,
data,
originalDoc,
}) => {
const stripe = new Stripe(process.env.T_STRIPE_SECRET!, {
apiVersion: "2022-11-15",