#awxsam_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/1428210191329132695
π Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! Sorry, I'm a little confused. Are you using this flow : https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=embedded-components and you would like to know how to link (or tie) the PaymentIntent to an Invoice?
Hi
I'm creating / returning a customer_id
Then creating the paymentintent and returning the client_secret to the frontend
Then calling this stripe function
await stripe.confirmCardPayment(client_secret, {
payment_method: {
card: cardElement,
billing_details: {
name: cardholderName,
email: user?.email || '',
address: {
line1: billingDetails.billingAddressLine1,
line2: billingDetails.billingAddressLine2 || undefined,
city: billingDetails.billingCity,
state: billingDetails.billingState,
postal_code: billingDetails.billingPostalCode,
country: billingDetails.billingCountry,
},
},
},
})```
But yes I would like to know how to link the PaymentIntent to an Invoice
I know recurring payments have invoices by default right, but I couldn't find any solution for one_off payments
how are you generating the client_secret - are you creating a PaymentIntent or are you creating a Checkout Session?
I'm creating a PaymentIntent
hmmm, gimme a few minutes to test something out
No problem, thank you
The closest I got was using setupIntent and then paying the invoice automatically in the backend when the payment happens, but this wouldn't work for 3DS challenges, as it would need to open the hosted invoice url in another tab for example
Actually, I think you would just want to just create an Invoice to make payment with. When an Invoice is finalized, it has an underlying PaymentIntent which you can use to make payment with. Maybe take a look at this guide : https://docs.stripe.com/invoicing/integration?method=elements&element=card
I think this will work yes, let me try it out and get back to you
Thank you so much
Hmm
params := &stripeSDK.InvoiceFinalizeInvoiceParams{}
params.AddExpand("confirmation_secret")
res, err := invoice.FinalizeInvoice(inv.ID, params)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
fmt.Println(res.ConfirmationSecret)```
Any idea why `res.ConfirmationSecret` would be `nil` (the expand not registering?)
can you share the request ID where you finalized the Invoice? The request ID will have the prefix req_
https://support.stripe.com/questions/finding-the-id-for-an-api-request
hmmm, I'm going to need some time to look into this. I kind of know what's causing the issue, but I'm not entirely certain if this is a bug or is expected behaviour.
In the meantime, can you use https://docs.stripe.com/api/invoice-payment/list, pass in the Invoice ID : https://docs.stripe.com/api/invoice-payment/list#list_invoice_payments-invoice to get the underlying PaymentIntent's client_secret? You might need to expand payment.payment_intent when making this request I think
I'm going to share a link with you to write in so that I can get back to you after I look further into why the ConfirmationSecret is not being returned
Hello @near basalt, we have sent you a direct message, please check it at https://discord.com/channels/@me/1428220089441714329
- πThe message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
let me know if you're still running into issues or have any other questions
Will do
got the support ticket!
Thank you. Our team will respond to you as soon as possible.
The chat has ended. For further assistance, please close the window and start a new chat.```
I'm confused, do I open a new chat or just leave it as it is and I'll get an email or something?
hmmm, I think you would have gotten an email informing you that a ticket is created?
Otherwise, no worries, I can just respond to that support ticket right now and you should see an email
Oh right must be this, sorry my mistake
yay! okay, good that you found the email π
I found the issue, it was my mistake, somehow forgot to add the invoice ID on the new invoice item, making the actual invoice total 0.00 and it not giving a confirmation_secret. Can close this ticket and mark as resolved.
Thank you once again
aaah, alright! π₯³