# Create Multiple Charges Create multiple charges in a single request. Use Case: Creating charges for multiple billable entities at once (e.g., batch from recurring billing). Atomicity: All charges are created in a single transaction. If any fails, all are rolled back. Endpoint: POST /charges/bulk Version: 1.0.0 Security: OAuth2 ## Header parameters: - `Idempotency-Key` (string) Unique key to ensure idempotent operations (UUID recommended) ## Request fields (application/json): - `charges` (array, required) Array of charges to create (max 100) - `charges.billableEntityId` (string, required) - `charges.subscriptionId` (string) - `charges.rateId` (string, required) - `charges.quantity` (number, required) - `charges.prorationFactor` (number) - `charges.allocationConfigId` (string, required) - `charges.discountRateIds` (array) - `charges.overrideAllocation` (object) - `charges.eventDate` (string, required) - `charges.tags` (object) ## Response 201 fields (application/json): - `data` (array) - `data.id` (string, required) - `data.entityId` (string, required) - `data.billableEntityId` (string, required) - `data.accountId` (string) Primary account for this charge (from allocation) - `data.subscriptionId` (string,null) Subscription that generated this charge (if any) - `data.rateId` (string, required) - `data.quantity` (number, required) - `data.amount` (integer, required) Amount in cents BEFORE discounts - `data.prorationFactor` (number) Proration factor (e.g., 0.5 for half month) - `data.proratedAmount` (integer) Amount after proration (in cents) - `data.netAmount` (integer, required) Final amount after discounts (in cents) - `data.discountRateIds` (array) - `data.discountAmounts` (array) Discount amounts in cents (parallel to discountRateIds) - `data.allocationConfigId` (string, required) - `data.overrideAllocation` (object) Manual allocation override (optional) - `data.status` (string, required) Status of mutable charge Enum: "PENDING", "BILLED", "VOID" - `data.eventDate` (string, required) Date of the event that generated this charge - `data.rateVersion` (integer) Version of rate when charge was created - `data.subscriptionVersion` (integer) Version of subscription when charge was created - `data.allocationVersion` (integer) Version of allocation config when charge was created - `data.discountRateVersions` (array) Versions of discount rates when charge was created (parallel to discountRateIds) - `data.tags` (object) - `data.optimisticLockVersion` (integer) Optimistic locking version (managed by Hibernate @Version). Prevents concurrent update conflicts. - `data.createdAt` (string, required) - `data.updatedAt` (string) - `created` (integer) Number of charges created ## Response 400 fields (application/json): - `type` (string) - `title` (string) - `status` (integer) - `detail` (string) - `errors` (array) - `errors.index` (integer) Index of failed charge in request array - `errors.code` (string) - `errors.message` (string) ## Response 401 fields (application/json): - `result` (object, required) - `result.status` (string, required) Response status (always ERROR for error responses) Enum: "ERROR" - `error` (object, required) - `error.responseCode` (string, required) Response code (numeric or contains numbers, e.g., "404", "409", "500", "ERR001") Example: "404" - `error.responseMessage` (array, required) Array of error message strings for multiple error details Example: ["Charge not found","The requested charge ID does not exist in the system"]