younifyd
Menu

Create Line Item

Create a new line item for the account

POST/accounts/{account_id}/line_items

Use it in a workflow

  1. Add a step and choose the Recurly connector.
  2. Pick the Create Line Item action (under line_item).
  3. Fill in the fields below, then reference the result from later steps as {{createLineItem.response.data}}.

Request

Path parameters

account_idstringrequired

Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`.

Request body

Enter the body as JSON in the step's Body field.

currencystringrequired

3-letter ISO 4217 currency code. If `item_code`/`item_id` is part of the request then `currency` is optional, if the site has a single default currency. `currency` is required if `item_code`/`item_id` is present, and there are multiple currencies defined on the site. If `item_code`/`item_id` is not present `currency` is required.

unit_amountnumber (float)required

A positive or negative amount with `type=charge` will result in a positive `unit_amount`. A positive or negative amount with `type=credit` will result in a negative `unit_amount`. If `item_code`/`item_id` is present, `unit_amount` can be passed in, to override the `Item`'s `unit_amount`. If `item_code`/`item_id` is not present then `unit_amount` is required.

tax_inclusiveboolean

Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag.

Default false

quantityinteger

This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes.

Default 1

descriptionstring

Description that appears on the invoice. If `item_code`/`item_id` is part of the request then `description` must be absent.

item_codestring

Unique code to identify an item. Available when the Credit Invoices feature is enabled.

item_idstring

System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled.

revenue_schedule_typestring

One ofat_invoiceat_range_endat_range_startevenlynever

typestringrequired

Line item type. If `item_code`/`item_id` is present then `type` should not be present. If `item_code`/`item_id` is not present then `type` is required.

One ofchargecredit

credit_reason_codestring

The reason the credit was given when line item is `type=credit`. When the Credit Invoices feature is enabled, the value can be set and will default to `general`. When the Credit Invoices feature is not enabled, the value will always be `null`.

One ofgeneralpromotionalserviceDefault "general"

accounting_codestring

Accounting Code for the `LineItem`. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent.

liability_gl_account_idstring

The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features.

revenue_gl_account_idstring

The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features.

performance_obligation_idstring

The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features.

tax_exemptboolean

`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature.

avalara_transaction_typeinteger

Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_transaction_type` must be absent.

avalara_service_typeinteger

Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_service_type` must be absent.

vertex_transaction_typestring

Used by Vertex for tax calculations. Possible values are sale, rental, lease.

One ofsalerentallease

tax_codestring

Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes.

harmonized_system_codestring

The Harmonized System (HS) code is an internationally standardized system of names and numbers to classify traded products. The HS code, sometimes called Commodity Code, is used by customs authorities around the world to identify products when assessing duties and taxes. The HS code may also be referred to as the tariff code or customs code. Values should contain only digits and decimals. If `item_code`/`item_id` is part of the request then `harmonized_system_code` must be absent.

product_codestring

Optional field to track a product code or SKU for the line item. This can be used to later reporting on product purchases. For Vertex tax calculations, this field will be used as the Vertex `product` field. If `item_code`/`item_id` is part of the request then `product_code` must be absent.

originstring

Origin `external_gift_card` is allowed if the Gift Cards feature is enabled on your site, `type` is `credit` and `tax_exempt` is `true` if you are using taxes. Set this value in order to track gift card credits from external gift cards (like InComm). It also skips billing information requirements. Origin `prepayment` is only allowed if `type` is `charge` and `tax_exempt` is left blank or set to true. This origin creates a charge and opposite credit on the account to be used for future invoices.

One ofexternal_gift_cardprepayment

custom_fieldsarray<object>

The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value.

namestringrequired

Fields must be created in the UI before values can be assigned to them.

valuestringrequired

Any values that resemble a credit card number or security code (CVV/CVC) will be rejected.

source_record_typestring

The type of record a custom field was automatically copied from.

One ofaccountplanproductsubscription

source_record_idstring

The UUID of the record this custom field was automatically copied from. Only present when the field was copied from another record.

start_datestring (date-time)

If an end date is present, this is value indicates the beginning of a billing time range. If no end date is present it indicates billing for a specific date. Defaults to the current date-time.

end_datestring (date-time)

If this date is provided, it indicates the end of a time range.

origin_tax_address_sourcestring

The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of "origin" refers to the "Business entity tax address". A value of "destination" refers to the "Customer tax address".

One oforigindestinationDefault "origin"

destination_tax_address_sourcestring

The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of "destination" refers to the "Customer tax address". A value of "origin" refers to the "Business entity tax address".

One ofdestinationoriginDefault "destination"

json
{
  "currency": "string",
  "unit_amount": 0,
  "type": "charge",
  "tax_inclusive": false,
  "quantity": 1,
  "description": "string",
  "item_code": "string",
  "item_id": "string",
  "revenue_schedule_type": "at_invoice",
  "credit_reason_code": "general",
  "accounting_code": "string",
  "liability_gl_account_id": "string"
}

Response

Returns 201 with an object. Read it in later steps with {{createLineItem.response.data.<field>}}.

idstring
objectstring
uuidstring

The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI.

typestring

Charges are positive line items that debit the account. Credits are negative line items that credit the account.

One ofchargecredit

item_codestring

Unique code to identify an item. Available when the Credit Invoices feature is enabled.

item_idstring

System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled.

external_skustring

Optional Stock Keeping Unit assigned to an item. Available when the Credit Invoices feature is enabled.

revenue_schedule_typestring

One ofat_invoiceat_range_endat_range_startevenlynever

statestring

Pending line items are charges or credits on an account that have not been applied to an invoice yet. Invoiced line items will always have an `invoice_id` value.

One ofinvoicedpending

legacy_categorystring

Category to describe the role of a line item on a legacy invoice: - "charges" refers to charges being billed for on this invoice. - "credits" refers to refund or proration credits. This portion of the invoice can be considered a credit memo. - "applied_credits" refers to previous credits applied to this invoice. See their original_line_item_id to determine where the credit first originated. - "carryforwards" can be ignored. They exist to consume any remaining credit balance. A new credit with the same amount will be created and placed back on the account.

One ofapplied_creditcarryforwardchargecredit

accountobject
idstring
objectstring
codestring

The unique identifier of the account.

emailstring (email)

The email address used for communicating with this customer.

first_namestring
last_namestring
companystring
parent_account_idstring
bill_tostring
dunning_campaign_idstring

Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used.

bill_for_account_idstring

The UUID of the account responsible for originating the line item.

subscription_idstring

If the line item is a charge or credit for a subscription, this is its ID.

plan_idstring

If the line item is a charge or credit for a plan or add-on, this is the plan's ID.

plan_codestring

If the line item is a charge or credit for a plan or add-on, this is the plan's code.

add_on_idstring

If the line item is a charge or credit for an add-on this is its ID.

add_on_codestring

If the line item is a charge or credit for an add-on, this is its code.

invoice_idstring

Once the line item has been invoiced this will be the invoice's ID.

invoice_numberstring

Once the line item has been invoiced this will be the invoice's number. If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.

previous_line_item_idstring

Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund.

original_line_item_invoice_idstring

The invoice where the credit originated. Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund.

originstring

A credit created from an original charge will have the value of the charge's origin.

One ofadd_onadd_on_trialcarryforwardcouponcreditdebitone_timeplanplan_trialsetup_feeprepayment

accounting_codestring

Internal accounting code to help you reconcile your revenue to the correct ledger. Line items created as part of a subscription invoice will use the plan or add-on's accounting code, otherwise the value will only be present if you define an accounting code when creating the line item.

product_codestring

For plan-related line items this will be the plan's code, for add-on related line items it will be the add-on's code. For item-related line items it will be the item's `external_sku`.

credit_reason_codestring

The reason the credit was given when line item is `type=credit`.

One ofgeneralgift_cardpromotionalrefundservicewrite_offDefault "general"

currencystring

3-letter ISO 4217 currency code.

amountnumber (float)

`(quantity * unit_amount) - discount + tax`

descriptionstring

Description that appears on the invoice. For subscription related items this will be filled in automatically.

quantityinteger

This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes.

Default 1

quantity_decimalstring

A floating-point alternative to Quantity. If this value is present, it will be used in place of Quantity for calculations, and Quantity will be the rounded integer value of this number. This field supports up to 9 decimal places. The Decimal Quantity feature must be enabled to utilize this field.

unit_amountnumber (float)

Positive amount for a charge, negative amount for a credit.

unit_amount_decimalstring

Positive amount for a charge, negative amount for a credit.

tax_inclusiveboolean

Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag.

subtotalnumber (float)

`quantity * unit_amount`

discountnumber (float)

The sum of all discounts applied to the line item.

discountsarray<object>

The breakdown of discounts applied to the line item by coupon redemption.

objectstring

Will always be `line_item_discount`.

coupon_idstring

The ID of the coupon that generated this discount.

coupon_redemption_idstring

The ID of the coupon redemption that generated this discount.

order_appliedinteger

The order in which this discount was applied when multiple coupons were redeemed.

discount_amountnumber (float)

The amount discounted on this line item by this coupon redemption.

currencystring

3-letter ISO 4217 currency code.

liability_gl_account_codestring

Unique code to identify the ledger account. Each code must start with a letter or number. The following special characters are allowed: `-_.,:`

revenue_gl_account_codestring

Unique code to identify the ledger account. Each code must start with a letter or number. The following special characters are allowed: `-_.,:`

performance_obligation_idstring

The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features.

taxnumber (float)

The tax amount for the line item.

json
{
  "id": "string",
  "object": "string",
  "uuid": "string",
  "type": "charge",
  "item_code": "string",
  "item_id": "string",
  "external_sku": "string",
  "revenue_schedule_type": "at_invoice",
  "state": "invoiced",
  "legacy_category": "applied_credit",
  "account": {
    "id": "string",
    "object": "string",
    "code": "string",
    "email": "name@example.com",
    "first_name": "string",
    "last_name": "string",
    "company": "string",
    "parent_account_id": "string",
    "bill_to": "string",
    "dunning_campaign_id": "string"
  },
  "bill_for_account_id": "string"
}

Need more? See the Recurly guide for connection setup and behaviour shared by every action.

Was this page helpful?