#hendr1x_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1369082836157726762
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- hendr1x_api, 3 days ago, 25 messages
Hello
The steps you've outlined make sense.
I'm not sure what you mean by
Is there a way to get the paymentIntent code for my database
Like before the confirmation, after the confirmation etc?
I am usually limited by how you guys handle things.
Ideally I would do it before confirmation
Ideally I could get it via invoice
The invoice will create a PaymentIntent when it's finalized. So you can expand confirmation secret when you receive invoice.finalized webhook event and split the client-secret by "secret" text to find the PaymentIntent ID
OR you can look up Invoice Payment object for an invoice - https://docs.stripe.com/api/invoice-payment/list
and look at payment parameter
As I outlined above, I am able to get the PaymentIntent secret immediately upon creating the subscription correct? Can I not do a direct look up using the secret?
When you say a direct look up, what do you mean? I don't really grasp the flow you're describing so asking to be on the same page
You don't get PaymentIntent until you do
That will return latest_invoice, which I can lookup the invoice with expanding confirmation_secret
I would like to get the paymentIntent.id before confirmation if possible
so it's not a direct "look up"
Okay let me take a step back.. The steps you've outlined in the original message
1/ Create Product + Price
2/ Create Subscription
3/ Retrieve latest_invoice while expanding confirmation_secret
4/ Use the client-secret to confirm the Payment client-side
The above makes complete sense
Then you're asking about
Is there a way to get the paymentIntent code for my database
...
paymentIntent.id
...
Ideally I would do it before confirmation
Ideally I could get it via invoice
....
A client-secret is usually a combination of the PaymentIntent object ID + a secret value..
For example: pi_12345_secret_ABCDEFG
So you could just split the string using "secret" term (quick and dirty implementation)
However, It would break if Stripe changes the format of client-secret at any point
Ok.
Thank you for explaining everything
So after I get the #3 completed...can I do another query to get the paymentntent.id ?
Is Invoice Payment object available at that time?
You can.. Since Invoice isn't directly associated with a PaymentIntent in the latest API version, you'd need to look at Invoice Payment object.
I think so, I haven't tested it myself but you can give it a try in test mode to be 100% certain
I see payments are also an expandable field on an Invoice. So you can try expanding payments as well - https://docs.stripe.com/api/invoices/object#invoice_object-payments
either of the options would work
Ok...I was actually just setting that
I don't think that is going to have data
Sorry one second
Ok...subscription doesn't accept a payment_method
Oh man...so can I not use payment_methods?
Do you mean you want to provide an existing Payment Method object (pm_xxx) OR do you mean payment method types the customer can use to pay the invoice?
An existing payment_method (entered via elements) or saved to an customer
You can pass it as default_payment_method when you create the subscription - https://docs.stripe.com/api/subscriptions/create#create_subscription-default_payment_method