Skip to content

Latest commit

 

History

History
executable file
·
143 lines (96 loc) · 3.21 KB

README.md

File metadata and controls

executable file
·
143 lines (96 loc) · 3.21 KB

invoice

Overview

The Invoice resource represents an invoice that has been generated for a customer. Invoices are generated when a customer's billing interval has elapsed, and are updated when a customer's invoice is paid.

Available Operations

create

This creates a one-off fixed fee invoice line item on an Invoice. This can only be done for invoices that are in a draft status.

Example Usage

import orb
import dateutil.parser
from orb.models import shared

s = orb.Orb(
    security=shared.Security(
        api_key_auth="",
    ),
)

req = shared.NewInvoiceLineItem(
    amount='amet',
    end_date=dateutil.parser.parse('2021-03-29').date(),
    invoice_id='4khy3nwzktxv7',
    name='Darlene Effertz',
    quantity=47hhsws4z2i13,
    start_date=dateutil.parser.parse('2022-12-22').date(),
)

res = s.invoice.create(req)

if res.invoice_line_item is not None:
    # handle response

fetch

This endpoint is used to fetch an Invoice given an identifier.

Example Usage

import orb
from orb.models import operations

s = orb.Orb(
    security=shared.Security(
        api_key_auth="",
    ),
)


res = s.invoice.fetch('expedita')

if res.invoice is not None:
    # handle response

fetch_upcoming

This endpoint can be used to fetch the upcoming invoice for the current billing period given a subscription.

Example Usage

import orb
from orb.models import operations

s = orb.Orb(
    security=shared.Security(
        api_key_auth="",
    ),
)


res = s.invoice.fetch_upcoming('neque')

if res.upcoming_invoice is not None:
    # handle response

list

This endpoint returns a list of all Invoices for an account in a list format.

The list of invoices is ordered starting from the most recently issued invoice date. The response also includes pagination_metadata, which lets the caller retrieve the next page of results if they exist.

By default, this only returns invoices that are issued, paid, or synced.

Example Usage

import orb
from orb.models import operations

s = orb.Orb(
    security=shared.Security(
        api_key_auth="",
    ),
)


res = s.invoice.list('sed', 'vel', 'libero', 'voluptas')

if res.invoices is not None:
    # handle response

void

This endpoint allows an invoice's status to be set the void status. This can only be done to invoices that are in the issued status.

If the associated invoice has used the customer balance to change the amount due, the customer balance operation will be reverted. For example, if the invoice used $10 of customer balance, that amount will be added back to the customer balance upon voiding.

Example Usage

import orb
from orb.models import operations

s = orb.Orb(
    security=shared.Security(
        api_key_auth="",
    ),
)


res = s.invoice.void('deserunt')

if res.invoice is not None:
    # handle response