## List `client.V1.CreditGrants.List(ctx, params) (*CursorPage[V1CreditGrantListResponse], error)` **post** `/v1/credits/listGrants` List credit grants. This list does not included voided grants. ### Parameters - **params:** `V1CreditGrantListParams` - **Limit:** `param.Field[int64]` Query param: Max number of results that should be returned - **NextPage:** `param.Field[string]` Query param: Cursor that indicates where the next page of results should start. - **CreditGrantIDs:** `param.Field[[]string]` Body param: An array of credit grant IDs. If this is specified, neither credit_type_ids nor customer_ids may be specified. - **CreditTypeIDs:** `param.Field[[]string]` Body param: An array of credit type IDs. This must not be specified if credit_grant_ids is specified. - **CustomerIDs:** `param.Field[[]string]` Body param: An array of Metronome customer IDs. This must not be specified if credit_grant_ids is specified. - **EffectiveBefore:** `param.Field[Time]` Body param: Only return credit grants that are effective before this timestamp (exclusive). - **NotExpiringBefore:** `param.Field[Time]` Body param: Only return credit grants that expire at or after this timestamp. ### Returns - Not supported - **ID:** `string` the Metronome ID of the credit grant - **Balance:** `V1CreditGrantListResponseBalance` The effective balance of the grant as of the end of the customer's current billing period. Expiration deductions will be included only if the grant expires before the end of the current billing period. - **EffectiveAt:** `Time` The end_date of the customer's current billing period. - **ExcludingPending:** `float64` The grant's current balance including all posted deductions. If the grant has expired, this amount will be 0. - **IncludingPending:** `float64` The grant's current balance including all posted and pending deductions. If the grant expires before the end of the customer's current billing period, this amount will be 0. - **CustomFields:** `map[string, string]` - **CustomerID:** `string` the Metronome ID of the customer - **Deductions:** `[]CreditLedgerEntry` - **Amount:** `float64` an amount representing the change to the customer's credit balance - **CreatedBy:** `string` - **CreditGrantID:** `string` the credit grant this entry is related to - **EffectiveAt:** `Time` - **Reason:** `string` - **RunningBalance:** `float64` the running balance for this credit type at the time of the ledger entry, including all preceding charges - **InvoiceID:** `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 - **EffectiveAt:** `Time` - **ExpiresAt:** `Time` - **GrantAmount:** `V1CreditGrantListResponseGrantAmount` the amount of credits initially granted - **Amount:** `float64` - **CreditType:** `CreditTypeData` the credit type for the amount granted - **Name:** `string` - **PaidAmount:** `V1CreditGrantListResponsePaidAmount` the amount paid for this credit grant - **Amount:** `float64` - **CreditType:** `CreditTypeData` the credit type for the amount paid - **PendingDeductions:** `[]CreditLedgerEntry` - **Amount:** `float64` an amount representing the change to the customer's credit balance - **CreatedBy:** `string` - **CreditGrantID:** `string` the credit grant this entry is related to - **EffectiveAt:** `Time` - **Reason:** `string` - **RunningBalance:** `float64` the running balance for this credit type at the time of the ledger entry, including all preceding charges - **InvoiceID:** `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 - **Priority:** `float64` - **CreditGrantType:** `string` - **InvoiceID:** `string` the Metronome ID of the invoice with the purchase charge for this credit grant, if applicable - **Products:** `[]V1CreditGrantListResponseProduct` The products which these credits will be applied to. (If unspecified, the credits will be applied to charges for all products.) - **ID:** `string` - **Name:** `string` - **Reason:** `string` - **UniquenessKey:** `string` Prevents the creation of duplicates. If a request to create a record is made with a previously used uniqueness key, a new record will not be created and the request will fail with a 409 error. ### Example ```go package main import ( "context" "fmt" "time" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.V1.CreditGrants.List(context.TODO(), metronome.V1CreditGrantListParams{ CreditTypeIDs: metronome.F([]string{"2714e483-4ff1-48e4-9e25-ac732e8f24f2"}), CustomerIDs: metronome.F([]string{"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc", "0e5b8609-d901-4992-b394-c3c2e3f37b1c"}), EffectiveBefore: metronome.F(time.Now()), NotExpiringBefore: metronome.F(time.Now()), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ```