#nikivi
1 messages · Page 1 of 1 (latest)
Hello nikivi, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• nikivi, 2 hours ago, 19 messages
• nikivi, 3 days ago, 224 messages
• nikivi, 3 days ago, 68 messages
is error i see
import { Context } from "@grafbase/sdk"
import { GraphQLError } from "graphql"
import Stripe from "stripe"
import { hankoIdFromToken } from "../lib/hanko-validate"
import { log, logError } from "../lib/baselime"
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: "2023-08-16",
typescript: true
})
type StripePlan = "month" | "year"
export default async function StripeResolver(
root: any,
args: { plan: StripePlan; userEmail: string },
context: Context
) {
log("stripe", "trying to get stripe checkout", { args })
const hankoId = await hankoIdFromToken(context)
if (hankoId) {
try {
switch (args.plan) {
case "month":
const monthSubscription = await stripe.checkout.sessions.create({
success_url: process.env.STRIPE_SUCCESS_URL!,
mode: "subscription",
metadata: {
userEmail: args.userEmail
},
line_items: [
{
quantity: 1,
price: process.env.STRIPE_MONTH_SUBSCRIPTION!
}
]
})
return monthSubscription.url
case "year":
const yearSubscription = await stripe.checkout.sessions.create({
success_url: process.env.STRIPE_SUCCESS_URL!,
mode: "subscription",
metadata: {
userEmail: args.userEmail
},
line_items: [
{
quantity: 1,
price: process.env.STRIPE_YEAR_SUBSCRIPTION!
}
]
})
return yearSubscription.url
default:
return {
stripeCheckoutUrl: null
}
}
} catch (error) {
logError("stripe", error, { args })
throw new GraphQLError(JSON.stringify(error))
}
} else {
logError("stripe", "not a member", { args })
throw new GraphQLError("not member")
}
}
on this code
I have process.env.STRIPE_SECRET_KEY set correctly
or actually
going to test something
yea its 100% correct
double checked
yet it fails verification