#Roopa
1 messages ยท Page 1 of 1 (latest)
Hi there!
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_9rWBuKh8a7SPcb
That invoice is paid. You can't voided. What you want to achieve exactly ? to refund the customer ?
We are still in the development phase, in certain condition i want to make invoice 'void'.
I am using a test clock is it problem?
no
you can void an invoice when it's not still paid.
I am trying to do it when invoice is in the finalised status and still getting that error.
can you share the requestId ?
same request_id 'req_9rWBuKh8a7SPcb'
As soon as it passes above web hook block invoice is becoming 'paid' state.
Why you want to void the invoice? may I understand the use case ?
We want to add 2 yearly subscription to our system.
and as we cannot create 2 yearly using stripe we thought of creating yearly subscription and make alternative year invoice as void.
What you can do is to create a yearly subscription with the price of two year. and for the second year you downgrade the subscription to a 0$ subscription.
what about next to next year? we have to again update it to original price?
yes
ok. I will try that.
what was the issue with 'void' above?
and is there any other alternative option than downgrading the subscription?
Your integration is trying to void an already paid invoice.
yes I got it, but will not be any gap between finalised invoice become a paid?
Stripe finalize and send the invoice after one hour from being created. In this hour you can void, edit the invoice...
you mean I have to try voiding it in the InvoiceCreated webhook?
Let me try that now.
I am getting the same error, even though invoice status is 'draft'.
request id is :
req_Wnk22BzBtXVXZo
You need to open/finalize the invoice via API and then void it directly
https://stripe.com/docs/api/invoices/finalize
you mean: we have to move draft invoice to finalize through api and void it?
Yes try that.
I tried it but still the same error.
Could you please share the requestId?
Is it paid too ?
once the invoice was finalized ?
OK, so the invoice collection_method is charge_automatically as it was created from a subscription. So once it's finalized, its paid directly.
So can't do this with automatic invoice.
You need to change your logic for designing the 2 years subscription.
You can use the 1st option I mentioned. or you create a free yearly subscription, and each two year you charge the customer a manual invoice.
Is there any option where we can make invoice amount has '0' ?
hmm, it is possible to have an Invoice with amount:0 yes. If it is already finalized though you can't change it. If it's not finalized, you could add a negative invoice line item. https://stripe.com/docs/billing/invoices/subscription#adding-draft-invoice-items
I tried the above and getting error: "This value must be greater than or equal to 0 (it currently is '-0.35e4')."
-0.35e4 indicates you're not passing an integer
I don't know .NET as well as you likely do, but I imagine you want to do Math.Round(-35 * 100) or something like that
ah! sorry I hard coded value and did not realis it.
Thank you for your help. I will try it and let you know later.
It is taking only positive values not nagative value.
Hi there ๐ you cannot pass a negative amount via price_data. The price_data hash is used to create a Price object adhoc, and those cannot have a negative amount associated with them. To create an InvoiceItem with a negative amount, you will need to use the amount parameter instead:
https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes, I tried using the amount and I am getting error related to tax.
"The price price_1MbPLuDwT5gdvn7nYYoUsi5k does not have a tax_behavior set which is required for automatic tax computation. Please visit https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#tax-behavior for more information."
Can you share the ID of the request that returned that error?
req_VHdi7ajEtHkNNr
Thank you, pulling that up.
I see, does that error go away if you specify a tax_behavior?
https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-tax_behavior
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
InvoiceItemCreateOptions object does not have tax_behavior property
Support for that was added in version 40.15.0 which seems to be newer than the version you're currently using:
https://github.com/stripe/stripe-dotnet/releases/tag/v40.15.0
Yes, I am on 40.8.0