# Billing new collections
#### billingFeatures
| Field | Type | Description |
| -- | ----- | -- |
| billingFeatureId | Integer | Autoincrement |
| name | String | Billing feature name (old name - description) |
| code | String | Feature code |
| unit | String | Unit |
#### billingPlans
| Field | Type | Description |
| -- | ----- | -- |
| billingPlanId | Integer | Autoincrement |
| name | String | Plan name |
| parentPlanId | Integer | billingPlanId of parrent plan. For parrent plans = null |
| scope | Object | determines where CRUD operations on plan are allowed |
| - typeId | String | enum: "organization", "project", "workspace" |
| - id | Integer | Id of organization, project or workspace |
| - expirationDate | Date | Date till scope is valid |
| assignments | Object | determines where billing plan can be assigned |
| - typeId | String | enum: "organization", "project", "workspace" |
| - id | Integer | Id of organization, project or workspace |
| description | String | Description of plan |
| order | Integer | Sort order of plan in UI |
| billingFeatures | Array[{<br> billingFeatureId: Int,<br> includedCount: Int,<br> price: Float,<br> isBilledInAdvance: Boolean,<br> isHardlimit: Boolean<br>}] | billingFeatures, provided by plan |
#### workspaceBillingPlans
| Field | Type | Description |
| -- | ----- | -- |
| workspaceBillingPlanId | Integer | Autoincrement |
| workspaceId | Integer | |
| billingPlanId | Integer | |
| billingDayOfMonth | Integer | Day of payment process |
| billingDateStart | Date | Date when billingPlan starts |
| billingDateEnd | Date | Date when billingPlan ends |
#### billingStatements
| Field | Type | Description |
| -- | ----- | -- |
| billingStatementId | Integer | Autoincrement |
| assignment | Object | |
| - typeId | String | enum: "organization", "project", "workspace" |
| - id | Integer | Id of organization, project or workspace |
| startDate | Date | Date when invoice starts |
| endDate | Date | Date when invoice ends |
| beginningBalance | Float | |
| currentBalance | Float | |
| endingBalance | Float | |
| status | String | **current**- this is the current month and billing has not processed <br>**processing** - in billing process loop <br>**closed**- billing has completed<br>**null** - has not opened (future statement)|
| ledger | Object | |
| - debits | Array[{<br> billingFeatureId: Int,<br> billingPlanId: Int,<br> includedQuantity: Int,<br> usedQuantity: Int,<br> billedQuantity: Int,<br> amountPerItem: Float,<br> totalAmount: Float,<br> date: Date<br>}] | |
| - credits | Array[{<br> paymentTypeId: Int,<br> billingTransactionId: Int,<br> paymentDisplayName: String, <br> amount: Float,<br> date: Date<br>}] | |
#### billingInvoiceFeatureUtilizations
| Field | Type | Description |
| -- | ----- | -- |
| billingInvoiceFeatureUtilizationsId | Integer | Autoincrement |
| billingInvoiceId | Number | |
| billingPlanId | Number | |
| billingFeatureId | Number | |
| isHardLimit | Boolean | |
| includedQuantity | Number | |
| usedQuantity | Number | |
| maxUsedQuantity | Number | |
#### billingTransactions
| Field | Type | Description |
| -- | ----- | -- |
| billingTransactionId | Integer | Autoincrement |
| billingStatementId | Number | |
| billingPaymentProcessorId | Number | |
| date | Date | |
| amount | Float | |
| status | Number | enum: 0 - pending, 1 - payed, 2 - failed |
| billingPaymentTransactionId | Number | link to {processor}\_transactions|
| assignment | Object | |
| - typeId | String | enum: "organization", "project", "workspace" |
| - id | Integer | Id of organization, project or workspace |
#### stripe_Transactions
| Field | Type | Description |
| -- | ----- | -- |
| stripeTransactionId | Integer | Autoincrement |
| stripePaymentId | String | id of payment in stripe system |
| cardId | String | Card id in stripe system |
| stripeCustomerId | String | id of stripe customer|
| date | Date | |
| amount | Float | |
| status | Number | enum: 0 - pending, 1 - payed, 2 - failed |
#### stripe_Customers
| Field | Type | Description |
| -- | ----- | -- |
| stripe_CustomerId | Integer | Autoincrement |
| stripeCustomerId | String | |
| assignment | Object | |
| - typeId | String | enum: "organization", "project", "workspace" |
| - id | Integer | Id of organization, project or workspace |
#### billingCreditTransactions
| Field | Type | Description |
| -- | ----- | -- |
| billingCreditId | Integer | Autoincrement |
| date | Date | |
| amount | Float | |
| assignment | Object | |
| - typeId | String | enum: "organization", "project", "workspace" |
| - id | Integer | Id of organization, project or workspace |
#### billingPaymentProcessors
| Field | Type | Description |
| -- | ----- | -- |
| billingPaymentProcessors | Integer | Autoincrement |
| name | String | |