MCPcopy Index your code
hub / github.com/anomalyco/opencode / createSession

Function createSession

packages/console/core/src/billing.ts:334–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

332 return undefined
333 })()
334 const createSession = () =>
335 Billing.stripe().checkout.sessions.create({
336 mode: "subscription",
337 discounts: coupon ? [{ coupon }] : undefined,
338 ...(billing.customerID
339 ? {
340 customer: billing.customerID,
341 customer_update: {
342 name: "auto",
343 address: "auto",
344 },
345 }
346 : {
347 customer_email: email,
348 }),
349 ...(() => {
350 if (method === "alipay") {
351 return {
352 line_items: [{ price: LiteData.priceID(), quantity: 1 }],
353 payment_method_types: ["alipay"],
354 adaptive_pricing: {
355 enabled: false,
356 },
357 }
358 }
359 if (method === "upi") {
360 return {
361 line_items: [
362 {
363 price_data: {
364 currency: "inr",
365 product: LiteData.productID(),
366 recurring: {
367 interval: "month",
368 interval_count: 1,
369 },
370 unit_amount: LiteData.priceInr(),
371 },
372 quantity: 1,
373 },
374 ],
375 payment_method_types: ["upi"] as any,
376 adaptive_pricing: {
377 enabled: false,
378 },
379 }
380 }
381 return {
382 line_items: [{ price: LiteData.priceID(), quantity: 1 }],
383 billing_address_collection: "required",
384 }
385 })(),
386 tax_id_collection: {
387 enabled: true,
388 },
389 success_url: successUrl,
390 cancel_url: cancelUrl,
391 subscription_data: {

Callers 1

billing.tsFile · 0.70

Calls 2

workspaceMethod · 0.80
createMethod · 0.65

Tested by

no test coverage detected