#Linas
1 messages ยท Page 1 of 1 (latest)
How are you trying to edit the invoice? Via the API?
yes
Yeah, you can't edit it directly after its been finalised. You need to create a revision: https://stripe.com/docs/invoicing/invoice-edits?testing-method=with-code
There's a from_invoice parameter you pass when you create a new invoice: https://stripe.com/docs/api/invoices/create#create_invoice-from_invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thank you. Maybe there is more simple solution? In general i'm finalizing invoice only, that i could get client secret via PaymentIntent. But maybe there is more simple solition to get client secret ?
maybe i don't need to finalizei nvoice ?
You'll only get a Payment Intent (and its client_secret) once the Invoice is finalised
There's no other way to amend/change a finalised invoice
And there is no other way to get client secret?
With invoicing? No
got it, thank you.
and one more question:
now, when user lands on page, system automatically creates customer, invoices and so on... so there will be a lot of empty/unpaid users on stripe.
Is that a normal practice?
Why specifically are you using invoices?
because i want to list products with separate prices.
so i create invoice and add invoice items to it.
on payment form we have a bump offer. If user clicks on it, we need to add additional item to invoice. If user unclicks it, we need to remove that additional item from invoice.
Then just don't finalise the invoice until they reach the final step of your checkout. That will prevent the need for the amendments
But if i don't finalize, how i would get client secret from backend ?
You only need the client_secret once they're ready to pay though. So you just delay the finalisation until they're at the last step
Really, your use case for invoicing isn't very traditional. They're not meant to be used in a checkout flow like this
but client secret is used to generate apple pay button, no ?
my backend part looks like this. Not sure if you are familiar with php.
Yes, it's required for initialising our payment UIs
My point is, you need to adjust your checkout flow to only finalise once any/all changes have been made the the order/invoice. That will significantly reduce the code burden on your integration
But as I stated, the invoicing API/product isn't really meant for this usage which is why you're running up against issues like this
Ok, but i cannot avoid invoicing, because i need to list products as separate items? Right ?
I don't know what what means. What specifically do you require from that?
Are you using it as a way to display a cart?
I need to have that data (that user bought two items) on webhooks, that i could fulfill the order. At first i was following classic stripe ApplePay example, which is ok, when you are selling single product.
Also if user requests for refund on one item, that i could issue refund for that one item.
thats why i have choosen Invoicing..
Why not use Checkout instead? https://stripe.com/docs/payments/checkout
but then user is paying on stripe website, right ?
Correct, but it handles all of your requirements for you
my boss wont agree on this.
Otherwise there isn't really a Stripe API that handles the order functionality that you're describing
You'll likely want to leverage a third-party service for some cart/order functionality, otherwise you'll continue to come against issues with the Invoicing API
what issues you have in mind ?
i guess, i could also delete finalized invoice and if user adds item to invoice, i could create new one with items, right ?
The ones we've been talking about at length already
You can't delete a finalised invoice, only void them
My suggestion would be to create or use a third-party order system and leverage Stripe for payments
So, there is two solutions:
- Use stripe checkout, which happens on stripe page 2) USE revise invoice (which is not recomended) 3) Void invoice and recreate (also not recomended)
Hello ๐
Taking over as ynnoj needs to step away
So, there is two solutions:
- Use stripe checkout, which happens on stripe page 2) USE revise invoice (which is not recomended) 3) Void invoice and recreate (also not recomended)
yes
ok, let me a bit explore documentation..