PaymentIntent missing on a subscription?
SOLVED:
So many documentation and examples are wrong now because it's moved to a different object.
// expand: ['latest_invoice.confirmation_secret'] // - add this to your subscription.create call
const clientSecret = subscription.latest_invoice?.confirmation_secret?.client_secret
Very new to stripe so I'm probably missing something basic. I'm trying to build a custom Elements form which needs the client secret. Using NextJS, supabase, and stripe.
No matter what I've tried, the \`payment\_intent\` data is completely missing from \`latest\_invoice\`. I've added the \`expand\` property, it's not a trial, the price is $10, so I'm very confused what I'm missing.
Gemini has been absolutely no help as it suggests everything I've mentioned above. The subscription is created successfully, I can see the complete json object it returned, but payment\_intent is missing and is undefined.
I've also tried to create a checkout session based on their [docs here](https://docs.stripe.com/billing/subscriptions/build-subscriptions) and the payment\_intent is null.
const subscription = await stripe.subscriptions.create({ customer: customerId, items: [ { price: priceId, quantity: 1 } ], payment_behavior: 'default_incomplete', payment_settings: { save_default_payment_method: 'on_subscription', payment_method_types: ['card'] }, metadata: { workspace_id: workspaceId }, expand: ['latest_invoice.payment_intent'] })