Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > Invoice

Collect all unpaid invoices

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Body parameters

payment_intent_idstringRequired

Returns

Returns an array of resource objects of type invoice

Examples

import { buildClient } from "@datocms/dashboard-client";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const perSitePricingBillingProfileId = "124";
const invoices =
await client.invoices.perSitePricingBillingProfileCollectUnpaid(
perSitePricingBillingProfileId,
{ payment_intent_id: "" },
);
for (const invoice of invoices) {
// Check the 'Returned output' tab for the result ☝️
console.log(invoice);
}
}
run();
{
id: "124",
date: "2020-04-21T07:57:11.124Z",
total: 20,
amount_due: 20,
status: "",
last_failed_transaction: {},
billing_profile: { type: "per_site_pricing_billing_profile", id: "124" },
}