# Credit Grants ## Create **post** `/v1/credits/createGrant` Create a new credit grant ### Returns - **data:** `ID` ## List **post** `/v1/credits/listGrants` List credit grants. This list does not included voided grants. ### Returns - **data:** `array of object` - **next\_page:** `string` ## Edit **post** `/v1/credits/editGrant` Edit an existing credit grant ### Returns - **data:** `ID` ## List Entries **post** `/v1/credits/listEntries` Fetches a list of credit ledger entries. Returns lists of ledgers per customer. Ledger entries are returned in chronological order. Ledger entries associated with voided credit grants are not included. ### Returns - **data:** `array of object` - **customer\_id:** `string` - **ledgers:** `array of object` - **credit\_type:** `CreditTypeData` - **ending\_balance:** `object` the effective balances at the end of the specified time window - **effective\_at:** `string` the ending_before request parameter (if supplied) or the current billing period's end date - **excluding\_pending:** `number` the ending balance, including the balance of all grants that have not expired before the effective_at date and deductions that happened before the effective_at date - **including\_pending:** `number` the excluding_pending balance plus any pending invoice deductions and expirations that will happen by the effective_at date - **entries:** `array of CreditLedgerEntry` - **pending\_entries:** `array of CreditLedgerEntry` - **starting\_balance:** `object` - **effective\_at:** `string` the starting_on request parameter (if supplied) or the first credit grant's effective_at date - **excluding\_pending:** `number` the starting balance, including all posted grants, deductions, and expirations that happened at or before the effective_at timestamp - **including\_pending:** `number` the excluding_pending balance plus any pending activity that has not been posted at the time of the query - **next\_page:** `string` ## Void **post** `/v1/credits/voidGrant` Void a credit grant ### Returns - **data:** `ID` ## Domain Types ### Credit Ledger Entry - **CreditLedgerEntry:** `object` - **amount:** `number` an amount representing the change to the customer's credit balance - **created\_by:** `string` - **credit\_grant\_id:** `string` the credit grant this entry is related to - **effective\_at:** `string` - **reason:** `string` - **running\_balance:** `number` the running balance for this credit type at the time of the ledger entry, including all preceding charges - **invoice\_id:** `string` if this entry is a deduction, the Metronome ID of the invoice where the credit deduction was consumed; if this entry is a grant, the Metronome ID of the invoice where the grant's paid_amount was charged ### Rollover Amount Max Amount - **RolloverAmountMaxAmount:** `object` - **type:** `"MAX_AMOUNT"` Rollover up to a fixed amount of the original credit grant amount. - `"MAX_AMOUNT"` - **value:** `number` The maximum amount to rollover. ### Rollover Amount Max Percentage - **RolloverAmountMaxPercentage:** `object` - **type:** `"MAX_PERCENTAGE"` Rollover up to a percentage of the original credit grant amount. - `"MAX_PERCENTAGE"` - **value:** `number` The maximum percentage (0-1) of the original credit grant to rollover.