Skip to main content
POST
/
invoices
Create a custom invoice for an account
curl --request POST \
  --url https://api.togai.com/invoices \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "accountId": "ACC001",
  "invoiceDate": "2020-07-04T12:00:00.000Z",
  "idempotencyKey": "1234567890",
  "status": "DRAFT",
  "lineItems": [
    {
      "description": "Payout IMPS",
      "type": "CUSTOM_AMOUNT",
      "valuePerQuantity": 0.001,
      "quantity": 32109,
      "units": "USD"
    }
  ]
}
'
{
  "id": "inv.hkgkgyh.ghg",
  "sequenceId": "2020-07-2958",
  "customerId": "7VcRw9xZDIqsC5E",
  "accountId": "ACC001",
  "usageInfo": [
    {
      "description": "rides - local",
      "type": "USAGE_METER_USAGE",
      "value": 15,
      "units": "USAGE_UNITS"
    },
    {
      "description": "rides - pro",
      "type": "USAGE_METER_USAGE",
      "value": 5,
      "units": "USAGE_UNITS"
    }
  ],
  "revenueInfo": {
    "description": "Total amount due",
    "type": "NET_REVENUE",
    "units": "USD",
    "value": 881.94,
    "lineItems": [
      {
        "description": "Sum Total",
        "type": "GROSS_REVENUE",
        "units": "USD",
        "value": 981.94,
        "lineItems": [
          {
            "description": "Payout_NEFT",
            "type": "USAGE_RATE_CARD_REVENUE",
            "units": "USD",
            "value": 392.1,
            "lineItems": [
              {
                "description": "Slab 1",
                "type": "USAGE_RATE_CARD_SLAB_REVENUE",
                "valuePerQuantity": 0.001,
                "quantity": 10000,
                "units": "USD",
                "value": 10
              },
              {
                "description": "Slab 2",
                "type": "USAGE_RATE_CARD_SLAB_REVENUE",
                "valuePerQuantity": 0.001,
                "quantity": 10000,
                "units": "USD",
                "value": 10
              }
            ]
          },
          {
            "description": "Payout IMPS",
            "type": "USAGE_RATE_CARD_REVENUE",
            "valuePerQuantity": 0.001,
            "quantity": 32109,
            "units": "USD",
            "value": 589.94,
            "lineItems": [
              {
                "description": "Slab 1",
                "type": "USAGE_RATE_CARD_SLAB_REVENUE",
                "valuePerQuantity": 0.001,
                "quantity": 10000,
                "units": "USD",
                "value": 10
              },
              {
                "description": "Slab 2",
                "type": "USAGE_RATE_CARD_SLAB_REVENUE",
                "valuePerQuantity": 0.001,
                "quantity": 10000,
                "units": "USD",
                "value": 10
              }
            ]
          }
        ]
      }
    ]
  },
  "invoiceDetails": {
    "customer": {
      "name": "John Doe",
      "primaryEmail": "john@togai.com",
      "billingAddress": {
        "line1": "2281 Broadway Street",
        "line2": "G-31",
        "postalCode": "29501",
        "city": "Florence",
        "state": "South Carolina",
        "country": "US"
      }
    },
    "account": {
      "name": "Togai",
      "invoiceCurrency": "USD"
    },
    "pricePlanName": "Togai Basic"
  },
  "status": "DUE",
  "startDate": "2020-07-04T12:00:00.000Z",
  "endDate": "2020-07-04T12:00:00.000Z",
  "invoiceDate": "2020-07-04T12:00:00.000Z",
  "generatedAt": "2020-07-04T12:00:00.000Z",
  "updatedAt": "2020-07-04T12:00:00.000Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Payload to create invoice

Payload to create invoice

accountId
string
required
Example:

"ACC001"

invoiceTime
string<date-time>
required
Example:

"2020-07-04T12:00:00.000Z"

status
enum<string>
required

Status to create an invoice in.

Available options:
DRAFT,
DUE,
PAID
Example:

"DUE"

lineItems
object[]
required
Required array length: 1 - 50 elements
idempotencyKey
string
Example:

"1234567890"

Response

Response for Get invoice requests

Structure of invoice

id
string
required

Identifier of invoice

Maximum string length: 50
status
enum<string>
required

Status of the invoice

Available options:
DRAFT,
DUE,
PAID,
VOID,
UN_COLLECTIBLE,
INITIATE_REFUND,
REFUND_COMPLETED,
MERGED,
PARTIALLY_PAID
Example:

"DUE"

invoiceClass
enum<string>
required

Represents the class of entity( INVOICE/ORDER/BILLABLE)

Available options:
INVOICE,
ORDER,
BILLABLE
Example:

"INVOICE"

invoiceType
enum<string>
required

Represents the type of entity(STANDARD/AD_HOC/COMPOSITE)

Available options:
STANDARD,
AD_HOC,
COMPOSITE
Example:

"STANDARD"

invoiceDate
string<date-time>
required

Invoice date of the invoice

Example:

"2020-07-04T12:00:00.000Z"

updatedAt
string<date-time>
required
customerId
string
ownerId
string
pricePlanId
string
usageInfo
object[]
revenueInfo
object
invoiceDetails
object
startDate
string<date-time>

Start date of the invoice

Example:

"2020-07-04T12:00:00.000Z"

endDate
string<date-time>

End date of the invoice

Example:

"2020-07-04T12:00:00.000Z"

endDateInclusive
string<date-time>

Inclusive end date of the invoice

Example:

"2020-07-03T11:59:59.999Z"

dueDate
string<date-time>

Due date of the invoice

Example:

"2020-07-04T12:00:00.000Z"

generatedAt
string<date-time>
metadata
object
info
object[]
sequenceId
string

Sequence id of the invoice

pdfUrl
string

Download URL of the pdf file corresponding to the invoice