Skip to content

mv.partnerBilling

Partner accounts: usage per client organisation at wholesale and at your retail prices, and your wholesale invoices. These methods are on mv.partnerBilling, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.

List wholesale invoices. Your partner account’s issued wholesale invoices, newest period first, with each client organisation’s subtotal. Drafts (the month in progress) are not listed. Test keys get an empty list.

mv.partnerBilling.invoices.list(query?: NonNullable<PartnerBillingInvoicesListData["query"]>, options?: RequestOptions): PagedList<PartnerBillingInvoicesListResponse["data"][number], NonNullable<PartnerBillingInvoicesListData["query"]>>

GET /partner/invoices · API reference

Name Type Required Description
query.limit integer no How many objects to return, 1–100 (default 20).
query.starting_after string no A cursor (next_cursor) or object ID: return the objects after it (older).
query.ending_before string no A cursor or object ID: return the objects before it (newer).
query.status string no Only invoices in this status.
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

A PagedList: await it for the first page, for await it for every item.

import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const invoice of mv.partnerBilling.invoices.list()) {
console.log(invoice);
}

Retrieve a wholesale invoice. One issued wholesale invoice with its lines grouped per client organisation, then your programme fees.

mv.partnerBilling.invoices.retrieve(id: PartnerBillingInvoicesRetrieveData["path"]["id"], options?: RequestOptions): Promise<PartnerBillingInvoicesRetrieveResponse>

GET /partner/invoices/{id} · API reference

Name Type Required Description
id string yes A invoice ID (inv_…).
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

PartnerInvoice:

Field Type Description
id string A invoice ID (prefix inv_).
object "partner_invoice" Always partner_invoice.
livemode boolean true in live mode, false in test mode.
number string | null —
status "open" | "paid" | "failed" | "void" | "uncollectible" —
currency "ILS" | "USD" | "EUR" —
period_start string An ISO-8601 timestamp in UTC.
period_end string An ISO-8601 timestamp in UTC.
subtotal Money An amount of money in minor units.
tax Money An amount of money in minor units.
total Money An amount of money in minor units.
issued string | null —
due string | null —
paid string | null —
organizations object[] One group per client organisation billed on this invoice.
programme object | null Your programme fee, client organisations beyond those included, and the minimum-commitment true-up.
import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const partnerInvoice = await mv.partnerBilling.invoices.retrieve("inv_7Hk2Lm9Qp");
console.log(partnerInvoice);

Retrieve usage per client organization. Usage of each of your client organisations for a date range, and for your wholesale clients its price at wholesale (what you pay) and at your retail prices (what you charge). Closed months use their invoice’s figures; other months are estimates (provisional). Test keys get an empty report.

mv.partnerBilling.usage.retrieve(query?: NonNullable<PartnerBillingUsageRetrieveData["query"]>, options?: RequestOptions): Promise<PartnerBillingUsageRetrieveResponse>

GET /partner/usage · API reference

Name Type Required Description
query.from string no The first day (YYYY-MM-DD, your time zone). Default: the first day of the current month.
query.to string no The last day, inclusive (up to 400 days after from). Default: today.
query.group string no client (default): data has one row per client organisation; kind: one row per usage kind across your clients.
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

PartnerUsageReport:

Field Type Description
object "partner_usage_report" Always partner_usage_report.
livemode boolean true in live mode, false in test mode.
from string —
to string —
timezone string Your time zone: the days and months are its local calendar.
currency "ILS" | "USD" | "EUR" —
group "client" | "kind" —
provisional boolean Some amounts are estimates (a month not invoiced yet, or cut by the range). Closed months with an invoice use the invoice’s figures.
data object[] —
total object The whole range, wholesale clients; your programme fees are on your invoice, not here.
import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const partnerUsageReport = await mv.partnerBilling.usage.retrieve();
console.log(partnerUsageReport);