#fuzz-subscription-trial

1 messages · Page 1 of 1 (latest)

halcyon glenBOT
agile needle
#

fuzz-subscription-trial

old wasp
#

okay thanks

#
- error src\pages\api\create-payment-intent.js (96:66) @ client_secret        
- error Error [TypeError]: Cannot read properties of null (reading 'client_secret')
    at contact (webpack-internal:///(api)/./src/pages/api/create-payment-intent.js:104:75)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  digest: undefined
}
  94 |
  95 |       res.send({
> 96 |         clientSecret: paymentIntent.latest_invoice.payment_intent.client_secret,
     |                                 
                                 ^     
  97 |       });
  98 |     }
  99 |   }
#
      // Get the current date and time
      const currentDate = new Date();

      // Calculate the date 7 days from now
      const futureDate = new Date(
        currentDate.getTime() + 7 * 24 * 60 * 60 * 1000
      ); // Add 7 days in milliseconds

      // Convert the future date to a Unix timestamp
      const unixTimestamp = Math.floor(futureDate.getTime() / 1000);

      const paymentIntent = await stripe.subscriptions.create({
        customer: customer.id,
        trial_end: unixTimestamp,
#

after i added that

agile needle
#

that's expected, there's a trial, so nothing to pay, so no PaymentIntent for you to access

#

You can look at pending_setup_intent instead which would be a SetupIntent to collect payment method details without a payment