#elias-discount-invoice
1 messages · Page 1 of 1 (latest)
yes this is a developer channel
yeah so I am using the .NET stripe.net package
and I have an invoice and some lineitems added to it
you update the Invoice to apply a Discount or Coupon https://stripe.com/docs/api/invoices/update#update_invoice-discounts
or apply a negative Invoice Line Item
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Oh Ok thanks I can just add them as a line item but with a negative unit amount?
can I add discounts in as an InvoiceCreate Options?
Or can I add a negative invoice line item?
like an item with a negative price?
you need to create an InvoiceItem and add it to that Invoice
yes
amazing thank you
one more thing
I want to use Stripe Tax
when I create my invoice how do i enable automatic tax?
Is there anything I have to do for the customer when I create it to enable automatic tax ? All I'm doing right now is creating a customer with an address
a colleague is stepping in and they can help you in a bit
ok
👋 give me a few minutes to catch up @round moon
Quick question - have you read this doc yet https://stripe.com/docs/tax/invoicing ?
I have yes
At the bottom it specifies how you would create an invoice and enable automatic tax
Basically, you just want to set automatic_tax[enabled]: true
yeah I see that It just tells me how to do it with curl
I dont know how to do it with .NET
stripe.net package
Like I understand there is an AutomaticTax property on the invoice but I dont know how to set it
Just to check - which version of the Stripe dotnet library are you using?
39.80.0
Then you'd just do soethign like this:
var options = new InvoiceCreateOptions
{
Customer = "cus_XXX",
AutomaticTax = new InvoiceAutomaticTaxOptions
{
Enabled = true,
},
};
var service = new InvoiceService();
service.Create(options);
perfect thanks
when I submit the invoice
what can I do to check if it has been paid
this is what I'm doing right now
if (res.Status != "paid")
{
return new Result<string>("PaymentFailed", "Your payment was not processed. Please enter a new card.");
}```
Yeah that should work if you're using the API to manually attempt payment on an Invoice
Yes, it should be - let me check where it should be reflected
You should be able to see the total tax applied to the invoice at tax (see https://stripe.com/docs/api/invoices/object#invoice_object-tax)