Delete a draft invoice
Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be voided.
Parameters
No parameters.
Returns
A successfully deleted invoice. Otherwise, this call raises an error, such as if the invoice has already been deleted.
{
"id": "in_1MtHbELkdIwHu7ixl4OzzPMv",
"object": "invoice",
"deleted": true
}
Bulk add invoice line items
Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
Parameters
- linesarray of objectsRequired
The line items to add.
- invoice_
metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
Returns
The updated invoice with newly added line items is returned upon success. Otherwise, this call raises an error.
{
"id": "in_1NuhUa2eZvKYlo2CWYVhyvD9",
"object": "invoice",
"account_country": "US",
"account_name": "Stripe.com",
"account_tax_ids": null,
"amount_due": 998,
"amount_paid": 0,
"amount_remaining": 998,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1695758664,
"currency": "usd",
"custom_fields": null,
"customer": "cus_9s6XKzkNRiz8i3",
"customer_address": null,
"customer_email": "test@test.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": null,
"ending_balance": null,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": null,
"invoice_pdf": null,
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"object": "list",
"data": [
{
"id": "il_1NuhUa2eZvKYlo2CC98Fg3Bo",
"object": "line_item",
"amount": 799,
"amount_excluding_tax": 799,
"currency": "usd",
"description": "test description",
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1NuhUa2eZvKYlo2CGeF7Qgx0",
"livemode": false,
"metadata": {},
"period": {
"end": 1695758664,
"start": 1695758664
},
"price": {
"id": "price_1NuhLA2eZvKYlo2Cq1tIGEBp",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1695758080,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_Oi7aO1GPi1dWX7",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 799,
"unit_amount_decimal": "799"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "799"
},
{
"id": "il_1NuLVe2eZvKYlo2Canh35EfU",
"object": "line_item",
"amount": 199,
"amount_excluding_tax": 199,
"currency": "usd",
"description": "Canned Coffee",
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1NuLVd2eZvKYlo2CRWY0Hqgi",
"livemode": false,
"metadata": {},
"period": {
"end": 1695674161,
"start": 1695674161
},
"price": {
"id": "price_1NuI212eZvKYlo2CWgdD8kET",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1695660793,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_OhhQNWDYdIbXYv",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 199,
"unit_amount_decimal": "199"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "199"
}
],
"has_more": false,
"url": "/v1/invoices/upcoming/lines?customer=cus_9s6XKzkNRiz8i3"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1688482163,
"period_start": 1688395763,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"redaction": null,
"rendering": null,
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 998,
"subtotal_excluding_tax": 998,
"tax": null,
"test_clock": null,
"total": 998,
"total_discount_amounts": [],
"total_excluding_tax": 998,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}
Bulk remove invoice line items
Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
Parameters
- linesarray of objectsRequired
The line items to remove.
- invoice_
metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
Returns
The updated invoice without the removed line items is returned upon success. Otherwise, this call raises an error.
{
"id": "in_1NuhUa2eZvKYlo2CWYVhyvD9",
"object": "invoice",
"account_country": "US",
"account_name": "Stripe.com",
"account_tax_ids": null,
"amount_due": 998,
"amount_paid": 0,
"amount_remaining": 998,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1695758664,
"currency": "usd",
"custom_fields": null,
"customer": "cus_9s6XKzkNRiz8i3",
"customer_address": null,
"customer_email": "test@test.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": null,
"ending_balance": null,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": null,
"invoice_pdf": null,
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"object": "list",
"data": [
{
"id": "il_1NuhUa2eZvKYlo2CC98Fg3Bo",
"object": "line_item",
"amount": 799,
"amount_excluding_tax": 799,
"currency": "usd",
"description": "test description",
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1NuhUa2eZvKYlo2CGeF7Qgx0",
"livemode": false,
"metadata": {},
"period": {
"end": 1695758664,
"start": 1695758664
},
"price": {
"id": "price_1NuhLA2eZvKYlo2Cq1tIGEBp",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1695758080,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_Oi7aO1GPi1dWX7",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 799,
"unit_amount_decimal": "799"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "799"
},
{
"id": "il_1NuLVe2eZvKYlo2Canh35EfU",
"object": "line_item",
"amount": 199,
"amount_excluding_tax": 199,
"currency": "usd",
"description": "Canned Coffee",
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1NuLVd2eZvKYlo2CRWY0Hqgi",
"livemode": false,
"metadata": {},
"period": {
"end": 1695674161,
"start": 1695674161
},
"price": {
"id": "price_1NuI212eZvKYlo2CWgdD8kET",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1695660793,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_OhhQNWDYdIbXYv",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 199,
"unit_amount_decimal": "199"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "199"
}
],
"has_more": false,
"url": "/v1/invoices/upcoming/lines?customer=cus_9s6XKzkNRiz8i3"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1688482163,
"period_start": 1688395763,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"redaction": null,
"rendering": null,
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 998,
"subtotal_excluding_tax": 998,
"tax": null,
"test_clock": null,
"total": 998,
"total_discount_amounts": [],
"total_excluding_tax": 998,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}
Bulk update invoice line items
Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
Parameters
- linesarray of objectsRequired
The line items to update.
- invoice_
metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
. For type=subscription line items, the incoming metadata specified on the request is directly used to set this value, in contrast to type=invoiceitem line items, where any existing metadata on the invoice line is merged with the incoming data.
Returns
The updated invoice is returned upon success. Otherwise, this call raises an error.
{
"id": "in_1NuhUa2eZvKYlo2CWYVhyvD9",
"object": "invoice",
"account_country": "US",
"account_name": "Stripe.com",
"account_tax_ids": null,
"amount_due": 998,
"amount_paid": 0,
"amount_remaining": 998,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1695758664,
"currency": "usd",
"custom_fields": null,
"customer": "cus_9s6XKzkNRiz8i3",
"customer_address": null,
"customer_email": "test@test.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"effective_at": null,
"ending_balance": null,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": null,
"invoice_pdf": null,
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"object": "list",
"data": [
{
"id": "il_1NuhUa2eZvKYlo2CC98Fg3Bo",
"object": "line_item",
"amount": 799,
"amount_excluding_tax": 799,
"currency": "usd",
"description": "test description",
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1NuhUa2eZvKYlo2CGeF7Qgx0",
"livemode": false,
"metadata": {},
"period": {
"end": 1695758664,
"start": 1695758664
},
"price": {
"id": "price_1NuhLA2eZvKYlo2Cq1tIGEBp",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1695758080,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_Oi7aO1GPi1dWX7",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 799,
"unit_amount_decimal": "799"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "799"
},
{
"id": "il_1NuLVe2eZvKYlo2Canh35EfU",
"object": "line_item",
"amount": 199,
"amount_excluding_tax": 199,
"currency": "usd",
"description": "Canned Coffee",
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1NuLVd2eZvKYlo2CRWY0Hqgi",
"livemode": false,
"metadata": {},
"period": {
"end": 1695674161,
"start": 1695674161
},
"price": {
"id": "price_1NuI212eZvKYlo2CWgdD8kET",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1695660793,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_OhhQNWDYdIbXYv",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 199,
"unit_amount_decimal": "199"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "199"
}
],
"has_more": false,
"url": "/v1/invoices/upcoming/lines?customer=cus_9s6XKzkNRiz8i3"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1688482163,
"period_start": 1688395763,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"redaction": null,
"rendering": null,
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subscription_details": {
"metadata": null
},
"subtotal": 998,
"subtotal_excluding_tax": 998,
"tax": null,
"test_clock": null,
"total": 998,
"total_discount_amounts": [],
"total_excluding_tax": 998,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}
Finalize an invoice
Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.
Parameters
- auto_
advanceboolean Controls whether Stripe performs automatic collection of the invoice. If
false
, the invoice’s state doesn’t automatically advance without an explicit action.
Returns
Returns an invoice object with status=open
.
{
"id": "in_1MtGmCLkdIwHu7ix6PgS6g8S",
"object": "invoice",
"account_country": "US",
"account_name": "Stripe Docs",
"account_tax_ids": null,
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"liability": null,
"status": null
},
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1680641304,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NeZw0zvTyquTfF",
"customer_address": null,
"customer_email": "jennyrosen@example.com",
"customer_name": "Jenny Rosen",
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": 1681246104,
"ending_balance": 0,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_1M2JTkLkdIwHu7ix/test_YWNjdF8xTTJKVGtMa2RJd0h1N2l4LF9OZVp3dVBYNnF0dGlvdXRubGVjSXVOOWhiVWpmUktPLDcxMTgyMTA10200x7P2wMSm?s=ap",
"invoice_pdf": "https://pay.stripe.com/invoice/acct_1M2JTkLkdIwHu7ix/test_YWNjdF8xTTJKVGtMa2RJd0h1N2l4LF9OZVp3dVBYNnF0dGlvdXRubGVjSXVOOWhiVWpmUktPLDcxMTgyMTA10200x7P2wMSm/pdf?s=ap",
"issuer": {
"type": "self"
},
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"object": "list",
"data": [],
"has_more": false,
"total_count": 0,
"url": "/v1/invoices/in_1MtGmCLkdIwHu7ix6PgS6g8S/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "9545A614-0001",
"on_behalf_of": null,
"paid": true,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1680641304,
"period_start": 1680641304,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "paid",
"status_transitions": {
"finalized_at": 1680641304,
"marked_uncollectible_at": null,
"paid_at": 1680641304,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"subtotal_excluding_tax": 0,
"tax": null,
"test_clock": null,
"total": 0,
"total_discount_amounts": [],
"total_excluding_tax": 0,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": 1680641304
}