Menu
Preview Invoice
Preview new invoice for pending line items
/accounts/{account_id}/invoices/previewUse it in a workflow
- Add a step and choose the Recurly connector.
- Pick the Preview Invoice action (under invoice).
- Fill in the fields below, then reference the result from later steps as
{{previewInvoice.response.data}}.
Request
Path parameters
account_idstringrequiredAccount 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.
currencystringrequired3-letter ISO 4217 currency code.
business_entity_idstringThe `business_entity_id` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used.
business_entity_codestringThe `business_entity_code` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used.
collection_methodstringAn automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment.
One ofautomaticmanualDefault "automatic"
charge_customer_notesstringThis will default to the Customer Notes text specified on the Invoice Settings for charge invoices. Specify custom notes to add or override Customer Notes on charge invoices.
credit_customer_notesstringThis will default to the Customer Notes text specified on the Invoice Settings for credit invoices. Specify customer notes to add or override Customer Notes on credit invoices.
net_termsintegerInteger paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection.
Default 0
net_terms_typestringOptionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
One ofneteomDefault "net"
credit_application_policyobjectControls whether credit invoices are automatically applied to new invoices. The `mode` field determines the application behavior. When mode is `all`, the optional `allowed_origins` array can restrict which credit invoice origins are applied.
modestringrequiredDetermines which credit invoices are applied to invoices: - `all`: All available credit invoices are applied (default) - `none`: No credit invoices are applied automatically
One ofallnoneDefault "all"
allowed_originsarray<string>Optional array of credit invoice origin types to allow when mode is `all`. If not specified when mode is `all`, credits from all origins are applied. Only valid when mode is `all`.
po_numberstringFor manual invoicing, this identifies the PO number associated with the subscription.
terms_and_conditionsstringThis will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions.
vat_reverse_charge_notesstringVAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription.
vertex_transaction_typestringUsed by Vertex for tax calculations. Possible values are sale, rental, lease.
One ofsalerentallease
transaction_descriptor_suffixstringOptionally overrides the suffix component of the composed transaction descriptor. If omitted, the suffix is derived from the subscription's plan name or the invoice description, with a Trial prefix on Visa trial conversions. Subject to gateway availability and payment method support.
{
"currency": "string",
"business_entity_id": "string",
"business_entity_code": "string",
"collection_method": "automatic",
"charge_customer_notes": "string",
"credit_customer_notes": "string",
"net_terms": 0,
"net_terms_type": "net",
"credit_application_policy": {
"mode": "all",
"allowed_origins": [
"line_item_refund"
]
},
"po_number": "string",
"terms_and_conditions": "string",
"vat_reverse_charge_notes": "string"
}
Response
Returns 200 with an object. Read it in later steps with {{previewInvoice.response.data.<field>}}.
objectstringcharge_invoiceobjectidstringuuidstringobjectstringtypestringInvoices are either charge, credit, or legacy invoices.
One ofchargecreditlegacy
originstringThe event that created the invoice.
One ofcarryforward_creditcarryforward_gift_creditcreditexternal_refundgift_cardimmediate_changeimportline_item_refundopen_amount_refundprepaymentpurchaserefundrenewalterminationusage_correctionwrite_off
statestringOne ofopenpendingprocessingpast_duepaidclosedfailedvoidedDefault "all"
accountobject10 fieldsbilling_info_idstringThe `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature.
subscription_idsarray<string>If the invoice is charging or refunding for one or more subscriptions, these are their IDs.
previous_invoice_idstringOn refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice.
numberstringIf 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.
collection_methodstringAn automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment.
One ofautomaticmanualDefault "automatic"
po_numberstringFor manual invoicing, this identifies the PO number associated with the subscription.
net_termsintegerInteger paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection.
Default 0
net_terms_typestringOptionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
One ofneteomDefault "net"
addressobject2 fieldsshipping_addressobject19 fieldscurrencystring3-letter ISO 4217 currency code.
discountnumber (float)Total discounts applied to this invoice.
coupon_redemptionsarray<object>7 fieldsThe coupon redemptions applied to this invoice.
subtotalnumber (float)The summation of charges and credits, before discounts and taxes.
subtotal_after_discountnumber (float)The summation of charges and credits, after discounts applied.
taxnumber (float)The total tax on this invoice.
reference_only_currency_conversionobject6 fieldstotalnumber (float)The final total on this invoice. The summation of invoice charges, discounts, credits, and tax.
refundable_amountnumber (float)The refundable amount on a charge invoice. It will be null for all other invoices.
paidnumber (float)The total amount of successful payments transaction on this invoice.
balancenumber (float)The outstanding balance remaining on this invoice.
tax_infoobject4 fieldsOnly for merchants using Recurly's In-The-Box taxes.
used_tax_servicebooleanWill be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service.
vat_numberstringVAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method.
vat_reverse_charge_notesstringVAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription.
terms_and_conditionsstringThis will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions.
customer_notesstringThis will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes.
line_itemsarray<object>40 fieldshas_more_line_itemsbooleanIdentifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint.
transactionsarray<object>40 fieldscredit_paymentsarray<object>14 fieldscreated_atstring (date-time)updated_atstring (date-time)credit_invoicesarray<object>idstringuuidstringobjectstringtypestringInvoices are either charge, credit, or legacy invoices.
One ofchargecreditlegacy
originstringThe event that created the invoice.
One ofcarryforward_creditcarryforward_gift_creditcreditexternal_refundgift_cardimmediate_changeimportline_item_refundopen_amount_refundprepaymentpurchaserefundrenewalterminationusage_correctionwrite_off
statestringOne ofopenpendingprocessingpast_duepaidclosedfailedvoidedDefault "all"
accountobject10 fieldsbilling_info_idstringThe `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature.
subscription_idsarray<string>If the invoice is charging or refunding for one or more subscriptions, these are their IDs.
previous_invoice_idstringOn refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice.
numberstringIf 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.
collection_methodstringAn automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment.
One ofautomaticmanualDefault "automatic"
po_numberstringFor manual invoicing, this identifies the PO number associated with the subscription.
net_termsintegerInteger paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection.
Default 0
net_terms_typestringOptionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
One ofneteomDefault "net"
addressobject2 fieldsshipping_addressobject19 fieldscurrencystring3-letter ISO 4217 currency code.
discountnumber (float)Total discounts applied to this invoice.
coupon_redemptionsarray<object>7 fieldsThe coupon redemptions applied to this invoice.
subtotalnumber (float)The summation of charges and credits, before discounts and taxes.
subtotal_after_discountnumber (float)The summation of charges and credits, after discounts applied.
taxnumber (float)The total tax on this invoice.
reference_only_currency_conversionobject6 fieldstotalnumber (float)The final total on this invoice. The summation of invoice charges, discounts, credits, and tax.
refundable_amountnumber (float)The refundable amount on a charge invoice. It will be null for all other invoices.
paidnumber (float)The total amount of successful payments transaction on this invoice.
balancenumber (float)The outstanding balance remaining on this invoice.
tax_infoobject4 fieldsOnly for merchants using Recurly's In-The-Box taxes.
used_tax_servicebooleanWill be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service.
vat_numberstringVAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method.
vat_reverse_charge_notesstringVAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription.
terms_and_conditionsstringThis will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions.
customer_notesstringThis will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes.
line_itemsarray<object>40 fieldshas_more_line_itemsbooleanIdentifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint.
transactionsarray<object>40 fieldscredit_paymentsarray<object>14 fieldscreated_atstring (date-time)updated_atstring (date-time)verification_transactionsarray<object>Verification transactions (used for free trial payment method validation)
idstringobjectstringuuidstringThe UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI.
original_transaction_idstringIf this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded.
accountobject10 fieldsinitiatorstringMust be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`.
One ofcustomermerchant
invoiceobject6 fieldsmerchant_reason_codestringThis conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold.
One ofincrementalno_showresubmissionservice_extensionsplit_shipmenttop_upDefault "none"
voided_by_invoiceobject6 fieldssubscription_idsarray<string>If the transaction is charging or refunding for one or more subscriptions, these are their IDs.
typestring- `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided.
One ofauthorizationcapturepurchaserefundverify
originstringDescribes how the transaction was triggered.
One ofapichargebackexternal_recoveryforce_collecthppmerchantrecurly_adminrecurlyjsrecurringrefunded_externallytransparenttoken_apiapi_force_collectapi_sub_changeapi_verify_cardrefund_balanceamazon_v2_ipn
currencystring3-letter ISO 4217 currency code.
descriptionstringThe description that gets sent to the gateway.
amountnumber (float)Total transaction amount sent to the payment gateway.
statusstringThe current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`.
One ofchargebackdeclinederrorpendingprocessingscheduledsuccessvoid
successbooleanDid this transaction complete successfully?
backup_payment_method_usedbooleanIndicates if the transaction was completed using a backup payment
refundedbooleanIndicates if part or all of this transaction was refunded.
billing_addressobject2 fieldscollection_methodstringThe method by which the payment was collected.
One ofautomaticmanual
payment_methodobject19 fieldsip_address_v4stringIP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded.
ip_address_countrystringstatus_codestringstatus_messagestringFor declined (`success=false`) transactions, the message displayed to the merchant.
customer_messagestringFor declined (`success=false`) transactions, the message displayed to the customer.
customer_message_localestringpayment_gatewayobject4 fieldsgateway_messagestringTransaction message from the payment gateway.
gateway_referencestringTransaction reference number from the payment gateway.
gateway_approval_codestringgateway_response_codestringgateway_response_timenumber (float)Time, in seconds, for gateway to process the transaction.
gateway_response_valuesobjectThe values in this field will vary from gateway to gateway.
cvv_checkstringWhen processed, result from checking the CVV/CVC value on the transaction.
One ofDIMNPSUX
avs_checkstringWhen processed, result from checking the overall AVS on the transaction.
One ofABCDEFGHIJKLMNOPQRSTUVWXYZ
created_atstring (date-time)updated_atstring (date-time)voided_atstring (date-time){
"object": "string",
"charge_invoice": {
"id": "string",
"uuid": "string",
"object": "string",
"type": "charge",
"origin": "carryforward_credit",
"state": "all",
"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"
},
"billing_info_id": "string",
"subscription_ids": [
"string"
],
"previous_invoice_id": "string",
"number": "string",
"collection_method": "automatic"
},
"credit_invoices": [
{
"id": "string",
"uuid": "string",
"object": "string",
"type": "charge",
"origin": "carryforward_credit",
"state": "all",
"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"
},
"billing_info_id": "string",
"subscription_ids": [
"string"
],
"previous_invoice_id": "string",
"number": "string",
"collection_method": "automatic"
}
],
"verification_transactions": [
{
"id": "string",
"object": "string",
"uuid": "string",
"original_transaction_id": "string",
"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"
},
"initiator": "customer",
"invoice": {
"id": "string",
"object": "string",
"number": "string",
"business_entity_id": "string",
"type": "charge",
"state": "all"
},
"merchant_reason_code": "none",
"voided_by_invoice": {
"id": "string",
"object": "string",
"number": "string",
"business_entity_id": "string",
"type": "charge",
"state": "all"
},
"subscription_ids": [
"string"
],
"type": "authorization",
"origin": "api"
}
]
}
Need more? See the Recurly guide for connection setup and behaviour shared by every action.