POST https://services.leadconnectorhq.com/invoices/text2pay
Autorización
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
string
default:"2021-07-28"
required
Versión de la API.
Body
string
default:"6578278e879ad2646715ba9c"
required
account Id / company Id based on altType
string
default:"account"
required
Alt Type Posibles valores: ‘account’
string
default:"New Invoice"
required
Invoice Name
string
default:"USD"
required
Currency code
object[]
required
An array of items for the invoice.
Show cada item
Show cada item
string
default:"ABC Product"
required
Invoice Item Name
string
default:"ABC Corp."
Invoice descriptions
string
default:"6578278e879ad2646715ba9c"
Product Id
string
default:"6578278e879ad2646715ba9c"
Price Id
string
default:"USD"
required
Currency
number
default:"999"
required
Product amount
number
default:"1"
required
Product Quantity
object[]
string
default:"6578278e879ad2646715ba9c"
Tax category id for calculating automatic tax
boolean
Setupfee item, only created when 1st invoice of recurring schedule is generated
string
default:"one_time"
Price type of the item Posibles valores: ‘one_time’, ‘recurring’
boolean
default:"True"
true if item amount is tax inclusive
string
default:"<p>This is a default terms.</p>"
Terms notes, Also supports HTML markups
string
default:"INVOICE"
Title for the invoice
object
required
Contact information to send the invoice to
string
default:"1001"
Invoice Number
string
default:"2023-01-01"
required
Issue date in YYYY-MM-DD format
string
default:"2023-01-14"
Due date in YYYY-MM-DD format
object
required
boolean
required
boolean
default:"True"
Automatic taxes enabled for the Invoice
object
split invoice into payment schedule summing up to full invoice amount
object
late fees configuration
object
tips configuration for the invoice
string
default:"INV-"
prefix for invoice number
object
Payment Methods for Invoices
object[]
attachments for the invoice
object
miscellaneous charges for the invoice
string
id of invoice to update. If skipped, a new invoice will be created
boolean
default:"True"
include terms & notes with receipts
string
default:"draft"
required
create invoice in draft mode or send mode Posibles valores: ‘draft’, ‘send’
string
required
id of user generating invoice
object
object
Respuestas
200 - Successful response
200 - Successful response
object
required
Show propiedades
Show propiedades
string
default:"6578278e879ad2646715ba9c"
required
Invoice Id
string
default:"draft"
required
Invoice Status Posibles valores: ‘draft’, ‘sent’, ‘payment_processing’, ‘paid’, ‘void’, ‘partially_paid’
boolean
default:"False"
required
Live Mode
number
default:"0"
required
Amount Paid
string
default:"6578278e879ad2646715ba9c"
required
Account Id or Agency Id
string
required
Posibles valores: ‘account’
string
default:"New Invoice"
required
Name of the invoice
object
required
Business Details
number
default:"19"
required
Invoice Number
string
default:"USD"
required
Currency
object
required
Contact Details
string
default:"2023-01-01"
required
Issue date in YYYY-MM-DD format
string
default:"2023-01-01"
required
Due date in YYYY-MM-DD format
object
Discount
string[]
required
Invoice Items
number
default:"999"
required
Total Amount
string
default:"INVOICE"
required
Title
number
default:"999"
required
Total Amount Due
string
default:"2023-12-12T09:27:42.355Z"
required
created at
string
default:"2023-12-12T09:27:42.355Z"
required
updated at
boolean
default:"True"
Automatic taxes enabled for the Invoice
boolean
default:"True"
Is Automatic taxes calculated for the Invoice items
object
split invoice into payment schedule summing up to full invoice amount
string
required
preview url of generated invoice
{
"invoice": {
"_id": "6578278e879ad2646715ba9c",
"status": "draft",
"liveMode": false,
"amountPaid": 0,
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"name": "New Invoice",
"businessDetails": {
"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": "19",
"currency": "USD",
"contactDetails": {
"id": "c6tZZU0rJBf30ZXx9Gli",
"phoneNo": "+1-214-559-6993",
"email": "alex@example.com",
"customFields": [],
"name": "Alex",
"address": {
"countryCode": "US"
}
},
"issueDate": "2023-01-01",
"dueDate": "2023-01-01",
"discount": {
"type": "percentage",
"value": 0
},
// truncado: 23 lineas mas
}
400 - Bad Request
400 - Bad Request
{}
401 - Unauthorized
401 - Unauthorized
{}
422 - Unprocessable Entity
422 - Unprocessable Entity
{}
Ejemplo
curl -X POST 'https://services.leadconnectorhq.com/invoices/text2pay' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"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",
"isSetupFeeItem": true,
"type": "one_time",
"taxInclusive": true
}
],
"termsNotes": "<p>This is a default terms.</p>",
"title": "INVOICE",
"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"
]
},
"liveMode": true,
"automaticTaxesEnabled": true,
"invoiceNumberPrefix": "INV-",
"attachments": [
{
"id": "6241712be68f7a98102ba272",
"name": "Electronics.pdf",
"url": "https://example.com/digital-delivery",
"type": "string",
"size": 10000
}
],
"id": "string",
"includeTermsNote": true,
"action": "draft",
"userId": "string",
"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": [
"string"
]
}
}'
const response = await fetch('https://services.leadconnectorhq.com/invoices/text2pay', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "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", "isSetupFeeItem": true, "type": "one_time", "taxInclusive": true}], "termsNotes": "<p>This is a default terms.</p>", "title": "INVOICE", "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"]}, "liveMode": true, "automaticTaxesEnabled": true, "invoiceNumberPrefix": "INV-", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}], "id": "string", "includeTermsNote": true, "action": "draft", "userId": "string", "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": ["string"]}}),
});
const data = await response.json();
import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/invoices/text2pay',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "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", "isSetupFeeItem": true, "type": "one_time", "taxInclusive": true}], "termsNotes": "<p>This is a default terms.</p>", "title": "INVOICE", "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"]}, "liveMode": true, "automaticTaxesEnabled": true, "invoiceNumberPrefix": "INV-", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}], "id": "string", "includeTermsNote": true, "action": "draft", "userId": "string", "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": ["string"]}},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/invoices/text2pay');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', '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', 'isSetupFeeItem': true, 'type': 'one_time', 'taxInclusive': true}], 'termsNotes': '<p>This is a default terms.</p>', 'title': 'INVOICE', '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']}, 'liveMode': true, 'automaticTaxesEnabled': true, 'invoiceNumberPrefix': 'INV-', 'attachments': [{'id': '6241712be68f7a98102ba272', 'name': 'Electronics.pdf', 'url': 'https://example.com/digital-delivery', 'type': 'string', 'size': 10000}], 'id': 'string', 'includeTermsNote': true, 'action': 'draft', 'userId': 'string', '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': ['string']}}),
]);
$data = json_decode(curl_exec($ch), true);

