The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
use stripe test mode
Kiran K3b3496b39d99
diff --git a/packages/stripe-app/src/utils/constants.ts b/packages/stripe-app/src/utils/constants.tsindex 97fbdef050..102c672753 100644--- a/packages/stripe-app/src/utils/constants.ts+++ b/packages/stripe-app/src/utils/constants.ts@@ -1,3 +1,9 @@+import { StripeMode } from "./types";++// Dubexport const DUB_CLIENT_ID ="dub_app_c572e2fef56dc49d827dd77e58322536fc52e9e5b1f2c498";-export const DUB_HOST = "http://localhost:8888";+export const DUB_HOST = "https://app.dub.co";++// Stripe+export const STRIPE_MODE: StripeMode = "live";diff --git a/packages/stripe-app/src/utils/oauth.ts b/packages/stripe-app/src/utils/oauth.tsindex cb1862b684..891df156aa 100644--- a/packages/stripe-app/src/utils/oauth.ts+++ b/packages/stripe-app/src/utils/oauth.ts@@ -1,12 +1,12 @@import Stripe from "stripe";-import { DUB_CLIENT_ID, DUB_HOST } from "./constants";+import { DUB_CLIENT_ID, DUB_HOST, STRIPE_MODE } from "./constants";import { getSecret } from "./secrets";import { Token, Workspace } from "./types";// Get the redirect URL for the OAuth flow based on the mode-function getRedirectURL(mode: "live" | "test") {+function getRedirectURL() {return `https://dashboard.stripe.com/${- mode === "test" ? "test/" : ""+ STRIPE_MODE === "test" ? "test/" : ""}apps-oauth/dub.co`;}@@ -18,7 +18,7 @@ export function getOAuthUrl({state: string;challenge: string;}) {- return `${DUB_HOST}/oauth/authorize?client_id=${DUB_CLIENT_ID}&redirect_uri=${getRedirectURL("test")}&response_type=code&scope=workspaces.write&state=${state}&code_challenge=${challenge}&code_challenge_method=S256`;+ return `${DUB_HOST}/oauth/authorize?client_id=${DUB_CLIENT_ID}&redirect_uri=${getRedirectURL()}&response_type=code&scope=workspaces.write&state=${state}&code_challenge=${challenge}&code_challenge_method=S256`;}// Exchanges the authorization code for an access token@@ -39,7 +39,7 @@ export async function getToken({},body: new URLSearchParams({client_id: DUB_CLIENT_ID,- redirect_uri: getRedirectURL("test"),+ redirect_uri: getRedirectURL(),grant_type: "authorization_code",code_verifier: verifier,code,diff --git a/packages/stripe-app/src/utils/types.ts b/packages/stripe-app/src/utils/types.tsindex 46d289fabe..d8a2c23cc5 100644--- a/packages/stripe-app/src/utils/types.ts+++ b/packages/stripe-app/src/utils/types.ts@@ -11,3 +11,5 @@ export interface Workspace {name: string;logo: string;}++export type StripeMode = "test" | "live";diff --git a/packages/stripe-app/stripe-app.dev.json b/packages/stripe-app/stripe-app.dev.jsonindex 0deedfae6d..5e2d219659 100644--- a/packages/stripe-app/stripe-app.dev.json+++ b/packages/stripe-app/stripe-app.dev.json@@ -1,6 +1,3 @@{- "extends": "stripe-app.json",- "constants": {- "DUB_API_BASE": "http://localhost:8888/api"- }+ "extends": "stripe-app.json"}diff --git a/packages/stripe-app/stripe-app.json b/packages/stripe-app/stripe-app.jsonindex 416e93efd4..9b41ea44d2 100644--- a/packages/stripe-app/stripe-app.json+++ b/packages/stripe-app/stripe-app.json@@ -58,9 +58,6 @@"type": "settings","url": ""},- "constants": {- "DUB_API_BASE": "https://api.dub.co"- },"stripe_api_access_type": "platform","distribution_type": "public"}