Create and Publish Invoices

Applies to: Invoices API | Orders API | Customers API | Cards API

Learn how to create, configure, and publish invoices using the Invoices API.

Link to section

Overview

Applications can use the Invoices API to request or collect payment from customers on behalf of a Square seller. First, call the CreateInvoice endpoint to create a draft invoice for an order (which must be created with the Orders API) and configure the payment schedule, recipient, and other invoice settings. Then, call the PublishInvoice endpoint to begin processing the invoice.

Link to section

Requirements and limitations

To create and publish an invoice, you must be prepared to provide the following information:

  • The ID of the associated order. If needed, call SearchOrders to get the order ID.

    • The order status must be OPEN.
    • The order cannot include rewards.
    • The order cannot use pricing rules (rule-based pricing options), which means that the pricing_options.auto_apply_discounts and pricing_options.auto_apply_taxes fields cannot be set to true.
    • The order can include a service charge only if:
      • The country of the order location is CA or US.
      • The treatment_type of the service charge isn't APPORTIONED_TREATMENT.
  • The ID of the customer profile that represents the invoice recipient. If needed, call SearchCustomers to get the customer ID.

    • The customer profile must include email_address or phone_number. An email address is required if the invoice is delivered by email or configured for automatic payment.
    • The invoice recipient can be the customer associated with the order or a different customer.
  • The ID of a card on file if the invoice is configured for automatic payment. To obtain the card ID, call ListCards using the customer_id query parameter.

  • The payment schedule for the invoice, list of payment methods accepted on the invoice payment page, and delivery method that Square should use to communicate with the recipient. For more information, see Configuring payment requests and Configuring how Square processes an invoice.

In addition, you should be aware of the following considerations:

  • An order can be associated with a single invoice, and an invoice can be associated with a single order. After an order is associated with an invoice, updates to the order are subject to restrictions.

    Orders created from Square Online or other Square products cannot be associated with an invoice because they don't initially include an order ID.

  • To use custom fields or installment payments, the seller for whom you create the invoice must have an active (or trial) Invoices Plus subscription.

  • Invoice requirements and features might vary by location. For more information, see International availability and considerations.

  • When a customer ID is first specified for an invoice, Square retrieves contact information from the customer profile and adds it to the invoice. However, this recipient information isn't updated if the information changes in the Customer Directory.

  • The invoice recipient might not be the same customer associated with the underlying order or with any invoice payments.

For more information and other considerations, see Requirements and limitations.

Link to section

Create an invoice

Call CreateInvoice to create a draft invoice. Ensure that the requirements and limitations are met and provide the following information in the request:

  • order_id with the ID of the associated order.

  • primary_recipient.customer_id with the ID of the customer who receives the invoice. This field isn't required to create the invoice, but it's required to publish the invoice.

  • payment_requests for the invoice, with one or more payment requests that equal the total_money of the order. For more information, see Configuring payment requests.

  • delivery_method that Square should use to communicate with the recipient.

  • accepted_payment_methods that customers can use to pay the invoice on the invoice payment page. At least one of the following payment methods must be enabled:

    • card (credit or debit card)
    • square_gift_card
    • bank_account
    • buy_now_pay_later
    • cash_app_pay

    This setting is independent of any automatic payment requests for the invoice. Customers can choose to make a payment from the invoice payment page even when the invoice is configured for automatic payments.

  • Optional invoice settings.

  • An optional idempotency_key to ensure idempotency.

The following example request includes one BALANCE payment request due by September 30, 2022:

Create invoice

You can also configure the invoice to be processed at a future date and configure reminders for before and after the due date. The following CreateInvoice request directs Square to send the invoice on the scheduled_at date and send a reminder 1 day before the payment due date.

Create invoice

The following is an example response. Note that the status of the returned invoice is set to DRAFT.

For more CreateInvoice request examples, see Walkthrough: Create and Publish Invoices.

After an invoice is created, Square adds the following fields to each payment request:

  • computed_amount_money with the amount of the payment request.
  • total_completed_amount_money with a zero amount, which represents the amount paid for the payment request. Square updates the amount after the payment request is paid.

When an invoice is created, Square invokes an invoice.created webhook event. The order.updated event is also invoked after Square associates the order with the invoice.

Link to section

Optional invoice settings

The following optional fields are commonly used in CreateInvoice requests. For information about all optional invoices fields, see Invoice.

FieldDescription
scheduled_atThe date to process the invoice and generate the invoice payment page, according to the delivery method and payment request settings. If not specified, Square processes the invoice immediately after it's published.
remindersReminders for a payment request that Square should send relative to the due date (before or after). If the payment is made before the due date, Square doesn't send any remaining scheduled reminders.
invoice_numberA user-friendly string that displays on the invoice. You might use the invoice number for client-side operations. If not specified, Square assigns a value.
titleThe invoice title that displays on the invoice. If not specified, the business name is used as the title.
descriptionThe description that displays on the invoice.
sale_or_service_dateThe date of the sale or the date when the service was rendered. This date displays on the invoice but doesn't drive any business logic.
custom_fieldsUp to two custom fields that display on the invoice. Custom fields require an Invoices Plus subscription.
store_payment_method_enabledIndicates whether to allow customers to save credit card, debit card, or bank transfer payment information when paying an invoice. The default value is false. When set to true, Square displays a Save my card on file or Save my bank on file checkbox on the invoice payment page. If the checkbox is selected, Square creates a card on file or a bank account on file for the customer using the information provided in the payment form. Stored payment information can be used for future automatic payments. Allowing customers to save gift cards on file for invoice payments isn't supported.
Link to section

Publish an invoice

To publish an invoice, call PublishInvoice provide the following information:

  • The ID of the invoice to publish. The invoice must be in the DRAFT state.
  • The current version of the invoice.
  • An optional idempotency_key used to ensure idempotency.

You can use the id and version fields from the invoice returned in the CreateInvoice response. If you need to get the ID and version, call SearchInvoices or ListInvoices. If you have the ID but need the version, call GetInvoice.

Important

When publishing invoices configured for card-on-file payments, the CUSTOMERS_READ and PAYMENTS_WRITE permissions are required in addition to ORDERS_WRITE and INVOICES_WRITE.

Publish invoice

The following is an example response:

The status of the returned invoice depends on how the invoice is configured. For example, the status is SCHEDULED if scheduled_at is set to a future date or UNPAID if the payment due_date is set to a future date.

After an invoice is published and the scheduled_at date (if specified) is reached, Square does the following:

  • Generates the invoice payment page where customers can make a payment.

  • Adds the public_url field with the payment page URL to the invoice.

  • Adds the next_payment_amount_money field with the next payment amount due to the invoice, unless an automatic payment for the balance is completed immediately.

  • Processes the invoice based on the invoice settings and handles the remaining workflow.

    For example, Square can email the invoice, charge a card on file, or let you or the seller send the payment page URL to the customer. Square collects all invoice payments, either directly from customers (from the online payment page) or through automatic payments. Square also updates the invoice payment status and sends reminders and receipts as scheduled.

When the invoice is published, Square invokes invoice.published and invoice.updated webhook events, along with additional events if the invoice is configured to immediately collect an automatic payment. For more information, see Pay an invoice.

Link to section

Configuring payment requests

The payment_requests field defines the payment schedule for an invoice, which includes payment amounts, due dates, and other related settings. The example invoice in the previous section contains one payment request for the full order amount, but you can optionally split the invoice into multiple payment requests. A payment request is represented by the InvoicePaymentRequest object.

The following table shows possible payment scenarios and the corresponding request_type combinations for the invoice payment requests.

Payment scenariorequest_type combination
One payment in full1 BALANCE
A deposit with the balance due later1 DEPOSIT and 1 BALANCE
A deposit with remaining payments in installments
(requires an Invoices Plus subscription)
1 DEPOSIT and 2–12 INSTALLMENT
All payments in installments
(requires an Invoices Plus subscription)
2–12 INSTALLMENT

Deposit or installment payments can be specified by percentage or as a fixed amount. For percentage-based payments, Square computes the amount based on the total_money amount of the order.

Note

For sellers who accept Afterpay (or Clearpay) payments, you can enable invoices to accept Buy Now Pay Later payments. For more information, see Buy Now Pay Later payments with Afterpay.

Link to section

Example payment requests

The following examples show how you can define payment scenarios in the payment_requests field when you create an invoice.

  • One payment in full

    The following payment_requests example shows how to request one payment in full:

    ... "payment_requests": [ { "request_type":"BALANCE", "due_date":"2030-02-01" } ] ...

    The single BALANCE payment request represents the total amount of the order.

  • Deposit with balance due later

    The following payment_requests example shows how to request a 50% deposit and the remaining 50% balance at a later date:

    ... "payment_requests": [ { "request_type":"DEPOSIT", "due_date":"2030-02-01", "percentage_requested":"50" }, { "request_type":"BALANCE", "due_date":"2030-03-01" } ] ...

    This example contains two payment requests. The first is a DEPOSIT that uses the percentage_requested field to request 50% of the total amount of the order. The balance is for the remaining amount, which isn't explicitly specified.

  • Deposit with two installments (requires an Invoices Plus subscription)

    A deposit can also be combined with 2–12 installment payments.

    Percentage example

    The following payment_requests example shows how to use the percentage_requested field to request a 50% deposit and the balance paid in two equal installments:

    The percentage requested for the installments applies to the amount remaining after the deposit is paid. For an order with a total amount of $100, the invoice would request a $50 deposit, followed by two installments of $25 each.

    Fixed amount example

    Instead of percentages, you can use the fixed_amount_requested_money field to specify exact amounts for deposits and installments, as shown in the following payment_requests example:

Link to section

Payment request considerations

The following considerations apply when configuring payment requests:

  • The due_date and request_type fields must be specified for all payment requests.

  • For DEPOSIT or INSTALLMENT payment requests, either a percentage-based amount or a fixed amount must be specified.

    • To specify a percentage-based amount, set the percentage_requested field.

      • For a DEPOSIT request, base the percentage on the total order amount.

      • For INSTALLMENT requests, base the percentage on the total order amount minus any deposit amount. The percentages of all installment payment requests must add up to 100%, as shown in the preceding example.

        Installment payments are supported only with an Invoices Plus subscription.

    • To specify a fixed amount, set the fixed_amount_requested_money field.

      • The total payment amounts in payment_requests must equal the total_money amount of the associated order.
  • The automatic_payment_source field of the payment request indicates whether the request is configured for automatic payments. The following are valid values:

    ValueDescription
    NONENo automatic payment is configured. This is the default value.
    CARD_ON_FILEDirects Square to charge the credit or debit card on file specified by the card_id field of the payment request. To get a card ID, call ListCards and provide the customer_id.
    To set up automatic payments from a card on file, you must set the delivery_method of the invoice to EMAIL.
    BANK_ON_FILEDirects Square to initiate a transfer from the bank account on file. The customer must approve each payment.
    This value cannot be set from the Invoices API. It applies only to invoices that sellers create in Square products, such as the Square Dashboard.

    If an automatic payment fails, Square sends an invoice to the customer.

  • For each payment request, you can use the reminders field to schedule one or more reminders relative to the due_date of the payment. For more information, see InvoicePaymentReminder.

    Square sends reminders at 11:00 AM in the timezone of the invoice. If the payment is made before the scheduled reminder date, Square doesn't send the reminder.

Link to section

Configuring how Square processes an invoice

After you publish an invoice, Square performs activities to manage the payment schedule (such as sending a reminder to the customer or initiating an automatic payment) based on invoice settings.

The following sections describe how to configure invoice settings to control how Square processes the invoice.

Link to section

Option 1: Send an invoice to request payment

Square sends the customer an invoice requesting payment by the due date. Square also sends a receipt after a payment is made.

  • scheduled_at - To send an invoice immediately after publishing, omit this field. Otherwise, specify the date to send the invoice.
  • delivery_method - Specify EMAIL.
  • accepted_payment_methods - Specify true for one or more payment methods that customers can use to pay the invoice on the invoice payment page.
  • For each payment request, configure the following fields:
    • due_date - Specify the due date of the payment.
    • automatic_payment_source - Keep the default value of NONE.
    • request_type, reminders, and other payment fields - Specify as needed. For invoices with multiple payment requests, Square sends invoices and reminders according to the payment schedule. For more information, see Configuring payment requests and Automatic communication from Square.
Link to section

Option 2: Automatically charge a credit or debit card on file

If the invoice is published on the due date, Square charges the card on file and sends a receipt. If the payment is due later, Square sends an invoice notifying the customer about the upcoming automatic payment. On the due date, Square charges the card on file and sends a receipt.

  • scheduled_at - To send the invoice or receipt immediately after publishing, omit this field. Otherwise, specify the date to send the invoice.
  • delivery_method - Specify EMAIL.
  • accepted_payment_methods - Specify true for one or more payment methods that customers can use to pay the invoice on the invoice payment page. This field is required even when the invoice is configured for automatic payments because customers can optionally make a payment from the invoice page.
  • For each payment request, configure the following fields:
    • due_date - Specify the due date of the payment. Square charges the card on file on this date.
    • automatic_payment_source - Specify CARD_ON_FILE.
    • card_id - Specify the ID of the card on file to charge. To get a card ID, call ListCards and provide the customer_id.
    • request_type,reminders, and other payment fields - Specify as needed. For invoices with multiple payment requests, Square sends invoices and reminders according to the payment schedule. For more information, see Configuring payment requests and Automatic communication from Square.
Link to section

Option 3: Square takes no action

In this case, the seller or the application developer follows up with the customer. Square doesn't send the invoice or receipt to the customer.

  • delivery_method - Specify SHARE_MANUALLY.
  • accepted_payment_methods - Specify true for one or more payment methods that customers can use to pay the invoice on the invoice payment page.
  • For each payment request, configure the following fields:
    • due_date - Specify the due date of the payment.
    • automatic_payment_source - Keep the default value of NONE.
    • request_type, reminders, and other payment fields - Specify as needed. For more information, see Configuring payment requests.

Note

The following settings can be configured only from Square products:

  • SMS (text message) delivery method - See additional SMS considerations.
  • BANK_ON_FILE automatic payment method.

You cannot use the Invoices API to set these values, but you can use the Invoices API to change them. For example, you can change an SMS invoice delivery method to EMAIL or SHARE_MANUALLY.

Link to section

See also