Update Draft Ad Hoc Invoice
Updates an ad hoc invoice while it is in the draft state.
Important: only invoices with the adhoc role and draft status can be updated. Any other invoice — issued, or with a different role (e.g. renewal, signup) — cannot be updated through this endpoint and the request returns a 422 error. If the invoice does not belong to the provided subscription, a 404 error is returned.
Only the attributes submitted in the request are changed — omitted attributes keep their current values.
Line Items
The line_items array describes changes to the invoice's line items. Line items not referenced in the array remain unchanged.
Adding a line item
A line item without a uid is added to the invoice. The same line item types and options as on invoice creation are supported (custom items, product_id, component_id, price points, period date ranges, taxes).
Updating a line item
A line item with the uid of an existing line item updates that line item with the submitted attributes. Amounts and taxes are recalculated.
Removing a line item
A line item with a uid and "_destroy": true is removed from the invoice. Other line items remain unchanged.
Referencing a uid which does not exist on the invoice returns a 422 error.
Coupons
When the coupons key is present, the submitted coupons replace all discounts currently applied to the invoice. Send an empty array to remove all discounts. Coupon options are the same as on invoice creation.
Invoice Options
Issue Date and Net Terms
The issue_date parameter can be sent to change the invoice's issue date. Only today or dates in the past are accepted. The date is interpreted and validated in your site's time zone, using the YYYY-MM-DD format. The net_terms parameter indicates the number of days after the issue date on which the invoice is due. The due date is recalculated whenever the issue date or net terms change.
Addresses
The seller, shipping and billing addresses can be sent to replace the addresses on the invoice. Each address requires to send a first_name at a minimum in order to work. Taxes are recalculated after an address change.
Memo and Payment Instructions
A custom memo can be sent with the memo parameter. Likewise, custom payment instructions can be sent with the payment_instructions parameter.
Authorization
BasicAuth The username is a Maxio Chargify API key. The password is x.
In: header
Path Parameters
The Chargify id of the subscription.
The unique identifier for the invoice, this does not refer to the public facing invoice number.
Request Body
application/json
Request payload for updating a draft ad hoc invoice.
Attributes of a draft ad hoc invoice which can be updated. Only the submitted attributes are changed.
Response Body
application/json
application/json
application/json
curl -X PUT "https://example.com/subscriptions/0/invoices/string.json" \ -H "Content-Type: application/json" \ -d '{ "invoice": { "memo": "Updated memo", "net_terms": 30 } }'{ "invoice": { "id": 0, "uid": "string", "site_id": 0, "customer_id": 0, "subscription_id": 0, "number": "string", "sequence_number": 0, "transaction_time": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "issue_date": "2019-08-24", "due_date": "2019-08-24", "paid_date": "2019-08-24", "status": "draft", "role": "unset", "parent_invoice_id": 0, "collection_method": "automatic", "payment_instructions": "string", "currency": "string", "consolidation_level": "none", "parent_invoice_uid": null, "subscription_group_id": 0, "parent_invoice_number": null, "group_primary_subscription_id": null, "product_name": "string", "product_family_name": "string", "seller": { "name": "string", "address": { "street": null, "line2": null, "city": null, "state": null, "zip": null, "country": null }, "phone": "string", "logo_url": "string" }, "customer": { "chargify_id": 0, "first_name": "string", "last_name": "string", "organization": null, "email": "string", "vat_number": "string", "reference": "string" }, "payer": { "chargify_id": 0, "first_name": "string", "last_name": "string", "organization": null, "email": "string", "vat_number": "string" }, "recipient_emails": [ "string" ], "net_terms": 0, "memo": "string", "billing_address": { "street": null, "line2": null, "city": null, "state": null, "zip": null, "country": null }, "shipping_address": { "street": null, "line2": null, "city": null, "state": null, "zip": null, "country": null }, "subtotal_amount": "string", "discount_amount": "string", "tax_amount": "string", "total_amount": "string", "credit_amount": "string", "debit_amount": "string", "refund_amount": "string", "paid_amount": "string", "due_amount": "string", "line_items": [ { "uid": "string", "title": "string", "description": "string", "quantity": "string", "unit_price": "string", "subtotal_amount": "string", "discount_amount": "string", "tax_amount": "string", "tax_included": true, "total_amount": "string", "tiered_unit_price": true, "period_range_start": "2019-08-24", "period_range_end": "2019-08-24", "transaction_id": 0, "product_id": 0, "product_version": 0, "component_id": 0, "price_point_id": 0, "billing_schedule_item_id": 0, "hide": true, "component_cost_data": null, "product_price_point_id": null, "custom_item": true, "kind": "string", "prepaid_allocation_expires_at": "2019-08-24" } ], "discounts": [ { "uid": "string", "title": "string", "description": "string", "code": "string", "source_type": "Coupon", "source_id": 0, "discount_type": "percentage", "percentage": "string", "eligible_amount": "string", "discount_amount": "string", "transaction_id": 0, "line_item_breakouts": [ { "uid": "string", "eligible_amount": "string", "discount_amount": "string" } ] } ], "taxes": [ { "uid": "string", "title": "string", "description": "string", "source_type": "Tax", "source_id": 0, "percentage": "string", "taxable_amount": "string", "tax_amount": "string", "transaction_id": 0, "line_item_breakouts": [ { "uid": "string", "taxable_amount": "string", "tax_amount": "string", "tax_exempt_amount": "string" } ], "tax_component_breakouts": [ { "tax_rule_id": 0, "percentage": "string", "country_code": "string", "subdivision_code": "string", "tax_amount": "string", "taxable_amount": "string", "tax_exempt_amount": "string", "non_taxable_amount": "string", "tax_name": "string", "tax_type": "string", "rate_type": "string", "tax_authority_type": 0, "state_assigned_no": "string", "tax_sub_type": "string" } ], "eu_vat": true, "type": "string", "tax_exempt_amount": "string" } ], "credits": [ { "uid": "string", "credit_note_number": "string", "credit_note_uid": "string", "transaction_time": "2019-08-24T14:15:22Z", "memo": "string", "original_amount": "string", "applied_amount": "string" } ], "debits": [ { "uid": "string", "debit_note_number": "string", "debit_note_uid": "string", "role": "chargeback", "transaction_time": "2019-08-24T14:15:22Z", "memo": "string", "original_amount": "string", "applied_amount": "string" } ], "refunds": [ { "transaction_id": 0, "payment_id": 0, "memo": "string", "original_amount": "string", "applied_amount": "string", "gateway_transaction_id": "string", "gateway_used": "string", "gateway_handle": "string", "ach_late_reject": true } ], "payments": [ { "transaction_time": "2019-08-24T14:15:22Z", "memo": "string", "original_amount": "string", "applied_amount": "string", "payment_method": { "details": "string", "kind": "string", "memo": "string", "type": "string", "card_brand": "string", "card_expiration": "string", "last_four": "string", "masked_card_number": "string" }, "transaction_id": 0, "prepayment": true, "gateway_handle": "string", "gateway_used": "string", "gateway_transaction_id": "string", "received_on": "2019-08-24", "uid": "string" } ], "custom_fields": [ { "owner_id": 0, "owner_type": "Customer", "name": "string", "value": "string", "metadatum_id": 0 } ], "display_settings": { "hide_zero_subtotal_lines": true, "include_discounts_on_lines": true }, "avatax_details": { "id": 0, "status": "string", "document_code": "string", "commit_date": "2019-08-24T14:15:22Z", "modify_date": "2019-08-24T14:15:22Z" }, "public_url": "string", "previous_balance_data": { "captured_at": "2019-08-24T14:15:22Z", "invoices": [ { "uid": "string", "number": "string", "outstanding_amount": "string" } ] }, "public_url_expires_on": "2019-08-24", "branding_theme_id": 0 }}Delete Draft Ad Hoc Invoice DELETE
Deletes an ad hoc invoice while it is in the `draft` state. **Important: only invoices with the `adhoc` role and `draft` status can be deleted.** Any other invoice — issued, or with a different role (e.g. `renewal`, `signup`) — cannot be deleted through this endpoint and the request returns a `422` error. Issued invoices should be voided instead. If the invoice does not belong to the provided subscription, a `404` error is returned. A successful deletion returns a `204 No Content` response and the invoice is permanently removed.
Send Invoice POST
Sends an invoice to the customer via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. **File Attachments**: You can attach files to invoice emails using `attachment_urls[]` parameter by providing URLs to the files you want to attach. When using attachments, the request must use `multipart/form-data` content type. Max 10 files, 10MB per file. If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned.