Overview
This guide provides a detailed migration path from v1 Create a Document to v2 Create a Document. It highlights key differences and necessary updates to ensure a smooth transition.
Key Changes in V2
1. Serial Number Handling
- v1:
serial_number(string)
- v2:
serial_number_v2(object)prefix: Prefix for document numbering (e.g.,INV-)doc_number: Numeric sequence (e.g.,1)suffix: Optional suffix (e.g.,-2024)
Action Required:
- If you do not send
serial_numberexplicitly, it will be auto-generated. prefix,suffix, anddoc_numberhave been separated in v2.- If values are provided, the serial number will be formatted as:
prefix + doc_number + suffix(e.g.,INV-1-2024). - Empty strings can be used for
prefixandsuffixif not needed. - If you require a specific
prefixbut do not want to senddoc_number, you can omitdoc_numberfrom the payload. A newdoc_numberwill be automatically generated for the given prefix. - More details on the schema.
2. Customer to Party Migration
- v1:
customer - v2:
party
Action Required:
- The key name has changed from
customertoparty. - The
partyobject must include aparty_type(customerorvendor) based on the document type. customer_billing_addressandcustomer_shipping_addressare now included in thepartyobject asbilling_addressandshipping_address.- More details on the schema.
3. Address Schema Changes
- v2 Updates:
- Added an
addr_idkey (must be between0and999999). - If the provided
addr_idalready exists, the existing address will be updated; otherwise, a new address will be created.
- Added an
4. Payments and Bank Details
Updates:
- Added
bank_detailsinside thepaymentsarray, allowing different details for each payment. bank_detailsprovided outside thepaymentskey will be used for displaying details on the PDF.- More details on the schema.
5. Items
Updates:
- Added support for custom columns using the
custom_columnskey. - To use
custom_columnsvia API, they must first be added in the Swipe Portal. - More details on the schema.
6. Additional Charges & Deductions
Updates:
- Added support for additional charges and deductions using the
charges_and_deductionskey (e.g., delivery charges, packing charges, etc.). - More details on the schema.
7. Export Fields
Updates:
- Added
currency_idtoexport_invoice_details. - More details on the schema.
8. Document Conversion
Updates:
- Added support for tracking document conversions using the
convertkey. - Example: Track which quotation was converted into a specific invoice.
- More details on the schema.
9. Document Custom Headers Support
Updates:
- Added support for custom document headers using the
custom_headerskey. - To enable this feature, document headers must first be added in the Swipe Portal.
- More details on the schema.
Summary of Required Updates
| V1 Field | Action Required | V2 Field |
|---|---|---|
serial_number |
Use serial_number_v2 |
serial_number_v2 |
customer |
Replace with party |
party |
| All address fields | Add addr_id key in each address |
All address fields |
items |
Introduce custom_columns if needed |
items |
| Additional charges (N/A) | Introduce if applicable | charges_and_deductions |
| Document custom headers (N/A) | Introduce if applicable | custom_headers |
| Convert documents (N/A) | Introduce if applicable | convert |