Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
olafsulich committed Mar 7, 2023
2 parents 75515bd + d4468a1 commit c94623a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/mdx/codeHeader/CodeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const CodeHeader = memo<CodeHeaderProps>(({ onCopy, className, isCopied,
</button>
{className && (
<a href={getCodeSandboxLink()} target="_blank" className={styles.sandbox}>
<span className="visually-hidden">Stwórz nowy codesanbox</span>
<span className="visually-hidden">Stwórz nowy codesandbox</span>
<ExternalLinkIcon className={styles.sandboxIcon} />
</a>
)}
Expand Down
21 changes: 11 additions & 10 deletions content/posts/fullstack-next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1467,19 +1467,20 @@ const stripe = new Stripe(getEnv('STRIPE_SECRET_KEY'), {
apiVersion: '2020-08-27',
});


export default async (req: NextApiRequest, res: NextApiResponse) => {
try {
const prisma = new PrismaClient();

const products = await prisma.product.findMany();
const { id } = await stripe.checkout.sessions.create({
mode: 'payment',
submit_type: 'donate',
payment_method_types: ['card'],
success_url: `${req.headers.origin}/result?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${req.headers.origin}/result?session_id={CHECKOUT_SESSION_ID}`,
line_items: req.body,
});

if (products.length) {
res.status(200).json(products);
res.end();
} else {
res.status(404);
res.end();
}
res.status(200).json({ id });
res.end();
} catch {
res.status(500);
}
Expand Down

1 comment on commit c94623a

@vercel
Copy link

@vercel vercel bot commented on c94623a Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.