Advertisement
ikamal7

shopify.server.tsx

Jan 4th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import "@shopify/shopify-app-remix/adapters/node";
  2. import {
  3.   ApiVersion,
  4.   AppDistribution,
  5.   shopifyApp,
  6.   BillingInterval,
  7. } from "@shopify/shopify-app-remix/server";
  8. import { PrismaSessionStorage } from "@shopify/shopify-app-session-storage-prisma";
  9. import { restResources } from "@shopify/shopify-api/rest/admin/2024-07";
  10. import prisma from "./db.server";
  11.  
  12. export const MONTHLY_BASIC_PLAN = "Monthly Basic Plan";
  13. export const MONTHLY_PLUS_PLAN = "Monthly Plus Plan";
  14. export const MONTHLY_ADVANCED_PLAN = "Monthly Advance Plan";
  15.  
  16. export const YEARLY_BASIC_PLAN = "Yearly Basic Plan";
  17. export const YEARLY_PLUS_PLAN = "Yearly Plus Plan";
  18. export const YEARLY_ADVANCED_PLAN = "Yearly Advance Plan";
  19.  
  20. export const LIFETIME_BASIC_PLAN = "Lifetime Basic Plan";
  21. export const LIFETIME_PLUS_PLAN = "Lifetime Plus Plan";
  22. export const LIFETIME_ADVANCED_PLAN = "Lifetime Advance Plan";
  23.  
  24. const shopify = shopifyApp({
  25.   apiKey: process.env.SHOPIFY_API_KEY,
  26.   apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
  27.   apiVersion: ApiVersion.July24,
  28.   scopes: process.env.SCOPES?.split(","),
  29.   appUrl: process.env.SHOPIFY_APP_URL || "",
  30.   authPathPrefix: "/auth",
  31.   sessionStorage: new PrismaSessionStorage(prisma),
  32.   distribution: AppDistribution.AppStore,
  33.   restResources,
  34.   billing:{
  35.     [MONTHLY_BASIC_PLAN]:{
  36.       amount: 9.99,
  37.       currencyCode: "USD",
  38.       interval: BillingInterval.Every30Days,
  39.     },
  40.     [MONTHLY_PLUS_PLAN]:{
  41.       amount: 15.99,
  42.       currencyCode: "USD",
  43.       interval: BillingInterval.Every30Days,
  44.     },
  45.     [MONTHLY_ADVANCED_PLAN]:{
  46.       amount: 29.99,
  47.       currencyCode: "USD",
  48.       interval: BillingInterval.Every30Days,
  49.     },
  50.     [YEARLY_BASIC_PLAN]:{
  51.       amount: 107.99,
  52.       currencyCode: "USD",
  53.       interval: BillingInterval.EveryYear,
  54.     },
  55.     [YEARLY_PLUS_PLAN]:{
  56.       amount: 172.99,
  57.       currencyCode: "USD",
  58.       interval: BillingInterval.EveryYear,
  59.     },
  60.     [YEARLY_ADVANCED_PLAN]:{
  61.       amount: 323.99,
  62.       currencyCode: "USD",
  63.       interval: BillingInterval.EveryYear,
  64.     },
  65.  
  66.     [LIFETIME_BASIC_PLAN]:{
  67.       amount: 323.99,
  68.       currencyCode: "USD",
  69.       interval: BillingInterval.OneTime,
  70.     },
  71.     [LIFETIME_PLUS_PLAN]:{
  72.       amount: 518.99,
  73.       currencyCode: "USD",
  74.       interval: BillingInterval.OneTime,
  75.     },
  76.     [LIFETIME_ADVANCED_PLAN]:{
  77.       amount: 971.99,
  78.       currencyCode: "USD",
  79.       interval: BillingInterval.OneTime,
  80.     },
  81.   },
  82.   future: {
  83.     unstable_newEmbeddedAuthStrategy: true,
  84.   },
  85.   ...(process.env.SHOP_CUSTOM_DOMAIN
  86.     ? { customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN] }
  87.     : {}),
  88. });
  89.  
  90.  
  91.  
  92. export default shopify;
  93. export const apiVersion = ApiVersion.July24;
  94. export const addDocumentResponseHeaders = shopify.addDocumentResponseHeaders;
  95. export const authenticate = shopify.authenticate;
  96. export const unauthenticated = shopify.unauthenticated;
  97. export const login = shopify.login;
  98. export const registerWebhooks = shopify.registerWebhooks;
  99. export const sessionStorage = shopify.sessionStorage;
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement