Upsert an invoice

Creates or updates (upserts) an invoice with a specified ID.

SecurityAPI Key: SecretApiKey or HTTP: JWT
Request
path Parameters
id
required
string <= 50 characters ^[@~\-\.\w]+$

ID of the resource.

Request Body schema: application/json

Invoice resource.

websiteId
required
string (WebsiteId) <= 50 characters
currency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

object (Shipping)

Shipping settings.

object (Taxes)

Taxes.

object or null

Organization tax ID number that is displayed on the invoice.

object or null

Customer tax ID number that is displayed on the invoice.

object (ContactObject)

Contact's information.

object (ContactObject)

Contact's information.

poNumber
string or null <= 50 characters

Purchase order number that is displayed on the invoice.

notes
string <= 65535 characters

Notes for the customer that are displayed on the invoice.

autopayScheduledTime
string or null <date-time>

Date and time when an automatic payment (autopay) is scheduled.

dueTime
string <date-time>

Date and time when the invoice is due for payment.

customerId
required
string <= 50 characters

ID of the customer resource.

object or null

Invoice payment retry instruction. This object specifies how to proceed if a payment related to the invoice fails.

delinquencyTime
string or null <date-time>
Default: null

Date and time when the related order is considered delinquent, and is canceled. If this value is null, no delinquency time is configured. If the dueTime of the order becomes greater than the delinquencyTime value, the delinquencyTime value becomes equal to dueTime.

If an invoice is not related to an order, this field can only be null.

put
/invoices/{id}
Request samples
application/json
{ "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "currency": "USD", "shipping": { "amount": 0.1, "calculator": "manual" }, "tax": { "calculator": "manual", }, "organizationTaxIdNumber": { "type": "eu-vat", "value": "GB980780684" }, "customerTaxIdNumber": { "type": "eu-vat", "value": "GB980780684" }, "billingAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO" }, "deliveryAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO" }, "poNumber": "PO123456", "notes": "string", "autopayScheduledTime": "2019-08-24T14:15:22Z", "dueTime": "2019-08-24T14:15:22Z", "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF", "retryInstruction": { }, "delinquencyTime": null }
Responses

200

Invoice updated.

Response Schema: application/json
id
string <= 50 characters

ID of the invoice.

websiteId
required
string (WebsiteId) <= 50 characters
invoiceNumber
integer

Auto-incrementing number based on the sequence of invoices for any particular customer.

orderId
string or null

ID of the order.

subscriptionId
string <= 50 characters

ID of the related subscription order, if available. This field is null if there are no related subscription orders.

quoteId
string or null <= 50 characters

ID of the related quote, if available. This field is null if there are no related quotes.

currency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

amount
number <double>

Amount of the invoice.

amountDue
number <double>

Amount that is due on the invoice.

subtotalAmount
number <double>

Subtotal amount of the invoice.

discountAmount
number <double>

Discount amount that is applied to the invoice.

object (Shipping)

Shipping settings.

object (Taxes)

Taxes.

object or null

Organization tax ID number that is displayed on the invoice.

object or null

Customer tax ID number that is displayed on the invoice.

object (ContactObject)

Contact's information.

object (ContactObject)

Contact's information.

poNumber
string or null <= 50 characters

Purchase order number that is displayed on the invoice.

notes
string <= 65535 characters

Notes for the customer that are displayed on the invoice.

Array of objects (InvoiceItem)

Invoice items array.

Array of objects

Discounts applied.

autopayScheduledTime
string or null <date-time>

Date and time when an automatic payment (autopay) is scheduled.

autopayRetryNumber
integer >= 0
Default: 0

Number of times that an automatic payment (autopay) has been attempted on an invoice.

status
string

Status of the invoice.

Enum: "draft" "quotation" "unpaid" "paid" "partially-paid" "past-due" "abandoned" "voided" "partially-refunded" "refunded" "disputed"
delinquentCollectionPeriod
integer

Length of time, in days, between when the invoice is due and when the invoice is paid.

collectionPeriod
integer

Length of time, in days, between when the invoice is issued and when the invoice is paid.

abandonedTime
string or null <date-time>

Date and time when the invoice is abandoned.

voidedTime
string or null <date-time>

Date and time when the invoice is voided.

paidTime
string or null <date-time>

Date and time when the invoice is paid.

dueTime
string <date-time>

Date and time when the invoice is due for payment.

issuedTime
string <date-time> (ServerTimestamp)

Read-only timestamp in ISO 8601 date-time format.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

paymentFormUrl
string or null <url>

URL where the customer is redirected to pay the invoice using one of the methods which are available to the customer. This is an alternative to creating a new transaction with empty methods.

customerId
required
string <= 50 characters

ID of the customer resource.

Array of objects (Transaction) <= 10 items

Invoice transactions array.

object or null

Invoice payment retry instruction. This object specifies how to proceed if a payment related to the invoice fails.

revision
integer

Number of times the invoice data has been modified.

Use the revision number when analyzing webhook data to determine if a change should take precedence over the current representation.

type
string

Type of invoice.

Enum: "initial" "renewal" "interim" "cancellation" "one-time" "refund" "charge" "one-time-sale"
dueReminderTime
string or null <date-time>

Date and time when a past due reminder event is triggered.

dueReminderNumber
integer or null

Number of past due reminder events that have been triggered.

organizationId
string <= 50 characters

Unique organization identifier. An organization is an entity that represents a company. For more information, see Obtain an organization ID.

delinquencyTime
string or null <date-time>
Default: null

Date and time when the related order is considered delinquent, and is canceled. If this value is null, no delinquency time is configured. If the dueTime of the order becomes greater than the delinquencyTime value, the delinquencyTime value becomes equal to dueTime.

If an invoice is not related to an order, this field can only be null.

Array of objects

Related links.

object

Embedded objects that are requested by the expand query parameter.

201

Invoice created.

401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

404

Resource not found.

422

Invalid data sent.

Response samples
application/json
{ "id": "in_0YVF9605RKC62BP14NE2R7V2XT", "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "invoiceNumber": 0, "orderId": "ord_01GYJPRKHBD6ZYHH897QCJMBS4", "subscriptionId": "ord_01GYJPRKHBD6ZYHH897QCJMBS4", "quoteId": "qt_0YV7DES3WPC5J8JD8QTVNZBZNZ", "currency": "USD", "amount": 0.1, "amountDue": 0.1, "subtotalAmount": 0.1, "discountAmount": 0.1, "shipping": { "amount": 0.1, "calculator": "manual" }, "tax": { "calculator": "manual", "amount": 0, }, "organizationTaxIdNumber": { "type": "eu-vat", "value": "GB980780684" }, "customerTaxIdNumber": { "type": "eu-vat", "value": "GB980780684" }, "billingAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "deliveryAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "poNumber": "PO123456", "notes": "string", "items": [ ], "discounts": [ ], "autopayScheduledTime": "2019-08-24T14:15:22Z", "autopayRetryNumber": 0, "status": "draft", "delinquentCollectionPeriod": 0, "collectionPeriod": 0, "abandonedTime": "2019-08-24T14:15:22Z", "voidedTime": "2019-08-24T14:15:22Z", "paidTime": "2019-08-24T14:15:22Z", "dueTime": "2019-08-24T14:15:22Z", "issuedTime": "2019-08-24T14:15:22Z", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "paymentFormUrl": "string", "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF", "transactions": [ ], "retryInstruction": { }, "revision": 0, "type": "initial", "dueReminderTime": "2019-08-24T14:15:22Z", "dueReminderNumber": 0, "organizationId": "org_0YVDM8RC7GDADADSBSMW124JA8", "delinquencyTime": null, "_links": [ ], "_embedded": { "customer": { }, "website": { }, "organization": { }, "leadSource": { }, "shippingRate": { } } }