Skip to content

Commit 069e715

Browse files
authored
Merge pull request #700 from reshmabidikar/work-for-ts-298
document additional invoice template fields
2 parents 2aea09c + dc71262 commit 069e715

1 file changed

Lines changed: 202 additions & 0 deletions

File tree

userguide/tutorials/invoice_templates.adoc

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,208 @@ curl -v \
495495
http://127.0.0.1:8080/1.0/kb/tenants/userKeyValue/LOGO_INFO
496496
----
497497

498+
== Invoice Template Fields Reference
499+
500+
In addition to the `company`, `logo`, `brand`, and `text` (translation) fields covered above, you can use some additional fields in the template. This section lists those fields.
501+
502+
=== Invoice Fields
503+
504+
These fields are accessed under the `invoice.` namespace, e.g. `{{invoice.chargedAmount}}`.
505+
506+
For example, to use the `chargedAmount` field in the template, you can use the following snippet:
507+
508+
[source,html]
509+
----
510+
Invoice Amount Charged: #{{invoice.chargedAmount}}
511+
----
512+
513+
The table below lists all the available invoice fields.
514+
515+
[cols="1,3", options="header"]
516+
|===
517+
| Field | Description
518+
519+
| `invoiceNumber`| The invoice number
520+
521+
| `invoiceItems`| The list of invoice items on this invoice (see <<Invoice Item Fields>> below). Iterate with `{{#invoice.invoiceItems}}...{{/invoice.invoiceItems}}`.
522+
523+
| `trackingIds`| Tracking IDs associated with the invoice
524+
525+
| `chargedAmount`| Total charged amount on the invoice
526+
527+
| `originalChargedAmount`| Charged amount before any adjustments
528+
529+
| `balance`| Remaining balance on the invoice
530+
531+
| `formattedChargedAmount`| Charged amount, formatted per the account locale and invoice currency
532+
533+
| `formattedPaidAmount`| Paid amount, formatted per the account locale and invoice currency
534+
535+
| `formattedBalance`| Balance, formatted per the account locale and invoice currency
536+
537+
| `processedCurrency`| Currency the payment was processed in, if different from the invoice currency; `null` otherwise
538+
539+
| `processedPaymentRate`| Conversion rate used, if the payment was processed in a different currency; `null` otherwise
540+
541+
| `migrationInvoice`| Whether this is a migration invoice
542+
543+
| `invoiceDate`| Invoice date
544+
545+
| `targetDate`| Target date used to generate the invoice
546+
547+
| `currency`| Invoice currency
548+
549+
| `paidAmount`| Amount paid against this invoice
550+
551+
| `formattedInvoiceDate`| Invoice date, formatted per the account locale
552+
553+
| `id`| Invoice ID
554+
555+
| `createdDate`| Invoice creation timestamp
556+
557+
| `updatedDate`| Invoice last-updated timestamp
558+
559+
| `status`| Invoice status
560+
561+
| `parentInvoice`| Whether this is a parent invoice
562+
563+
| `parentAccountId`| Parent account ID, for child invoices
564+
565+
| `parentInvoiceId`| Parent invoice ID, for child invoices
566+
567+
| `groupId`| Group ID associated with the invoice, if any
568+
569+
| `creditedAmount`| Amount credited against this invoice
570+
571+
| `refundedAmount`| Amount refunded against this invoice
572+
|===
573+
574+
575+
=== Invoice Item Fields
576+
577+
These fields are accessible within an `{{#invoice.invoiceItems}}...{{/invoice.invoiceItems}}` block. For example to use the invoice item `prettyPlanName` and `formattedAmount` fields, you can use the following snippet:
578+
579+
[source,html]
580+
----
581+
{{#invoice.invoiceItems}}
582+
{{prettyPlanName}}: {{formattedAmount}}
583+
{{/invoice.invoiceItems}}
584+
----
585+
586+
The table below lists all the available invoice item fields.
587+
588+
[cols="1,3", options="header"]
589+
|===
590+
| Field | Description
591+
592+
| `amount`| Item amount
593+
594+
| `currency`| Item currency
595+
596+
| `formattedAmount`| Item amount, formatted per the account locale and invoice currency
597+
598+
| `invoiceItemType`| Item type (e.g. recurring, fixed, usage, tax, credit)
599+
600+
| `description`| Item description (translated, if a matching resource bundle entry exists)
601+
602+
| `startDate`| Item service period start date
603+
604+
| `endDate`| Item service period end date
605+
606+
| `formattedStartDate`| Start date, formatted per the account locale
607+
608+
| `formattedEndDate`| End date, formatted per the account locale
609+
610+
| `invoiceId`| ID of the invoice this item belongs to
611+
612+
| `accountId`| Account ID
613+
614+
| `childAccountId`| Child account ID, for items billed to a child account
615+
616+
| `bundleId`| Bundle ID associated with the item
617+
618+
| `subscriptionId`| Subscription ID associated with the item
619+
620+
| `productName`| Product name (translated)
621+
622+
| `prettyProductName`| Human-readable product name (translated)
623+
624+
| `planName`| Plan name (translated)
625+
626+
| `prettyPlanName`| Human-readable plan name (translated)
627+
628+
| `phaseName`| Phase name (translated)
629+
630+
| `prettyPhaseName`| Human-readable phase name (translated)
631+
632+
| `usageName`| Usage unit name (translated)
633+
634+
| `prettyUsageName`| Human-readable usage unit name (translated)
635+
636+
| `id`| Item ID
637+
638+
| `createdDate`| Item creation timestamp
639+
640+
| `updatedDate`| Item last-updated timestamp
641+
642+
| `quantity`| Item quantity
643+
644+
| `itemDetails`| Free-form item details, if set
645+
646+
| `catalogEffectiveDate`| Catalog effective date used to price this item
647+
|===
648+
649+
=== Account Fields
650+
651+
These fields are accessed under the account. namespace, e.g. {{account.name}}, and come directly from the account object (rather than a formatter wrapper) — so, unlike the invoice and invoice item fields above, there are no formatted*/pretty* convenience variants.
652+
653+
[cols="1,3", options="header"]
654+
|===
655+
| Field | Description
656+
657+
| externalKey| The account's external key
658+
659+
| name| The account name (first and last name combined, where applicable)
660+
661+
| firstNameLength| The length of the first name that can be extracted from name
662+
663+
| email| The primary account email
664+
665+
| billCycleDayLocal| The bill cycle day for the account, interpreted in the account's timezone
666+
667+
| currency| The account's currency
668+
669+
| paymentMethodId| The ID of the account's current default payment method
670+
671+
| referenceTime| The reference time for the account
672+
673+
| timeZone| The account's timezone
674+
675+
| locale| The account's locale
676+
677+
| address1| Address line 1
678+
679+
| address2| Address line 2
680+
681+
| companyName| The company name for the account
682+
683+
| city| City
684+
685+
| stateOrProvince| State or province
686+
687+
| postalCode| Postal code
688+
689+
| country| Country
690+
691+
| phone| Phone number
692+
693+
| migrated| Whether the account was migrated into the system
694+
695+
| parentAccountId| The ID of the parent account, if any
696+
697+
| paymentDelegatedToParent| Whether the child account's payments are delegated to the parent account
698+
|===
699+
498700
== Testing Your Changes
499701

500702
No matter how you configure your template, translations, or branding, you'll want to confirm the changes render as expected before using them in production.

0 commit comments

Comments
 (0)