#fuzz-subscription-trial
1 messages · Page 1 of 1 (latest)
@old wasp you likely want to read https://stripe.com/docs/billing/subscriptions/trials
fuzz-subscription-trial
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