# Create & Send

POST https://services.leadconnectorhq.com/invoices/text2pay

API to create or update a text2pay invoice

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `invoices.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/invoices/text2pay": {
      "post": {
        "summary": "Create & Send",
        "operationId": "createSend",
        "description": "API to create or update a text2pay invoice",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Text2PayDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Text2PayInvoiceResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "invoices.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "Text2PayDto": {
        "type": "object",
        "properties": {
          "altId": {
            "type": "string",
            "description": "location Id / company Id based on altType",
            "example": "6578278e879ad2646715ba9c"
          },
          "altType": {
            "type": "string",
            "description": "Alt Type",
            "enum": [
              "location"
            ],
            "example": "location"
          },
          "name": {
            "type": "string",
            "description": "Invoice Name",
            "example": "New Invoice"
          },
          "currency": {
            "type": "string",
            "description": "Currency code",
            "example": "USD"
          },
          "items": {
            "description": "An array of items for the invoice.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Invoice Item Name",
                  "example": "ABC Product"
                },
                "description": {
                  "type": "string",
                  "description": "Invoice descriptions",
                  "example": "ABC Corp."
                },
                "productId": {
                  "type": "string",
                  "description": "Product Id",
                  "example": "6578278e879ad2646715ba9c"
                },
                "priceId": {
                  "type": "string",
                  "description": "Price Id",
                  "example": "6578278e879ad2646715ba9c"
                },
                "currency": {
                  "type": "string",
                  "description": "Currency",
                  "example": "USD"
                },
                "amount": {
                  "type": "number",
                  "description": "Product amount",
                  "example": 999
                },
                "qty": {
                  "type": "number",
                  "description": "Product Quantity",
                  "example": 1
                },
                "taxes": {
                  "description": "Tax",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number"
                      },
                      "calculation": {
                        "type": "string",
                        "enum": [
                          "exclusive"
                        ]
                      },
                      "description": {
                        "type": "string"
                      },
                      "taxId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "_id",
                      "name",
                      "rate"
                    ],
                    "title": "ItemTaxDto"
                  }
                },
                "automaticTaxCategoryId": {
                  "type": "string",
                  "description": "Tax category id for calculating automatic tax",
                  "example": "6578278e879ad2646715ba9c"
                },
                "isSetupFeeItem": {
                  "type": "boolean",
                  "description": "Setupfee item, only created when 1st invoice of recurring schedule is generated"
                },
                "type": {
                  "type": "string",
                  "description": "Price type of the item",
                  "example": "one_time",
                  "enum": [
                    "one_time",
                    "recurring"
                  ]
                },
                "taxInclusive": {
                  "type": "boolean",
                  "description": "true if item amount is tax inclusive",
                  "example": true,
                  "default": false
                }
              },
              "required": [
                "name",
                "currency",
                "amount",
                "qty"
              ],
              "title": "InvoiceItemDto"
            }
          },
          "termsNotes": {
            "type": "string",
            "description": "Terms notes, Also supports HTML markups",
            "example": "<p>This is a default terms.</p>"
          },
          "title": {
            "type": "string",
            "description": "Title for the invoice",
            "example": "INVOICE"
          },
          "contactDetails": {
            "description": "Contact information to send the invoice to",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Contact ID",
                    "example": "6578278e879ad2646715ba9c"
                  },
                  "name": {
                    "type": "string",
                    "description": "Contact Name",
                    "example": "Alex"
                  },
                  "phoneNo": {
                    "type": "string",
                    "description": "Contact Phone Number",
                    "example": "+1234567890"
                  },
                  "email": {
                    "type": "string",
                    "description": "Contact Email",
                    "example": "alex@example.com"
                  },
                  "additionalEmails": {
                    "description": "Secondary email addresses for the contact to be saved",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string",
                          "example": "alex@example.com"
                        }
                      },
                      "required": [
                        "email"
                      ],
                      "title": "AdditionalEmailsDto"
                    }
                  },
                  "companyName": {
                    "type": "string",
                    "description": "Contact Company Name",
                    "example": "ABC Corp."
                  },
                  "address": {
                    "type": "object",
                    "properties": {
                      "addressLine1": {
                        "type": "string",
                        "description": "Address Line 1",
                        "example": "9931 Beechwood"
                      },
                      "addressLine2": {
                        "type": "string",
                        "description": "Address Line 2",
                        "example": "Beechwood"
                      },
                      "city": {
                        "type": "string",
                        "description": "City",
                        "example": "St. Houston"
                      },
                      "state": {
                        "type": "string",
                        "description": "State",
                        "example": "TX"
                      },
                      "countryCode": {
                        "type": "string",
                        "description": "Country Code",
                        "example": "US"
                      },
                      "postalCode": {
                        "type": "string",
                        "description": "Postal Code",
                        "example": "559-6993"
                      }
                    },
                    "title": "AddressDto"
                  },
                  "customFields": {
                    "description": "Custom Values",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "phoneNo",
                  "email"
                ],
                "title": "ContactDetailsDto"
              }
            ]
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice Number",
            "example": "1001"
          },
          "issueDate": {
            "type": "string",
            "description": "Issue date in YYYY-MM-DD format",
            "example": "2023-01-01"
          },
          "dueDate": {
            "type": "string",
            "description": "Due date in YYYY-MM-DD format",
            "example": "2023-01-14"
          },
          "sentTo": {
            "type": "object",
            "properties": {
              "email": {
                "description": "Email Address",
                "example": [
                  "alex@example.com"
                ],
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "emailCc": {
                "description": "cc to be kept in any sent out emails",
                "example": [
                  "alex@example.com"
                ],
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "emailBcc": {
                "description": "bcc to be kept in any sent out emails",
                "example": [
                  "alex@example.com"
                ],
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "phoneNo": {
                "description": "Contact Phone Number",
                "example": [
                  "+1-214-559-6993"
                ],
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "email"
            ],
            "title": "SentToDto"
          },
          "liveMode": {
            "type": "boolean"
          },
          "automaticTaxesEnabled": {
            "type": "boolean",
            "description": "Automatic taxes enabled for the Invoice",
            "example": true
          },
          "paymentSchedule": {
            "description": "split invoice into payment schedule summing up to full invoice amount",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "Payment schedule type",
                    "enum": [
                      "fixed",
                      "percentage"
                    ],
                    "example": "percentage"
                  },
                  "schedules": {
                    "description": "payment schedule item",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "type",
                  "schedules"
                ],
                "title": "PaymentScheduleDto"
              }
            ]
          },
          "lateFeesConfiguration": {
            "description": "late fees configuration",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "enable": {
                    "type": "boolean",
                    "description": "Enable late fees",
                    "example": true
                  },
                  "value": {
                    "type": "number",
                    "description": "Late Fees Value",
                    "example": 10
                  },
                  "type": {
                    "type": "string",
                    "description": "Late Fees Type",
                    "example": "fixed",
                    "enum": [
                      "fixed",
                      "percentage"
                    ]
                  },
                  "frequency": {
                    "description": "Late Fees Frequency",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "intervalCount": {
                            "type": "number",
                            "description": "Late fees interval count",
                            "example": 10
                          },
                          "interval": {
                            "type": "string",
                            "description": "Late fees interval",
                            "example": "day",
                            "enum": [
                              "minute",
                              "hour",
                              "day",
                              "week",
                              "month",
                              "one_time"
                            ]
                          }
                        },
                        "required": [
                          "intervalCount",
                          "interval"
                        ],
                        "title": "LateFeesFrequencyDto"
                      }
                    ]
                  },
                  "grace": {
                    "description": "Late Fees Grace",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "intervalCount": {
                            "type": "number",
                            "description": "Late fees grace interval count",
                            "example": 10
                          },
                          "interval": {
                            "type": "string",
                            "description": "Late fees grace interval",
                            "example": "day",
                            "enum": [
                              "day"
                            ]
                          }
                        },
                        "required": [
                          "intervalCount",
                          "interval"
                        ],
                        "title": "LateFeesGraceDto"
                      }
                    ]
                  },
                  "maxLateFees": {
                    "description": "Max late fees payable",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "example": "fixed",
                            "enum": [
                              "fixed"
                            ]
                          },
                          "value": {
                            "type": "number",
                            "example": "10",
                            "description": "Max late fees to pay"
                          }
                        },
                        "required": [
                          "type",
                          "value"
                        ],
                        "title": "LateFeesMaxFeesDto"
                      }
                    ]
                  }
                },
                "required": [
                  "enable",
                  "value",
                  "type",
                  "frequency"
                ],
                "title": "LateFeesConfigurationDto"
              }
            ]
          },
          "tipsConfiguration": {
            "description": "tips configuration for the invoice",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "tipsPercentage": {
                    "description": "Percentage of tips allowed",
                    "example": [
                      5,
                      10,
                      15
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tipsEnabled": {
                    "type": "boolean",
                    "description": "Tips enabled status",
                    "example": true
                  }
                },
                "required": [
                  "tipsPercentage",
                  "tipsEnabled"
                ],
                "title": "TipsConfigurationDto"
              }
            ]
          },
          "invoiceNumberPrefix": {
            "type": "string",
            "description": "prefix for invoice number",
            "example": "INV-"
          },
          "paymentMethods": {
            "description": "Payment Methods for Invoices",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "stripe": {
                    "description": "Payment Method",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enableBankDebitOnly": {
                            "type": "boolean",
                            "description": "Enable Bank Debit Only",
                            "example": false
                          }
                        },
                        "required": [
                          "enableBankDebitOnly"
                        ],
                        "title": "StripePaymentMethodDto"
                      }
                    ]
                  }
                },
                "required": [
                  "stripe"
                ],
                "title": "PaymentMethodDto"
              }
            ]
          },
          "attachments": {
            "description": "attachments for the invoice",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Id of the file selected",
                  "example": "6241712be68f7a98102ba272"
                },
                "name": {
                  "type": "string",
                  "description": "Name of the file ",
                  "example": "Electronics.pdf"
                },
                "url": {
                  "type": "string",
                  "description": "URL of the file",
                  "example": "https://example.com/digital-delivery"
                },
                "type": {
                  "type": "string",
                  "description": "Type of the file"
                },
                "size": {
                  "type": "number",
                  "description": "Size of the file",
                  "example": 10000
                }
              },
              "required": [
                "id",
                "name",
                "url",
                "type",
                "size"
              ],
              "title": "AttachmentsDto"
            }
          },
          "miscellaneousCharges": {
            "description": "miscellaneous charges for the invoice",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "charges": {
                    "description": "charges for the processing fee",
                    "items": {
                      "type": "array"
                    },
                    "type": "array"
                  },
                  "collectedMiscellaneousCharges": {
                    "type": "number",
                    "description": "collected miscellaneous charges",
                    "example": 10
                  },
                  "paidCharges": {
                    "description": "paid miscellaneous charges",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "name of the processing fee",
                          "example": "Processing Fee"
                        },
                        "charge": {
                          "type": "number",
                          "description": "charge for the processing fee",
                          "example": 10
                        },
                        "amount": {
                          "type": "number",
                          "description": "amount of the processing fee",
                          "example": 10
                        },
                        "_id": {
                          "type": "string",
                          "description": "id of the processing fee",
                          "example": "673d01d7d547648a8dab6211"
                        }
                      },
                      "required": [
                        "name",
                        "charge",
                        "amount",
                        "_id"
                      ],
                      "title": "ProcessingFeePaidChargeDto"
                    }
                  }
                },
                "required": [
                  "charges"
                ],
                "title": "ProcessingFeeDto"
              }
            ]
          },
          "id": {
            "type": "string",
            "description": "id of invoice to update. If skipped, a new invoice will be created"
          },
          "includeTermsNote": {
            "type": "boolean",
            "description": "include terms & notes with receipts",
            "example": true
          },
          "action": {
            "type": "string",
            "description": "create invoice in draft mode or send mode",
            "example": "draft",
            "enum": [
              "draft",
              "send"
            ]
          },
          "userId": {
            "type": "string",
            "description": "id of user generating invoice"
          },
          "discount": {
            "type": "object",
            "properties": {
              "value": {
                "type": "number",
                "description": "Discount Value",
                "example": 10,
                "default": 0
              },
              "type": {
                "type": "string",
                "description": "Discount type",
                "enum": [
                  "percentage",
                  "fixed"
                ],
                "example": "percentage",
                "default": "percentage"
              },
              "validOnProductIds": {
                "description": "Product Ids on which discount is applicable",
                "example": "[ '6579751d56f60276e5bd4154' ]",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type"
            ],
            "title": "DiscountDto"
          },
          "businessDetails": {
            "type": "object",
            "properties": {
              "logoUrl": {
                "type": "string",
                "description": "Business Logo URL",
                "example": "https://example.com/logo.png"
              },
              "name": {
                "type": "string",
                "description": "Business Name",
                "example": "ABC Corp."
              },
              "phoneNo": {
                "type": "string",
                "description": "Business Phone Number",
                "example": "+1-214-559-6993"
              },
              "address": {
                "description": "Business Address",
                "example": "9931 Beechwood, TX",
                "allOf": [
                  {
                    "type": "object",
                    "properties": {
                      "addressLine1": {
                        "type": "string",
                        "description": "Address Line 1",
                        "example": "9931 Beechwood"
                      },
                      "addressLine2": {
                        "type": "string",
                        "description": "Address Line 2",
                        "example": "Beechwood"
                      },
                      "city": {
                        "type": "string",
                        "description": "City",
                        "example": "St. Houston"
                      },
                      "state": {
                        "type": "string",
                        "description": "State",
                        "example": "TX"
                      },
                      "countryCode": {
                        "type": "string",
                        "description": "Country Code",
                        "example": "US"
                      },
                      "postalCode": {
                        "type": "string",
                        "description": "Postal Code",
                        "example": "559-6993"
                      }
                    },
                    "title": "AddressDto"
                  }
                ]
              },
              "website": {
                "type": "string",
                "description": "Business Website Link",
                "example": "wwww.example.com"
              },
              "customValues": {
                "description": "Custom Values",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "title": "BusinessDetailsDto"
          }
        },
        "required": [
          "altId",
          "altType",
          "name",
          "currency",
          "items",
          "contactDetails",
          "issueDate",
          "sentTo",
          "liveMode",
          "action",
          "userId"
        ],
        "title": "Text2PayDto"
      },
      "Text2PayInvoiceResponseDto": {
        "type": "object",
        "properties": {
          "invoice": {
            "type": "object",
            "properties": {
              "_id": {
                "type": "string",
                "description": "Invoice Id",
                "example": "6578278e879ad2646715ba9c"
              },
              "status": {
                "type": "string",
                "description": "Invoice Status",
                "example": "draft",
                "enum": [
                  "draft",
                  "sent",
                  "payment_processing",
                  "paid",
                  "void",
                  "partially_paid"
                ]
              },
              "liveMode": {
                "type": "boolean",
                "description": "Live Mode",
                "example": false
              },
              "amountPaid": {
                "type": "number",
                "description": "Amount Paid",
                "example": 0
              },
              "altId": {
                "type": "string",
                "description": "Location Id or Agency Id",
                "example": "6578278e879ad2646715ba9c"
              },
              "altType": {
                "type": "string",
                "enum": [
                  "location"
                ]
              },
              "name": {
                "type": "string",
                "description": "Name of the invoice",
                "example": "New Invoice"
              },
              "businessDetails": {
                "type": "object",
                "description": "Business Details",
                "example": {
                  "name": "Alex",
                  "address": {
                    "addressLine1": "9931 Beechwood",
                    "city": "St. Houston",
                    "state": "TX",
                    "countryCode": "USA",
                    "postalCode": "559-6993"
                  },
                  "phoneNo": "+1-214-559-6993",
                  "website": "www.example.com"
                }
              },
              "invoiceNumber": {
                "type": "number",
                "description": "Invoice Number",
                "example": "19"
              },
              "currency": {
                "type": "string",
                "description": "Currency",
                "example": "USD"
              },
              "contactDetails": {
                "type": "object",
                "description": "Contact Details",
                "example": {
                  "id": "c6tZZU0rJBf30ZXx9Gli",
                  "phoneNo": "+1-214-559-6993",
                  "email": "alex@example.com",
                  "customFields": [],
                  "name": "Alex",
                  "address": {
                    "countryCode": "US"
                  }
                }
              },
              "issueDate": {
                "type": "string",
                "description": "Issue date in YYYY-MM-DD format",
                "example": "2023-01-01"
              },
              "dueDate": {
                "type": "string",
                "description": "Due date in YYYY-MM-DD format",
                "example": "2023-01-01"
              },
              "discount": {
                "type": "object",
                "description": "Discount",
                "example": {
                  "type": "percentage",
                  "value": 0
                }
              },
              "invoiceItems": {
                "description": "Invoice Items",
                "example": [
                  {
                    "taxes": [],
                    "_id": "c6tZZU0rJBf30ZXx9Gli",
                    "productId": "c6tZZU0rJBf30ZXx9Gli",
                    "priceId": "c6tZZU0rJBf30ZXx9Gli",
                    "currency": "USD",
                    "name": "Macbook Pro",
                    "qty": 1,
                    "amount": 999
                  }
                ],
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "total": {
                "type": "number",
                "description": "Total Amount",
                "example": 999
              },
              "title": {
                "type": "string",
                "description": "Title",
                "example": "INVOICE"
              },
              "amountDue": {
                "type": "number",
                "description": "Total Amount Due",
                "example": 999
              },
              "createdAt": {
                "type": "string",
                "description": "created at",
                "example": "2023-12-12T09:27:42.355Z"
              },
              "updatedAt": {
                "type": "string",
                "description": "updated at",
                "example": "2023-12-12T09:27:42.355Z"
              },
              "automaticTaxesEnabled": {
                "type": "boolean",
                "description": "Automatic taxes enabled for the Invoice",
                "example": true
              },
              "automaticTaxesCalculated": {
                "type": "boolean",
                "description": "Is Automatic taxes calculated for the Invoice items",
                "example": true
              },
              "paymentSchedule": {
                "type": "object",
                "description": "split invoice into payment schedule summing up to full invoice amount"
              }
            },
            "required": [
              "_id",
              "status",
              "liveMode",
              "amountPaid",
              "altId",
              "altType",
              "name",
              "businessDetails",
              "invoiceNumber",
              "currency",
              "contactDetails",
              "issueDate",
              "dueDate",
              "invoiceItems",
              "total",
              "title",
              "amountDue",
              "createdAt",
              "updatedAt"
            ],
            "title": "DefaultInvoiceResponseDto"
          },
          "invoiceUrl": {
            "type": "string",
            "description": "preview url of generated invoice"
          }
        },
        "required": [
          "invoice",
          "invoiceUrl"
        ],
        "title": "Text2PayInvoiceResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/invoices/text2pay' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "location",
  "name": "New Invoice",
  "currency": "USD",
  "items": [
    {
      "name": "ABC Product",
      "description": "ABC Corp.",
      "productId": "6578278e879ad2646715ba9c",
      "priceId": "6578278e879ad2646715ba9c",
      "currency": "USD",
      "amount": 999,
      "qty": 1,
      "taxes": [],
      "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
      "type": "one_time",
      "taxInclusive": true
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "contactDetails": {
    "id": "6578278e879ad2646715ba9c",
    "name": "Alex",
    "phoneNo": "+1234567890",
    "email": "alex@example.com",
    "additionalEmails": [
      {
        "email": "alex@example.com"
      }
    ],
    "companyName": "ABC Corp.",
    "address": {
      "addressLine1": "9931 Beechwood",
      "addressLine2": "Beechwood",
      "city": "St. Houston",
      "state": "TX",
      "countryCode": "US",
      "postalCode": "559-6993"
    },
    "customFields": []
  },
  "invoiceNumber": "1001",
  "issueDate": "2023-01-01",
  "dueDate": "2023-01-14",
  "sentTo": {
    "email": [
      "alex@example.com"
    ],
    "emailCc": [
      "alex@example.com"
    ],
    "emailBcc": [
      "alex@example.com"
    ],
    "phoneNo": [
      "+1-214-559-6993"
    ]
  },
  "automaticTaxesEnabled": true,
  "paymentSchedule": {
    "type": "percentage",
    "schedules": []
  },
  "lateFeesConfiguration": {
    "enable": true,
    "value": 10,
    "type": "fixed",
    "frequency": {
      "intervalCount": 10,
      "interval": "day"
    },
    "grace": {
      "intervalCount": 10,
      "interval": "day"
    },
    "maxLateFees": {
      "type": "fixed",
      "value": "10"
    }
  },
  "tipsConfiguration": {
    "tipsPercentage": [
      5,
      10,
      15
    ],
    "tipsEnabled": true
  },
  "invoiceNumberPrefix": "INV-",
  "paymentMethods": {
    "stripe": {
      "enableBankDebitOnly": false
    }
  },
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "size": 10000
    }
  ],
  "miscellaneousCharges": {
    "charges": [
      []
    ],
    "collectedMiscellaneousCharges": 10,
    "paidCharges": [
      {
        "name": "Processing Fee",
        "charge": 10,
        "amount": 10,
        "_id": "673d01d7d547648a8dab6211"
      }
    ]
  },
  "includeTermsNote": true,
  "action": "draft",
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "businessDetails": {
    "logoUrl": "https://example.com/logo.png",
    "name": "ABC Corp.",
    "phoneNo": "+1-214-559-6993",
    "address": "9931 Beechwood, TX",
    "website": "wwww.example.com",
    "customValues": []
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "altId": "6578278e879ad2646715ba9c",
      "altType": "location",
      "name": "New Invoice",
      "currency": "USD",
      "items": [
        {
          "name": "ABC Product",
          "description": "ABC Corp.",
          "productId": "6578278e879ad2646715ba9c",
          "priceId": "6578278e879ad2646715ba9c",
          "currency": "USD",
          "amount": 999,
          "qty": 1,
          "taxes": [],
          "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
          "type": "one_time",
          "taxInclusive": true
        }
      ],
      "termsNotes": "<p>This is a default terms.</p>",
      "title": "INVOICE",
      "contactDetails": {
        "id": "6578278e879ad2646715ba9c",
        "name": "Alex",
        "phoneNo": "+1234567890",
        "email": "alex@example.com",
        "additionalEmails": [
          {
            "email": "alex@example.com"
          }
        ],
        "companyName": "ABC Corp.",
        "address": {
          "addressLine1": "9931 Beechwood",
          "addressLine2": "Beechwood",
          "city": "St. Houston",
          "state": "TX",
          "countryCode": "US",
          "postalCode": "559-6993"
        },
        "customFields": []
      },
      "invoiceNumber": "1001",
      "issueDate": "2023-01-01",
      "dueDate": "2023-01-14",
      "sentTo": {
        "email": [
          "alex@example.com"
        ],
        "emailCc": [
          "alex@example.com"
        ],
        "emailBcc": [
          "alex@example.com"
        ],
        "phoneNo": [
          "+1-214-559-6993"
        ]
      },
      "automaticTaxesEnabled": true,
      "paymentSchedule": {
        "type": "percentage",
        "schedules": []
      },
      "lateFeesConfiguration": {
        "enable": true,
        "value": 10,
        "type": "fixed",
        "frequency": {
          "intervalCount": 10,
          "interval": "day"
        },
        "grace": {
          "intervalCount": 10,
          "interval": "day"
        },
        "maxLateFees": {
          "type": "fixed",
          "value": "10"
        }
      },
      "tipsConfiguration": {
        "tipsPercentage": [
          5,
          10,
          15
        ],
        "tipsEnabled": true
      },
      "invoiceNumberPrefix": "INV-",
      "paymentMethods": {
        "stripe": {
          "enableBankDebitOnly": false
        }
      },
      "attachments": [
        {
          "id": "6241712be68f7a98102ba272",
          "name": "Electronics.pdf",
          "url": "https://example.com/digital-delivery",
          "size": 10000
        }
      ],
      "miscellaneousCharges": {
        "charges": [
          []
        ],
        "collectedMiscellaneousCharges": 10,
        "paidCharges": [
          {
            "name": "Processing Fee",
            "charge": 10,
            "amount": 10,
            "_id": "673d01d7d547648a8dab6211"
          }
        ]
      },
      "includeTermsNote": true,
      "action": "draft",
      "discount": {
        "value": 10,
        "type": "percentage",
        "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
      },
      "businessDetails": {
        "logoUrl": "https://example.com/logo.png",
        "name": "ABC Corp.",
        "phoneNo": "+1-214-559-6993",
        "address": "9931 Beechwood, TX",
        "website": "wwww.example.com",
        "customValues": []
      }
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/invoices/text2pay', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/invoices/text2pay"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "altId": "6578278e879ad2646715ba9c",
    "altType": "location",
    "name": "New Invoice",
    "currency": "USD",
    "items": [
        {
            "name": "ABC Product",
            "description": "ABC Corp.",
            "productId": "6578278e879ad2646715ba9c",
            "priceId": "6578278e879ad2646715ba9c",
            "currency": "USD",
            "amount": 999,
            "qty": 1,
            "taxes": [],
            "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
            "type": "one_time",
            "taxInclusive": true
        }
    ],
    "termsNotes": "<p>This is a default terms.</p>",
    "title": "INVOICE",
    "contactDetails": {
        "id": "6578278e879ad2646715ba9c",
        "name": "Alex",
        "phoneNo": "+1234567890",
        "email": "alex@example.com",
        "additionalEmails": [
            {
                "email": "alex@example.com"
            }
        ],
        "companyName": "ABC Corp.",
        "address": {
            "addressLine1": "9931 Beechwood",
            "addressLine2": "Beechwood",
            "city": "St. Houston",
            "state": "TX",
            "countryCode": "US",
            "postalCode": "559-6993"
        },
        "customFields": []
    },
    "invoiceNumber": "1001",
    "issueDate": "2023-01-01",
    "dueDate": "2023-01-14",
    "sentTo": {
        "email": [
            "alex@example.com"
        ],
        "emailCc": [
            "alex@example.com"
        ],
        "emailBcc": [
            "alex@example.com"
        ],
        "phoneNo": [
            "+1-214-559-6993"
        ]
    },
    "automaticTaxesEnabled": true,
    "paymentSchedule": {
        "type": "percentage",
        "schedules": []
    },
    "lateFeesConfiguration": {
        "enable": true,
        "value": 10,
        "type": "fixed",
        "frequency": {
            "intervalCount": 10,
            "interval": "day"
        },
        "grace": {
            "intervalCount": 10,
            "interval": "day"
        },
        "maxLateFees": {
            "type": "fixed",
            "value": "10"
        }
    },
    "tipsConfiguration": {
        "tipsPercentage": [
            5,
            10,
            15
        ],
        "tipsEnabled": true
    },
    "invoiceNumberPrefix": "INV-",
    "paymentMethods": {
        "stripe": {
            "enableBankDebitOnly": false
        }
    },
    "attachments": [
        {
            "id": "6241712be68f7a98102ba272",
            "name": "Electronics.pdf",
            "url": "https://example.com/digital-delivery",
            "size": 10000
        }
    ],
    "miscellaneousCharges": {
        "charges": [
            []
        ],
        "collectedMiscellaneousCharges": 10,
        "paidCharges": [
            {
                "name": "Processing Fee",
                "charge": 10,
                "amount": 10,
                "_id": "673d01d7d547648a8dab6211"
            }
        ]
    },
    "includeTermsNote": true,
    "action": "draft",
    "discount": {
        "value": 10,
        "type": "percentage",
        "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
    },
    "businessDetails": {
        "logoUrl": "https://example.com/logo.png",
        "name": "ABC Corp.",
        "phoneNo": "+1-214-559-6993",
        "address": "9931 Beechwood, TX",
        "website": "wwww.example.com",
        "customValues": []
    }
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/invoices/text2pay',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "location",
  "name": "New Invoice",
  "currency": "USD",
  "items": [
    {
      "name": "ABC Product",
      "description": "ABC Corp.",
      "productId": "6578278e879ad2646715ba9c",
      "priceId": "6578278e879ad2646715ba9c",
      "currency": "USD",
      "amount": 999,
      "qty": 1,
      "taxes": [],
      "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
      "type": "one_time",
      "taxInclusive": true
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "contactDetails": {
    "id": "6578278e879ad2646715ba9c",
    "name": "Alex",
    "phoneNo": "+1234567890",
    "email": "alex@example.com",
    "additionalEmails": [
      {
        "email": "alex@example.com"
      }
    ],
    "companyName": "ABC Corp.",
    "address": {
      "addressLine1": "9931 Beechwood",
      "addressLine2": "Beechwood",
      "city": "St. Houston",
      "state": "TX",
      "countryCode": "US",
      "postalCode": "559-6993"
    },
    "customFields": []
  },
  "invoiceNumber": "1001",
  "issueDate": "2023-01-01",
  "dueDate": "2023-01-14",
  "sentTo": {
    "email": [
      "alex@example.com"
    ],
    "emailCc": [
      "alex@example.com"
    ],
    "emailBcc": [
      "alex@example.com"
    ],
    "phoneNo": [
      "+1-214-559-6993"
    ]
  },
  "automaticTaxesEnabled": true,
  "paymentSchedule": {
    "type": "percentage",
    "schedules": []
  },
  "lateFeesConfiguration": {
    "enable": true,
    "value": 10,
    "type": "fixed",
    "frequency": {
      "intervalCount": 10,
      "interval": "day"
    },
    "grace": {
      "intervalCount": 10,
      "interval": "day"
    },
    "maxLateFees": {
      "type": "fixed",
      "value": "10"
    }
  },
  "tipsConfiguration": {
    "tipsPercentage": [
      5,
      10,
      15
    ],
    "tipsEnabled": true
  },
  "invoiceNumberPrefix": "INV-",
  "paymentMethods": {
    "stripe": {
      "enableBankDebitOnly": false
    }
  },
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "size": 10000
    }
  ],
  "miscellaneousCharges": {
    "charges": [
      []
    ],
    "collectedMiscellaneousCharges": 10,
    "paidCharges": [
      {
        "name": "Processing Fee",
        "charge": 10,
        "amount": 10,
        "_id": "673d01d7d547648a8dab6211"
      }
    ]
  },
  "includeTermsNote": true,
  "action": "draft",
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "businessDetails": {
    "logoUrl": "https://example.com/logo.png",
    "name": "ABC Corp.",
    "phoneNo": "+1-214-559-6993",
    "address": "9931 Beechwood, TX",
    "website": "wwww.example.com",
    "customValues": []
  }
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/invoices/text2pay")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"altId\":\"6578278e879ad2646715ba9c\",\"altType\":\"location\",\"name\":\"New Invoice\",\"currency\":\"USD\",\"items\":[{\"name\":\"ABC Product\",\"description\":\"ABC Corp.\",\"productId\":\"6578278e879ad2646715ba9c\",\"priceId\":\"6578278e879ad2646715ba9c\",\"currency\":\"USD\",\"amount\":999,\"qty\":1,\"taxes\":[],\"automaticTaxCategoryId\":\"6578278e879ad2646715ba9c\",\"type\":\"one_time\",\"taxInclusive\":true}],\"termsNotes\":\"<p>This is a default terms.</p>\",\"title\":\"INVOICE\",\"contactDetails\":{\"id\":\"6578278e879ad2646715ba9c\",\"name\":\"Alex\",\"phoneNo\":\"+1234567890\",\"email\":\"alex@example.com\",\"additionalEmails\":[{\"email\":\"alex@example.com\"}],\"companyName\":\"ABC Corp.\",\"address\":{\"addressLine1\":\"9931 Beechwood\",\"addressLine2\":\"Beechwood\",\"city\":\"St. Houston\",\"state\":\"TX\",\"countryCode\":\"US\",\"postalCode\":\"559-6993\"},\"customFields\":[]},\"invoiceNumber\":\"1001\",\"issueDate\":\"2023-01-01\",\"dueDate\":\"2023-01-14\",\"sentTo\":{\"email\":[\"alex@example.com\"],\"emailCc\":[\"alex@example.com\"],\"emailBcc\":[\"alex@example.com\"],\"phoneNo\":[\"+1-214-559-6993\"]},\"automaticTaxesEnabled\":true,\"paymentSchedule\":{\"type\":\"percentage\",\"schedules\":[]},\"lateFeesConfiguration\":{\"enable\":true,\"value\":10,\"type\":\"fixed\",\"frequency\":{\"intervalCount\":10,\"interval\":\"day\"},\"grace\":{\"intervalCount\":10,\"interval\":\"day\"},\"maxLateFees\":{\"type\":\"fixed\",\"value\":\"10\"}},\"tipsConfiguration\":{\"tipsPercentage\":[5,10,15],\"tipsEnabled\":true},\"invoiceNumberPrefix\":\"INV-\",\"paymentMethods\":{\"stripe\":{\"enableBankDebitOnly\":false}},\"attachments\":[{\"id\":\"6241712be68f7a98102ba272\",\"name\":\"Electronics.pdf\",\"url\":\"https://example.com/digital-delivery\",\"size\":10000}],\"miscellaneousCharges\":{\"charges\":[[]],\"collectedMiscellaneousCharges\":10,\"paidCharges\":[{\"name\":\"Processing Fee\",\"charge\":10,\"amount\":10,\"_id\":\"673d01d7d547648a8dab6211\"}]},\"includeTermsNote\":true,\"action\":\"draft\",\"discount\":{\"value\":10,\"type\":\"percentage\",\"validOnProductIds\":\"[ '6579751d56f60276e5bd4154' ]\"},\"businessDetails\":{\"logoUrl\":\"https://example.com/logo.png\",\"name\":\"ABC Corp.\",\"phoneNo\":\"+1-214-559-6993\",\"address\":\"9931 Beechwood, TX\",\"website\":\"wwww.example.com\",\"customValues\":[]}}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/invoices/text2pay"
  payload := strings.NewReader(`{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "location",
  "name": "New Invoice",
  "currency": "USD",
  "items": [
    {
      "name": "ABC Product",
      "description": "ABC Corp.",
      "productId": "6578278e879ad2646715ba9c",
      "priceId": "6578278e879ad2646715ba9c",
      "currency": "USD",
      "amount": 999,
      "qty": 1,
      "taxes": [],
      "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
      "type": "one_time",
      "taxInclusive": true
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "contactDetails": {
    "id": "6578278e879ad2646715ba9c",
    "name": "Alex",
    "phoneNo": "+1234567890",
    "email": "alex@example.com",
    "additionalEmails": [
      {
        "email": "alex@example.com"
      }
    ],
    "companyName": "ABC Corp.",
    "address": {
      "addressLine1": "9931 Beechwood",
      "addressLine2": "Beechwood",
      "city": "St. Houston",
      "state": "TX",
      "countryCode": "US",
      "postalCode": "559-6993"
    },
    "customFields": []
  },
  "invoiceNumber": "1001",
  "issueDate": "2023-01-01",
  "dueDate": "2023-01-14",
  "sentTo": {
    "email": [
      "alex@example.com"
    ],
    "emailCc": [
      "alex@example.com"
    ],
    "emailBcc": [
      "alex@example.com"
    ],
    "phoneNo": [
      "+1-214-559-6993"
    ]
  },
  "automaticTaxesEnabled": true,
  "paymentSchedule": {
    "type": "percentage",
    "schedules": []
  },
  "lateFeesConfiguration": {
    "enable": true,
    "value": 10,
    "type": "fixed",
    "frequency": {
      "intervalCount": 10,
      "interval": "day"
    },
    "grace": {
      "intervalCount": 10,
      "interval": "day"
    },
    "maxLateFees": {
      "type": "fixed",
      "value": "10"
    }
  },
  "tipsConfiguration": {
    "tipsPercentage": [
      5,
      10,
      15
    ],
    "tipsEnabled": true
  },
  "invoiceNumberPrefix": "INV-",
  "paymentMethods": {
    "stripe": {
      "enableBankDebitOnly": false
    }
  },
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "size": 10000
    }
  ],
  "miscellaneousCharges": {
    "charges": [
      []
    ],
    "collectedMiscellaneousCharges": 10,
    "paidCharges": [
      {
        "name": "Processing Fee",
        "charge": 10,
        "amount": 10,
        "_id": "673d01d7d547648a8dab6211"
      }
    ]
  },
  "includeTermsNote": true,
  "action": "draft",
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "businessDetails": {
    "logoUrl": "https://example.com/logo.png",
    "name": "ABC Corp.",
    "phoneNo": "+1-214-559-6993",
    "address": "9931 Beechwood, TX",
    "website": "wwww.example.com",
    "customValues": []
  }
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/invoices/text2pay")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "location",
  "name": "New Invoice",
  "currency": "USD",
  "items": [
    {
      "name": "ABC Product",
      "description": "ABC Corp.",
      "productId": "6578278e879ad2646715ba9c",
      "priceId": "6578278e879ad2646715ba9c",
      "currency": "USD",
      "amount": 999,
      "qty": 1,
      "taxes": [],
      "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
      "type": "one_time",
      "taxInclusive": true
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "contactDetails": {
    "id": "6578278e879ad2646715ba9c",
    "name": "Alex",
    "phoneNo": "+1234567890",
    "email": "alex@example.com",
    "additionalEmails": [
      {
        "email": "alex@example.com"
      }
    ],
    "companyName": "ABC Corp.",
    "address": {
      "addressLine1": "9931 Beechwood",
      "addressLine2": "Beechwood",
      "city": "St. Houston",
      "state": "TX",
      "countryCode": "US",
      "postalCode": "559-6993"
    },
    "customFields": []
  },
  "invoiceNumber": "1001",
  "issueDate": "2023-01-01",
  "dueDate": "2023-01-14",
  "sentTo": {
    "email": [
      "alex@example.com"
    ],
    "emailCc": [
      "alex@example.com"
    ],
    "emailBcc": [
      "alex@example.com"
    ],
    "phoneNo": [
      "+1-214-559-6993"
    ]
  },
  "automaticTaxesEnabled": true,
  "paymentSchedule": {
    "type": "percentage",
    "schedules": []
  },
  "lateFeesConfiguration": {
    "enable": true,
    "value": 10,
    "type": "fixed",
    "frequency": {
      "intervalCount": 10,
      "interval": "day"
    },
    "grace": {
      "intervalCount": 10,
      "interval": "day"
    },
    "maxLateFees": {
      "type": "fixed",
      "value": "10"
    }
  },
  "tipsConfiguration": {
    "tipsPercentage": [
      5,
      10,
      15
    ],
    "tipsEnabled": true
  },
  "invoiceNumberPrefix": "INV-",
  "paymentMethods": {
    "stripe": {
      "enableBankDebitOnly": false
    }
  },
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "size": 10000
    }
  ],
  "miscellaneousCharges": {
    "charges": [
      []
    ],
    "collectedMiscellaneousCharges": 10,
    "paidCharges": [
      {
        "name": "Processing Fee",
        "charge": 10,
        "amount": 10,
        "_id": "673d01d7d547648a8dab6211"
      }
    ]
  },
  "includeTermsNote": true,
  "action": "draft",
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "businessDetails": {
    "logoUrl": "https://example.com/logo.png",
    "name": "ABC Corp.",
    "phoneNo": "+1-214-559-6993",
    "address": "9931 Beechwood, TX",
    "website": "wwww.example.com",
    "customValues": []
  }
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "altId": "6578278e879ad2646715ba9c",
  "altType": "location",
  "name": "New Invoice",
  "currency": "USD",
  "items": [
    {
      "name": "ABC Product",
      "description": "ABC Corp.",
      "productId": "6578278e879ad2646715ba9c",
      "priceId": "6578278e879ad2646715ba9c",
      "currency": "USD",
      "amount": 999,
      "qty": 1,
      "taxes": [],
      "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
      "type": "one_time",
      "taxInclusive": true
    }
  ],
  "termsNotes": "<p>This is a default terms.</p>",
  "title": "INVOICE",
  "contactDetails": {
    "id": "6578278e879ad2646715ba9c",
    "name": "Alex",
    "phoneNo": "+1234567890",
    "email": "alex@example.com",
    "additionalEmails": [
      {
        "email": "alex@example.com"
      }
    ],
    "companyName": "ABC Corp.",
    "address": {
      "addressLine1": "9931 Beechwood",
      "addressLine2": "Beechwood",
      "city": "St. Houston",
      "state": "TX",
      "countryCode": "US",
      "postalCode": "559-6993"
    },
    "customFields": []
  },
  "invoiceNumber": "1001",
  "issueDate": "2023-01-01",
  "dueDate": "2023-01-14",
  "sentTo": {
    "email": [
      "alex@example.com"
    ],
    "emailCc": [
      "alex@example.com"
    ],
    "emailBcc": [
      "alex@example.com"
    ],
    "phoneNo": [
      "+1-214-559-6993"
    ]
  },
  "automaticTaxesEnabled": true,
  "paymentSchedule": {
    "type": "percentage",
    "schedules": []
  },
  "lateFeesConfiguration": {
    "enable": true,
    "value": 10,
    "type": "fixed",
    "frequency": {
      "intervalCount": 10,
      "interval": "day"
    },
    "grace": {
      "intervalCount": 10,
      "interval": "day"
    },
    "maxLateFees": {
      "type": "fixed",
      "value": "10"
    }
  },
  "tipsConfiguration": {
    "tipsPercentage": [
      5,
      10,
      15
    ],
    "tipsEnabled": true
  },
  "invoiceNumberPrefix": "INV-",
  "paymentMethods": {
    "stripe": {
      "enableBankDebitOnly": false
    }
  },
  "attachments": [
    {
      "id": "6241712be68f7a98102ba272",
      "name": "Electronics.pdf",
      "url": "https://example.com/digital-delivery",
      "size": 10000
    }
  ],
  "miscellaneousCharges": {
    "charges": [
      []
    ],
    "collectedMiscellaneousCharges": 10,
    "paidCharges": [
      {
        "name": "Processing Fee",
        "charge": 10,
        "amount": 10,
        "_id": "673d01d7d547648a8dab6211"
      }
    ]
  },
  "includeTermsNote": true,
  "action": "draft",
  "discount": {
    "value": 10,
    "type": "percentage",
    "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
  },
  "businessDetails": {
    "logoUrl": "https://example.com/logo.png",
    "name": "ABC Corp.",
    "phoneNo": "+1-214-559-6993",
    "address": "9931 Beechwood, TX",
    "website": "wwww.example.com",
    "customValues": []
  }
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/invoices/text2pay' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
