#hendr1x_api

1 messages ¡ Page 1 of 1 (latest)

inner bayBOT
#

👋 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.

finite yoke
#

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

tiny raptor
#

I normally store that in my database...I would like to keep doing that if possible

finite yoke
#

Like before the confirmation, after the confirmation etc?

tiny raptor
#

I am usually limited by how you guys handle things.

#

Ideally I would do it before confirmation

#

Ideally I could get it via invoice

finite yoke
#

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

tiny raptor
#

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?

finite yoke
#

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

tiny raptor
finite yoke
#

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

tiny raptor
#

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?

finite yoke
#

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

#

either of the options would work

tiny raptor
#

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?

finite yoke
#

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?

tiny raptor
#

An existing payment_method (entered via elements) or saved to an customer

finite yoke
tiny raptor
#

ah ok. Phew

#

So, I'm gonna try to get the data via invoice expanding payments

#

I think that's it actually

#

Thanks for your help