Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: replace dead Stripe payment links with API checkout

Louis Beaumontccdd0018f5b6
diff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
index 53a0ca6cb..c25f1ccd4 100644
--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
@@ -860,7 +860,7 @@ export function RecordingSettings() {
};
};
- const handleAudioTranscriptionModelChange = (
+ const handleAudioTranscriptionModelChange = async (
value: string,
realtime = false
) => {
@@ -872,12 +872,25 @@ export function RecordingSettings() {
// If trying to use cloud but not subscribed
if (value === "screenpipe-cloud" && !settings.user?.cloud_subscribed) {
- const clientRefId = `${
- settings.user?.id
- }&customer_email=${encodeURIComponent(settings.user?.email ?? "")}`;
- openUrl(
- `https://buy.stripe.com/9B63cv1cD1oG2Vjg097ss0G?client_reference_id=${clientRefId}`
- );
+ try {
+ const response = await fetch("https://screenpi.pe/api/cloud-sync/checkout", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${settings.user?.token}`,
+ },
+ body: JSON.stringify({
+ tier: "pro",
+ billingPeriod: "monthly",
+ userId: settings.user?.id,
+ email: settings.user?.email,
+ }),
+ });
+ const data = await response.json();
+ openUrl(data.url || "https://screenpi.pe/billing");
+ } catch {
+ openUrl("https://screenpi.pe/billing");
+ }
// Revert back to previous value in the Select component
return;
}
diff --git a/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx b/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx
index 4b71adc3f..24adfa748 100644
--- a/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx
+++ b/apps/screenpipe-app-tauri/components/upgrade-dialog.tsx
@@ -54,13 +54,34 @@ export function UpgradeDialog({
const handleSubscribe = async (isAnnual: boolean) => {
trackAction(isAnnual ? "subscribe_annual" : "subscribe_monthly");
- const baseUrl = isAnnual
- ? "https://buy.stripe.com/00w7sL5sT0kCdzX7tD7ss0H"
- : "https://buy.stripe.com/9B63cv1cD1oG2Vjg097ss0G";
- const params = new URLSearchParams();
- if (settings.user?.id) params.set("client_reference_id", settings.user.id);
- if (settings.user?.email) params.set("customer_email", settings.user.email);
- await openUrl(`${baseUrl}?${params.toString()}`);
+ if (!settings.user?.token) {
+ await commands.openLoginWindow();
+ onOpenChange(false);
+ return;
+ }
+ try {
+ const response = await fetch("https://screenpi.pe/api/cloud-sync/checkout", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${settings.user.token}`,
+ },
+ body: JSON.stringify({
+ tier: "pro",
+ billingPeriod: isAnnual ? "yearly" : "monthly",
+ userId: settings.user.id,
+ email: settings.user.email,
+ }),
+ });
+ const data = await response.json();
+ if (data.url) {
+ await openUrl(data.url);
+ } else {
+ await openUrl("https://screenpi.pe/billing");
+ }
+ } catch {
+ await openUrl("https://screenpi.pe/billing");
+ }
onOpenChange(false);
};