GithubHelp home page GithubHelp logo

Comments (4)

szymonhernik avatar szymonhernik commented on May 24, 2024

bump. i think there is lack of coherence between the stripe docs and the template atm. from my understanding you can't set up trial_period_days in Stripe anymore, and the functions in the starter use these values to calculate calculateTrialEndUnixTimestamp. can anyone help to clarify?

from nextjs-subscription-payments.

Akshath-Nagulapally avatar Akshath-Nagulapally commented on May 24, 2024

oh I see. Though that could be true, I tried setting up the stripe trial period and it did work and reflect in the DB. How recent was this change to stripe as I tried doing this 3 days after started this thread.

from nextjs-subscription-payments.

fullstackwebdev avatar fullstackwebdev commented on May 24, 2024

oh I see. Though that could be true, I tried setting up the stripe trial period and it did work and reflect in the DB. How recent was this change to stripe as I tried doing this 3 days after started this thread.

are you saying it works now? was it a missing stripe event or code base?

from nextjs-subscription-payments.

szymonhernik avatar szymonhernik commented on May 24, 2024

Here is a step by step guide for you. Hope it helps.

TO DO to add trial

  • in admin.ts change TRIAL_PERIOD_DAYS to number of days
    • push changes
  • on price update (in Stripe) this should update the price with that value
    • you can test it by adding new price or editting an existing one
    • listen to webhooks for price.updated event
    • to check if the trial_period_days on price has been updated console.log prices -> it should return trial_period_days: 7 (or any other number you set up)
  • now you will work with the stripe/server.ts file. when creating stripe checkout session you will want to make sure the console.log that is already there (Trial end: ...) will console log correct UnixTimestamp (result of calculateTrialEndUnixTimestamp called later when setting params on recurring payment)
    • it should return something like 'Trial end: 1714042027' when you click Subscribe on the price you added or edited before and in the stripe checkout page it should give you some info on the left about the trial being set up, for example "Tryout Basic: 7 days for free. Next 5,00 eur per month"

from nextjs-subscription-payments.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.