Skip to main content

invoices

Creates, updates, deletes, gets or lists an invoices resource.

Overview

Nameinvoices
TypeResource
Idvercel.marketplace.invoices

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
external_idstringPartner-supplied Invoice ID, if applicable. (wire: externalId)
invoice_idstringVercel Marketplace Invoice ID. (wire: invoiceId)
createdstringSystem creation date. ISO 8601 timestamp.
discountsarrayInvoice discounts.
invoice_datestringInvoice date. ISO 8601 timestamp. (wire: invoiceDate)
invoice_numberstringUser-readable invoice number. (wire: invoiceNumber)
itemsarrayInvoice items.
memostringAdditional memo for the invoice.
paid_atstringMoment the invoice was paid. ISO 8601 timestamp. (wire: paidAt)
periodobjectSubscription period for this billing cycle. ISO 8601 timestamps.
refund_reasonstringThe reason for refund. Only applicable for states "refunded" or "refund_request". (wire: refundReason)
refund_totalstringRefund amount. Only applicable for states "refunded" or "refund_request". A dollar-based decimal string. (wire: refundTotal)
refunded_atstringMost recent moment the invoice was refunded. ISO 8601 timestamp. (wire: refundedAt)
statestringInvoice state. (draft, invoiced, notpaid, overdue, paid, pending, refund_requested, refunded, scheduled)
testbooleanWhether the invoice is in the testmode (no real transaction created). (false, true)
totalstringInvoice total amount. A dollar-based decimal string.
updatedstringSystem update date. ISO 8601 timestamp.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectintegration_configuration_id, invoice_idGet Invoice details and status for a given invoice ID.<br /> <br /> See [Billing Events with Webhooks documentation](https:​//vercel.com/docs/integrations/create-integration/marketplace-api#working-with-billing-events-through-webhooks) on how to receive invoice events. This endpoint is used to retrieve the invoice details.
createinsertintegration_configuration_id, invoice_date, period, itemsThis endpoint allows the partner to submit an invoice to Vercel. The invoice is created in Vercel's billing system and sent to the customer. Depending on the type of billing plan, the invoice can be sent at a time of signup, at the start of the billing period, or at the end of the billing period.<br /> <br /> Use the credentials.access_token we provided in the [Upsert Installation](#upsert-installation) body to authorize this request. <br /> There are several limitations to the invoice submission:<br /> <br /> 1. A resource can only be billed once per the billing period and the billing plan.<br /> 2. The billing plan used to bill the resource must have been active for this resource during the billing period.<br /> 3. The billing plan used must be a subscription plan.<br /> 4. The interim usage data must be sent hourly for all types of subscriptions. See [Send subscription billing and usage data](#send-subscription-billing-and-usage-data) API on how to send interim billing and usage data.<br /> 5. If provided, externalId must be unique for the installation.<br />
updateexecintegration_configuration_id, invoice_id, action, reason, totalThis endpoint allows the partner to request a refund for an invoice to Vercel. The invoice is created using the [Submit Invoice API](#submit-invoice-api).

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
integration_configuration_idstring
invoice_idstring

SELECT examples

Get Invoice details and status for a given invoice ID.<br /> <br /> See [Billing Events with Webhooks documentation](https:​//vercel.com/docs/integrations/create-integration/marketplace-api#working-with-billing-events-through-webhooks) on how to receive invoice events. This endpoint is used to retrieve the invoice details.

SELECT
external_id,
invoice_id,
created,
discounts,
invoice_date,
invoice_number,
items,
memo,
paid_at,
period,
refund_reason,
refund_total,
refunded_at,
state,
test,
total,
updated
FROM vercel.marketplace.invoices
WHERE integration_configuration_id = '{{ integration_configuration_id }}' -- required
AND invoice_id = '{{ invoice_id }}' -- required
;

INSERT examples

This endpoint allows the partner to submit an invoice to Vercel. The invoice is created in Vercel's billing system and sent to the customer. Depending on the type of billing plan, the invoice can be sent at a time of signup, at the start of the billing period, or at the end of the billing period.<br /> <br /> Use the credentials.access_token we provided in the [Upsert Installation](#upsert-installation) body to authorize this request. <br /> There are several limitations to the invoice submission:<br /> <br /> 1. A resource can only be billed once per the billing period and the billing plan.<br /> 2. The billing plan used to bill the resource must have been active for this resource during the billing period.<br /> 3. The billing plan used must be a subscription plan.<br /> 4. The interim usage data must be sent hourly for all types of subscriptions. See [Send subscription billing and usage data](#send-subscription-billing-and-usage-data) API on how to send interim billing and usage data.<br /> 5. If provided, externalId must be unique for the installation.<br />

INSERT INTO vercel.marketplace.invoices (
external_id,
invoice_date,
memo,
period,
items,
discounts,
final,
test,
integration_configuration_id
)
SELECT
'{{ external_id }}',
'{{ invoice_date }}' /* required */,
'{{ memo }}',
'{{ period }}' /* required */,
'{{ items }}' /* required */,
'{{ discounts }}',
{{ final }},
'{{ test }}',
'{{ integration_configuration_id }}'
RETURNING
invoice_id,
test,
validation_errors
;

Lifecycle Methods

EXEC variables use wire (API) names.

This endpoint allows the partner to request a refund for an invoice to Vercel. The invoice is created using the Submit Invoice API.

EXEC vercel.marketplace.invoices.update
@integration_configuration_id='{{ integration_configuration_id }}' --required,
@invoice_id='{{ invoice_id }}' --required
@@json=
'{
"action": "{{ action }}",
"reason": "{{ reason }}",
"total": "{{ total }}"
}'
;