Skip to content

IA-965: feat(stripe): dynamic trial period days for checkout sessions

khadija.elbachouri a demandé de fusionner feature/AI-965 vers develop

feat(stripe): dynamic trial period days for checkout sessions

Summary

Previously, the checkout session hardcoded a 7-day trial period for all subscriptions. This change makes the trial period dynamic by first checking the value passed in the request, then falling back to fetching the configured trial days from the subscription service based on the gateway price ID.


Changes

StripeCheckoutRequestDTO

  • Added optional trialPeriodDays field to allow callers to explicitly provide a trial period.

StripeServiceImpl#createCheckoutSession

  • Updated trial period resolution logic: uses the value from the request if valid, otherwise calls the subscription service to fetch the trial days associated with the given price.
  • Falls back to no trial if neither source provides a valid value.

SubscriptionServiceClient

  • Added getTrialPeriodDaysByGatewayPriceId(String gatewayPriceId) to fetch trial days from the subscription service.
    • Endpoint: GET /api/subscriptions/by-gateway-price/{gatewayPriceId}/trial-days

Rapports de requête de fusion