Skip to content

Commit

Permalink
🐛 Landing: Fix checkout issue with correct PAT (#2988)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckcarpenter authored Sep 25, 2024
1 parent be3dede commit 02f6140
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 326 deletions.
1 change: 0 additions & 1 deletion landing/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import tailwind from '@astrojs/tailwind';
import { loadEnv } from 'vite';

import vercel from '@astrojs/vercel/serverless';

Expand Down
2 changes: 1 addition & 1 deletion landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/vercel": "^7.8.1",
"@polar-sh/sdk": "^0.8.1",
"@polar-sh/sdk": "^0.10.0",
"astro": "^4.15.4",
"shepherd.js": "workspace:*",
"tailwindcss": "^3.4.11",
Expand Down
18 changes: 9 additions & 9 deletions landing/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { defineAction } from 'astro:actions';
import { z } from 'astro:schema';

import { Polar } from "@polar-sh/sdk";
import { Polar } from '@polar-sh/sdk';

const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
accessToken: import.meta.env.POLAR_ACCESS_TOKEN ?? ''
});

export const server = {
checkout: defineAction({
checkout: defineAction({
input: z.object({
productPriceId: z.string(),
productPriceId: z.string()
}),
handler: async (input) => {
const { productPriceId } = input;
let result;

try {
result = await polar.checkouts.create({
productPriceId: productPriceId,
successUrl: 'https://docs.shepherdjs.dev',
productPriceId,
successUrl: 'https://docs.shepherdjs.dev'
});
} catch (error) {
console.error("Checkout error:", error);
console.error('Checkout error:', error);
} finally {
if (result?.url) {
return result.url;
Expand All @@ -32,4 +32,4 @@ export const server = {
}
}
})
}
};
Loading

0 comments on commit 02f6140

Please sign in to comment.