Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

Edit Credit

Edit a credit
client.V2.Contracts.EditCredit(ctx, body) (*DataIDV2ContractEditCreditResponse, error)
post/v2/contracts/credits/edit

Edit a customer or contract credit. Contract credits can only be edited using this endpoint if contract editing is enabled.

Parameters
bodyCreditIDfieldCustomerIDfieldAccessSchedulefieldApplicableProductIDsfieldApplicableProductTagsfieldPriorityfieldProductIDfieldSpecifiersfieldV2ContractEditCreditParams
Hide ParametersShow Parameters
CreditIDfield
param.Field[string]

ID of the credit to edit

formatuuid
CustomerIDfield
param.Field[string]

ID of the customer whose credit is being edited

formatuuid
AccessSchedulefield
optional
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Amountfloat64
EndingBeforeTime
formatdate-time
StartingAtTime
formatdate-time
Hide ParametersShow Parameters
IDstring
formatuuid
Hide ParametersShow Parameters
IDstring
formatuuid
Amountfloat64
optional
EndingBeforeTime
optional
formatdate-time
StartingAtTime
optional
formatdate-time
ApplicableProductIDsfield
optional
param.Field[[]string]

Which products the credit applies to. If both applicable_product_ids and applicable_product_tags are not provided, the credit applies to all products.

ApplicableProductTagsfield
optional
param.Field[[]string]

Which tags the credit applies to. If both applicable_product_ids and applicable_product_tags are not provided, the credit applies to all products.

Priorityfield
optional
param.Field[float64]

If multiple commits are applicable, the one with the lower priority will apply first.

ProductIDfield
optional
param.Field[string]
formatuuid
Specifiersfield
optional

List of filters that determine what kind of customer usage draws down a commit or credit. A customer's usage needs to meet the condition of at least one of the specifiers to contribute to a commit's or credit's drawdown. This field cannot be used together with applicable_product_ids or applicable_product_tags. Instead, to target usage by product or product tag, pass those values in the body of specifiers.

Hide ParametersShow Parameters
PresentationGroupValuesmap
optional
map[string, string]
PricingGroupValuesmap
optional
map[string, string]
ProductIDstring
optional

If provided, the specifier will only apply to the product with the specified ID.

formatuuid
ProductTagsarray
optional
[]string

If provided, the specifier will only apply to products with all the specified tags.

Returns
V2ContractEditCreditResponsestruct
Hide ParametersShow Parameters
DataIDstringID
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"),
  )
  response, err := client.V2.Contracts.EditCredit(context.TODO(), metronome.V2ContractEditCreditParams{
    CreditID: metronome.F("5e7e82cf-ccb7-428c-a96f-a8e4f67af822"),
    CustomerID: metronome.F("4c91c473-fc12-445a-9c38-40421d47023f"),
    AccessSchedule: metronome.F(metronome.V2ContractEditCreditParamsAccessSchedule{
      UpdateScheduleItems: metronome.F([]metronome.V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem{metronome.V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem{
        ID: metronome.F("d5edbd32-c744-48cb-9475-a9bca0e6fa39"),
        EndingBefore: metronome.F(time.Now()),
      }}),
    }),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Data)
}
200 Example
{
  "data": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  }
}