From 86bab9dc992f3ac5674087969c290c5a0a704769 Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Wed, 5 Aug 2026 12:58:24 +0200 Subject: [PATCH] Merge pull request #35724 from overleaf/ac-wallet-payment-method-analytics [web] Add Stripe wallet payments (Apple Pay / Google Pay) in analytics and remove conversion to "card" GitOrigin-RevId: f6d404d35eb108d7ddaf8ca1b6c2164cb5100c9c --- services/web/config/settings.defaults.js | 3 ++- .../web/test/acceptance/src/HttpPermissionsPolicyTests.mjs | 2 +- services/web/types/subscription/analytics-event.ts | 4 ++-- services/web/types/subscription/payment-method.ts | 7 ++++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index 5a5e917f7a..afd801a47b 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -99,7 +99,6 @@ const httpPermissionsPolicy = { 'magnetometer', 'midi', 'otp-credentials', - 'payment', 'picture-in-picture', 'screen-wake-lock', 'serial', @@ -112,6 +111,8 @@ const httpPermissionsPolicy = { autoplay: 'self "https://videos.ctfassets.net"', fullscreen: 'self', 'on-device-speech-recognition': 'self', + // required for Apple Pay / Google Pay + payment: 'self "https://js.stripe.com"', }, } diff --git a/services/web/test/acceptance/src/HttpPermissionsPolicyTests.mjs b/services/web/test/acceptance/src/HttpPermissionsPolicyTests.mjs index affbbeda98..78972709ea 100644 --- a/services/web/test/acceptance/src/HttpPermissionsPolicyTests.mjs +++ b/services/web/test/acceptance/src/HttpPermissionsPolicyTests.mjs @@ -9,7 +9,7 @@ describe('HttpPermissionsPolicy', function () { const response = await fetch(BASE_URL) expect(response.headers.get('permissions-policy')).to.equal( - 'accelerometer=(), attribution-reporting=(), browsing-topics=(), camera=(), display-capture=(), encrypted-media=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), identity-credentials-get=(), idle-detection=(), local-fonts=(), magnetometer=(), midi=(), otp-credentials=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), storage-access=(), usb=(), window-management=(), xr-spatial-tracking=(), autoplay=(self "https://videos.ctfassets.net"), fullscreen=(self), on-device-speech-recognition=(self)' + 'accelerometer=(), attribution-reporting=(), browsing-topics=(), camera=(), display-capture=(), encrypted-media=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), identity-credentials-get=(), idle-detection=(), local-fonts=(), magnetometer=(), midi=(), otp-credentials=(), picture-in-picture=(), screen-wake-lock=(), serial=(), storage-access=(), usb=(), window-management=(), xr-spatial-tracking=(), autoplay=(self "https://videos.ctfassets.net"), fullscreen=(self), on-device-speech-recognition=(self), payment=(self "https://js.stripe.com")' ) }) diff --git a/services/web/types/subscription/analytics-event.ts b/services/web/types/subscription/analytics-event.ts index c2cb1a4a0b..383f9bc1ee 100644 --- a/services/web/types/subscription/analytics-event.ts +++ b/services/web/types/subscription/analytics-event.ts @@ -3,7 +3,7 @@ import { PaymentProvider, StripePaymentProviderService, } from './dashboard/subscription' -import { PaymentMethod } from './payment-method' +import { AnalyticsPaymentMethod, PaymentMethod } from './payment-method' import { RecurlyPlanCode } from './plan' type PaymentPageFormSubmitEventBaseSegmentation = { @@ -48,7 +48,7 @@ type PaymentPageFormSuccessEventStripeSegmentation = payment_provider: StripePaymentProviderService stripe_price_id: string stripe_price_lookup_key: string - paymentMethod: PaymentMethod + paymentMethod: AnalyticsPaymentMethod } type PaymentPageFormSuccessEventRecurlySegmentation = diff --git a/services/web/types/subscription/payment-method.ts b/services/web/types/subscription/payment-method.ts index fae85fa456..89a338c163 100644 --- a/services/web/types/subscription/payment-method.ts +++ b/services/web/types/subscription/payment-method.ts @@ -1 +1,6 @@ -export type PaymentMethod = 'credit_card' | 'paypal' +// Payment methods selectable in the checkout UI +export type PaymentMethod = 'card' | 'paypal' | 'apple_pay' | 'google_pay' + +// Server-side analytics segmentation passes through the raw Stripe payment +// method type for methods not in the checkout UI (e.g. sepa_debit) +export type AnalyticsPaymentMethod = PaymentMethod | (string & {})