Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Im receiving this after success payment, on success page #16

Open
w1redl4in opened this issue Oct 26, 2024 · 0 comments
Open

Im receiving this after success payment, on success page #16

w1redl4in opened this issue Oct 26, 2024 · 0 comments

Comments

@w1redl4in
Copy link

w1redl4in commented Oct 26, 2024

Error: Stripe: Argument "session" must be a string, but got: undefined (on API request to GET /v1/checkout/sessions/{session})

Success page is just like the template

import { Button } from "@/components/ui/button";
import NavBar from "@/components/wrapper/navbar";
import Link from "next/link";
import Stripe from "stripe";

// Initialize Stripe with your secret key
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

export default async function SuccessPage(props: {
  searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}) {
  const searchParams = await props.searchParams;

  const session = await stripe.checkout.sessions.retrieve(
    searchParams?.session_id as string
  );

  const jsonString = JSON.stringify(session, null, 2);

  return (
    <main className="flex min-w-screen flex-col items-center justify-between">
      <NavBar />
      <h1 className="mt-[35vh] mb-3 scroll-m-20  text-5xl font-semibold tracking-tight transition-colors first:mt-0">
        Welcome to Nextjs Starter Kit 🎉
      </h1>
      <p className="leading-7 text-center w-[60%]">Let&apos;s get cooking</p>
      <Link href="/dashboard" className="mt-4">
        <Button>Access Dashboard</Button>
      </Link>
    </main>
  );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant