Pay or Refund Invoices

Applies to: Invoices API | Refunds API | Payments API | Orders API

Learn how Square handles invoice payments and how to retrieve and refund an invoice payment.

Link to section

Overview

An invoice defines a payment schedule, supported payment methods, and other settings that determine how it can be paid. After the invoice is published, Square manages automatic invoice payments and payments that customers make on the invoice payment page.

Square APIs cannot be used to pay for invoices or to manage their payment status. However, developers can use the Refunds API to refund invoice payments.

Link to section

Pay an invoice

Square supports the following methods for paying invoices:

  • Customers make a payment directly on the invoice payment page using an accepted payment method. The payment page is a Square-hosted web page where the customer can view and pay the invoice.
  • Square initiates an automatic payment on the due date configured for a payment request.
  • Customers remit payment directly to the seller, who then records the payment in the Seller Dashboard, Square Point of Sale, or Square Invoices application.

Note

Applications cannot use Square APIs to take payments for invoices or to manage their payment status. In addition, after an order is associated with an invoice, Square APIs cannot be used to pay the order directly.

Square manages payment flows based on invoice settings, such as payment_requests and accepted_payment_methods.

Link to section

How it works

After an invoice is published and the scheduled_at date (if specified) is reached, Square generates the invoice payment page and adds the public_url field to the invoice. The following is an example payment page URL:

https://squareup.com/pay-invoice/inv:0-ChBoaXkM5QOPv9UO9C_Z1baX2b

If a customer provides payment information on this page, Square processes the payment. If the invoice is configured for automatic payments, Square charges the specified card on file on the due_date of the payment request or initiates a bank transfer if the buyer approves the payment. The buyer receives a request to approve the payment when the invoice is sent or the invoice is updated.

Link to section

Payment succeeds

After an invoice payment is made, Square does the following:

  • Sets the invoice status to PAID, PAYMENT_PENDING, or PARTIALLY_PAID and sets the total_completed_amount_money of the payment request to the amount paid.
  • Adds payment information to the associated order.
  • Sets the order state to COMPLETED when the order is fully paid.
  • Notifies the seller, if the Paid notification is enabled in the seller's notification settings.
  • Sends a receipt to the customer, as determined by the delivery_method setting for the invoice:
    • EMAIL - Square sends an email to the customer.
    • SMS - Square sends a text message to the customer unless the customer has opted out of text message updates from Square invoices.
    • SHARE_MANUALLY - Square doesn't send a receipt to the customer.
  • Cancels any PENDING reminders for the corresponding payment request by setting the reminder status to NOT_APPLICABLE.
  • Invokes an invoice.payment_made webhook event, along with order.updated, payment.created, and payment.updated events.
  • Updates the invoice payment page, Seller Dashboard, Square Point of Sale, and Square Invoices application with the payment status, schedule, and history.
Link to section

Automatic payment fails

If an automatic payment fails, Square does the following:

  • Sets the automatic_payment_source field of all payment requests for the invoice to NONE.

  • Notifies the seller.

  • Emails an invoice to the customer that contains a link to the invoice payment page where the customer can pay the amount due.

  • Invokes an invoice.scheduled_charge_failed webhook event. Depending on the cause of the failure, Square might invoke payment events, such as a payment.created with a status of FAILED.

    Error information indicating why the payment failed isn't available in the webhook payload or corresponding payment. In this case, you or the seller might need to contact the customer.

Link to section

Payment overdue

Square takes no explicit action if an invoice payment becomes overdue. However, you can schedule reminders to be sent if the payment isn't made by the due date.

Note

If needed, you can determine whether a payment is overdue by retrieving the invoice after the due date and comparing the total_completed_amount_money and computed_amount_money amounts in the payment request.

For more information about payment-related invoice settings, see Configuring payment requests and Configuring how Square processes an invoice.

Link to section

Retrieve an invoice payment

Although Square APIs cannot be used to pay an invoice, you can use Square APIs to retrieve payments that were made for an invoice. You can get the payment ID from the order that is associated with the invoice. Orders store a record of payments in the tenders field.

  1. To retrieve the invoice, call GetInvoice and provide the invoice ID. If you don't have the invoice ID, call ListInvoices or SearchInvoices.

    Get invoice

  2. Copy the order_id from the response.

  3. To retrieve the order, call RetrieveOrder and provide the order ID.

    Retrieve order

    The following excerpt of an example response shows the tenders field:

  4. Copy the id of the tender that corresponds to the payment you want to retrieve. This ID represents the payment ID. Note that some tenders also include a payment_id field that contains the same ID.

  5. To retrieve the payment, call GetPayment and provide the payment ID.

    Get payment

Note

Payments also appear on the Transactions page of the Seller Dashboard.

Link to section

Refund an invoice

You can call the RefundPayment endpoint in the Refunds API to refund invoice payments.

The invoice status must be PAID, CANCELED, or FAILED to refund a payment. Invoices with a status of PARTIALLY_PAID must be canceled using CancelInvoice before they can be refunded.

Link to section

Refund an invoice payment

To refund an invoice payment, you must provide the corresponding payment ID. You can get this ID from the order that is associated with the invoice. Orders store a record of payments in the tenders field.

  1. To retrieve the invoice, call GetInvoice and provide the invoice ID. If you don't have the invoice ID, call ListInvoices or SearchInvoices.

    Get invoice

  2. Copy the order_id from the response.

  3. To retrieve the order, call RetrieveOrder and provide the order ID.

    Retrieve order

    The following excerpt of an example response shows the tenders field:

  4. Copy the id of the tender that corresponds to the payment you want to refund. This ID represents the payment ID. Some tenders also include a payment_id field that contains the same ID. The amount_money field shows the maximum amount that can be refunded for the payment.

  5. To refund the payment, call RefundPayment and provide the payment ID and the amount to refund. For orders with multiple payments, you must make a separate call for each payment that you want to refund.

    Refund payment

    The following is an example response:

    { "refund": { "id": "EnZdNAlWCmfh6Mt5FMN3example_qOfJKjOzCyU3fZexample", "status": "COMPLETED", "amount_money": { "amount": 1000, "currency": "USD" }, "payment_id": "EnZdNAlWCmfh6Mt5FMN3example", "order_id": "AqBDyr9oJqj4oDHj8example", "created_at": "2020-08-16T18:28:33Z", "reason": "Optional reason for the refund." } }

    Note

    The order_id in the response references the return order that Square creates for the refund operation. The source_order_id of the return order references the original order. For more information, see Order Returns and Exchanges.

The following considerations apply when refunding invoice payments:

  • When an invoice payment is refunded, Square updates the invoice status to REFUNDED if the entire amount paid for the invoice is refunded or PARTIALLY_REFUNDED if only a portion is refunded.

    Square also updates the updated_at and version fields, but doesn't update the total_completed_amount_money field of the corresponding payment request. To find the amount that was refunded, retrieve the payment and check the refunded_money field. Note that customers cannot pay an invoice in the REFUNDED or PARTIALLY_REFUNDED state from the invoice payment page, so you should create a new invoice if a payment is still due.

  • Square invokes an invoice.refunded webhook event after the refund is processed, along with refund.created, refund.updated, and payment.updated events. The inventory.count.updated event is also invoked if the order associated with the invoice was itemized using catalog objects and the seller configured the Inventory management for invoices setting to adjust inventory levels through invoices.

  • Sellers can also refund invoice payments using the Seller Dashboard, Square Point of Sale, and Square Invoices application. Payments also appear on the Transactions page of the Seller Dashboard.

Link to section

Example invoice.refunded events

The following are example invoice.refunded payloads for a REFUNDED invoice and a PARTIALLY_REFUNDED invoice.

Link to section

Example payload for a fully refunded invoice

Link to section

Example payload for a partially refunded invoice

For more information about invoice webhooks, see Webhooks.

Link to section

See also