In marketplace setups where invoices are created on behalf of multiple vendors, legal requirements often demand strictly consecutive invoice numbers per vendor, without gaps, and optionally including vendor or date information.
A recommended approach in Emporix is to use the Sequential ID Service with a custom schema and placeholders.
That means:
-
Independent sequences per vendor: Each vendor maintains its own consecutive numbering.
-
Structured formatting: Include elements like vendor identifier or date via placeholders.
-
Configurable starting values: Start sequences from a defined number if required.
Abstract example:
<marketplace>-<vendor>-<sequenceNumber>-<date>
Produces separate sequences per vendor, for example:
marketplace-A-0001-YYYY-MM
marketplace-A-0002-YYYY-MM
marketplace-B-0001-YYYY-MM
marketplace-B-0002-YYYY-MM
Implementation approach:
-
Create a custom sequence schema in the Sequential ID Service.
-
Define placeholders such as
__vendor__and__date__. -
Pass placeholder values dynamically when generating invoice numbers.
Example cURL to create a schema (abstract):
curl -i -X POST \
https://api.emporix.io/sequential-id/sequenceSchemas \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"name": "invoiceSequence",
"schemaType": "invoice",
"preText": "<marketplace>-__vendor__",
"postText": "-__year__-__month__",
"maxValue": 999999999,
"numberOfDigits": 6,
"startValue": 1,
"placeholders": {
"__vendor__": { "required": true },
"__year__": { "required": true },
"__month__": { "required": true }
}
}'
This approach allows marketplaces to meet legal compliance, maintain flexibility, and avoid the need for a separate custom microservice.
Would love to hear if others have implemented similar vendor-specific sequences, or have additional best practices to share.