#HarryET - client_secret
1 messages ยท Page 1 of 1 (latest)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Even on the server side
Yes if you are retrieving the object it will be there
Can you get it when you expand the invoice object?
You would need to expand the payment_intent field: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You can see it's listed as expandable on that object
Right, but in the go sdk its nil even after expansion
Can you share your code and the invoice id you're checking?
Here?
subscriptionParams := &stripe.SubscriptionParams{}
subscriptionParams.AddExpand("latest_invoice.payment_intent")
subscription, err = sub.Get(subscriptionId, subscriptionParams)
Can you share the subscription id?
sub_1LHt9ND87dNEcOXnWWS9mycW
Oh it's because latest invoice is for $0
that doesn't make a client secret?
So the payment intent is null since it's a $0 invoice
there was no payment intent created
ohhhh, is there a way to make a payment intent for the customer to store the payment details?
Let's step back for a moment. What does your flow look like currently and what are you ultimately trying to do?
It's a SaaS product and on account creation I also register a stripe customer. I then have an endpoint which either creats or returns the subscription's ID and the client secret and it is used with the Stripe Checkout Element
๐ Just hopping in since @upper wasp has to head out soon
When you create a Subscription and the first Invoice has no payment required ($0), you can expand 'pending_setup_intent' on the Subscription instead, to get a Setup Intent that you can use to collect payment details
Oh really?
Yup!
Awesome, thanks