post https://apiprod.fattlabs.com/invoice
Creates an invoice
Creates an invoice for a customer, detailing items, taxes, memos, and more. Invoices can be sent immediately or saved as a draft for future editing and sending. Invoices generated through this endpoint can also integrate with the Stax Pay Hosted Invoice Page.
Key Features
- Generates an invoice tied to a specific customer.
- Can be sent immediately via email (
send_now=true
) or saved as a draft. - Integrates with the Stax Pay Hosted Invoice Page for customer payments.
- Supports custom fields for:
- Allowing credit card or ACH payments.
- Partial payments.
- Tips.
- Read-only memos for customers.
- Handles advanced use cases like Split Funding, distributing payments to multiple accounts.
Usage Notes
Immediate Sending
- Set
send_now=true
to send the invoice immediately. If omitted or set tofalse
, the invoice will save as a draft.
Stax Pay Hosted Invoice Page
- Combine the
url
andid
from the response to generate a hosted invoice page URL.
Example:https://app.staxpayments.com/#/bill/{id}
.
Customizing Hosted Invoice Pages
- The following customizations can be applied:
- Enable/disable credit card or ACH payment methods.
- Allow customers to make partial payments.
- Add a tip field for customers to leave tips.
- Include a read-only memo for customer reference (e.g., "Thank you for your business!").
Split Funding (Advanced)
- Distribute transaction funds to multiple bank accounts.
funding[n].account_id
: The ID of the funding account.funding[n].amount
: Amount to allocate to the account.- Total funding amounts must exactly equal the invoice
total
field.
Response Structure
Code | Response | Reason |
---|---|---|
201 | Created | Invoice successfully created. |
400 | Bad Request | Invalid invoice parameters or funding configuration. |
401 | Unauthorized | Authentication failed. |
422 | Unprocessable Entity | Split funding amounts do not match the invoice total. |
500 | Internal Server Error | Unexpected server error. |
Important Considerations
- Draft Invoices: Invoices saved as drafts can be updated or sent later using the
PUT /invoice/{id}/send
endpoint. - Customization: Configure hosted invoice pages in Stax Pay settings or during invoice creation via API.
- Split Funding: If funding fields are not provided, funds will default to the merchant's primary account.
meta.lineitems.*
: is restricted to the ID, Quantity, Price, Item name, and Description.