MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / createCheckout

Function createCheckout

packages/payments/src/polar.ts:46–77  ·  view source on GitHub ↗
({
  productId,
  organizationId,
  user,
  ipAddress,
}: {
  productId: string;
  organizationId: string;
  user: {
    id: string;
    firstName: string | null;
    lastName: string | null;
    email: string;
  };
  ipAddress: string;
})

Source from the content-addressed store, hash-verified

44}
45
46export async function createCheckout({
47 productId,
48 organizationId,
49 user,
50 ipAddress,
51}: {
52 productId: string;
53 organizationId: string;
54 user: {
55 id: string;
56 firstName: string | null;
57 lastName: string | null;
58 email: string;
59 };
60 ipAddress: string;
61}) {
62 return polar.checkouts.create({
63 // productPriceId: priceId,
64 products: [productId],
65 successUrl: getSuccessUrl(
66 process.env.DASHBOARD_URL || process.env.NEXT_PUBLIC_DASHBOARD_URL!,
67 organizationId,
68 ),
69 customerEmail: user.email,
70 customerName: [user.firstName, user.lastName].filter(Boolean).join(' '),
71 customerIpAddress: ipAddress,
72 metadata: {
73 organizationId,
74 userId: user.id,
75 },
76 });
77}
78
79export async function cancelSubscription(subscriptionId: string) {
80 try {

Callers 1

subscription.tsFile · 0.90

Calls 2

getSuccessUrlFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected