mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
Merge pull request #25911 from overleaf/mf-stripe-payment-page-form-submit-event
[web] Simulate `payment-page-form-submit` event for Stripe subscription GitOrigin-RevId: 8cfa1a2d91aaea4314a4a40f3256bade50507084
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import Stripe from 'stripe'
|
||||
import { RecurlyPlanCode } from '../subscription/plan'
|
||||
|
||||
type MetadataPlanCode = Exclude<
|
||||
RecurlyPlanCode,
|
||||
| 'professional_free_trial_7_days'
|
||||
| 'student_free_trial_7_days'
|
||||
| 'collaborator_free_trial_7_days'
|
||||
>
|
||||
|
||||
export type ProductMetadata = Stripe.Metadata & {
|
||||
planCode: MetadataPlanCode
|
||||
addOnCode?: Extract<RecurlyPlanCode, 'assistant'>
|
||||
}
|
||||
@@ -53,6 +53,15 @@ export type InvoicePaidWebhookEvent = {
|
||||
data: {
|
||||
object: Stripe.Invoice
|
||||
}
|
||||
request: Stripe.Event.Request
|
||||
}
|
||||
|
||||
export type PaymentIntentPaymentFailedWebhookEvent = {
|
||||
type: 'payment_intent.payment_failed'
|
||||
data: {
|
||||
object: Stripe.PaymentIntent
|
||||
}
|
||||
request: Stripe.Event.Request
|
||||
}
|
||||
|
||||
export type CustomerSubscriptionWebhookEvent =
|
||||
@@ -63,3 +72,4 @@ export type CustomerSubscriptionWebhookEvent =
|
||||
export type WebhookEvent =
|
||||
| CustomerSubscriptionWebhookEvent
|
||||
| InvoicePaidWebhookEvent
|
||||
| PaymentIntentPaymentFailedWebhookEvent
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { CurrencyCode } from './currency'
|
||||
import { PaymentProvider } from './dashboard/subscription'
|
||||
|
||||
type PaymentPageFormSubmitEventBaseSegmentation = {
|
||||
currencyCode: CurrencyCode
|
||||
plan_code?: string
|
||||
coupon_code: string
|
||||
isPaypal: boolean
|
||||
upgradeType: 'standalone'
|
||||
referrer?: string
|
||||
}
|
||||
|
||||
type PaymentPageFormSubmitEventStripeSegmentation =
|
||||
PaymentPageFormSubmitEventBaseSegmentation & {
|
||||
payment_provider: Exclude<PaymentProvider['service'], 'recurly'>
|
||||
stripe_price_id: string
|
||||
stripe_price_lookup_key: string
|
||||
}
|
||||
|
||||
type PaymentPageFormSubmitEventRecurlySegmentation =
|
||||
PaymentPageFormSubmitEventBaseSegmentation & {
|
||||
payment_provider: Exclude<
|
||||
PaymentProvider['service'],
|
||||
'stripe-us' | 'stripe-uk'
|
||||
>
|
||||
}
|
||||
|
||||
export type PaymentPageFormSubmitEventSegmentation =
|
||||
| PaymentPageFormSubmitEventStripeSegmentation
|
||||
| PaymentPageFormSubmitEventRecurlySegmentation
|
||||
Reference in New Issue
Block a user