Invoices
Create, configure, and publish invoices for orders that were created.
Table Specific Information
Select
The 本製品 uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the 本製品.
Retrieve all invoices from a location specified in the filter.
SELECT * from Invoices where locationid = '92BYHNBR6W77E'
Retrieve an invoice by invoice ID.
SELECT * from Invoices where id = 'inv:0-ChCEwgC9pIyJcHaTpPUDOxHLEL0M'
Insert
To create a draft invoice for an order, you will need to specify OrderId, DeliveryMethod columns and PaymentRequests pseudo columns.
INSERT INTO Invoices(OrderId,AcceptedPaymentMethodCashAppPay,DeliveryMethod,PaymentRequestsRequestType,PaymentRequestsDueDate) VALUES('ASXK4JVIMPx33BTJ2iLEzaTXwxZZY',true,'EMAIL','BALANCE','2024-10-12')
Update
To update an invoice, you will need to set current version number of the invoice in the query.
UPDATE Invoices SET Title = 'Testing@001', Version = 7 where id = 'inv:0-ChC4p4-kE0gkhzWD2-NPhXiuEL0M'
Delete
Delete the specified invoice.
DELETE from invoices where id = 'inv:0-ChCFV-a1tLofCBvdpj5UA4qgEL0M'
Columns
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Square-assigned ID of the invoice. |
Version | Int32 | False |
The Square-assigned version number, which is incremented each time an update is committed to the invoice. |
LocationId | String | False |
The ID of the location that this invoice is associated with. |
OrderId | String | False |
The ID of the order for which the invoice is created. |
PrimaryRecipientCustomerId | String | False |
TThe ID of the customer who receives the invoice. |
PrimaryRecipientGivenName | String | True |
The recipient's given (that is, first) name. |
PrimaryRecipientFamilyName | String | True |
The recipient's family (that is, last) name. |
PrimaryRecipientEmail | String | True |
The recipient's email address. |
PrimaryRecipientAddress | String | True |
The recipient's physical address. |
PrimaryRecipientPhoneNumber | String | True |
The recipient's phone number. |
PrimaryRecipientCompanyName | String | True |
The name of the recipient's company. |
PrimaryRecipientTaxIds | String | True |
The recipient's tax IDs. The country of the seller account determines whether this field is available for the customer. |
PaymentRequests | String | False |
The payment schedule for the invoice, represented by one or more payment requests that define payment settings, such as amount due and due date. |
DeliveryMethod | String | False |
The delivery method that Square uses to send the invoice, reminders, and receipts to the customer. |
InvoiceNumber | String | False |
A user-friendly invoice number that is displayed on the invoice. The value is unique within a location. |
Title | String | False |
The title of the invoice, which is displayed on the invoice. |
Description | String | False |
The description of the invoice, which is displayed on the invoice. |
ScheduledAt | Datetime | False |
The timestamp when the invoice is scheduled for processing, in RFC 3339 format. |
PublicUrl | String | True |
The URL of the Square-hosted invoice page. |
NextPaymentMoneyAmount | Int64 | True |
The current amount due for the invoice. In addition to the amount due on the next payment request, this includes any overdue payment amounts. |
NextPaymentMoneyCurrency | String | True |
The type of currency of the current amount due for the invoice, in ISO 4217 format. |
Status | String | True |
The status of the invoice. |
Timezone | String | True |
The time zone used to interpret calendar dates on the invoice, such as due_date. When an invoice is created, this field is set to the timezone specified for the seller location. The value cannot be changed. |
CreatedAt | Datetime | True |
The timestamp when the invoice was created, in RFC 3339 format. |
UpdatedAt | Datetime | True |
The timestamp when the invoice was last updated, in RFC 3339 format. |
AcceptedPaymentMethodCard | Boolean | False |
Indicates whether credit card or debit card payments are accepted. |
AcceptedPaymentMethodSquareGiftCard | Boolean | False |
Indicates whether Square gift card payments are accepted. |
AcceptedPaymentMethodBankAccount | Boolean | False |
Indicates whether ACH bank transfer payments are accepted. |
AcceptedPaymentMethodBuyNowPayLater | Boolean | False |
Indicates whether Afterpay (also known as Clearpay) payments are accepted. |
AcceptedPaymentMethodCashAppPay | Boolean | False |
Indicates whether Cash App payments are accepted. |
CustomFields | String | False |
Additional seller-defined fields that are displayed on the invoice. |
SubscriptionId | String | True |
The ID of the subscription associated with the invoice. |
SaleOrServiceDate | Datetime | False |
The date of the sale or the date that the service is rendered, in YYYY-MM-DD format. |
PaymentConditions | String | False |
France only. The payment terms and conditions that are displayed on the invoice. For countries other than France, Square returns an INVALID_REQUEST_ERROR with a BAD_REQUEST code. |
StorePaymentMethodEnabled | Boolean | False |
Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a bank account on file. |
Attachments | String | True |
Metadata about the attachments on the invoice. |
Pseudo-Columns
SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。
Name | Type | Description |
PaymentRequestsRequestType | String |
Identifies the payment request type. This type defines how the payment request amount is determined. 使用できる値は次のとおりです。BALANCE, DEPOSIT, INSTALLMENT |
PaymentRequestsDueDate | Datetime |
The due date (in the invoice's time zone) for the payment request, in YYYY-MM-DD format. |