Create
Create a customer
Create a new customer
Parameters
Hide ParametersShow Parameters
This will be truncated to 160 characters if the provided name is longer.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
True if the aws_product_code is a SAAS subscription product, false otherwise.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
The billing provider set for this configuration.
Hide ParametersShow Parameters
Configuration for the billing provider. The structure of this object is specific to the billing provider and delivery provider combination. Defaults to an empty object, however, for most billing provider + delivery method combinations, it will not be a valid configuration.
The method to use for delivering invoices to this customer. If not provided, the delivery_method_id must be provided.
Hide ParametersShow Parameters
ID of the delivery method to use for this customer. If not provided, the delivery_method must be provided.
(deprecated, use ingest_aliases instead) an alias that can be used to refer to this customer in usage events
Aliases that can be used to refer to this customer in usage events
Returns
Hide ParametersShow Parameters
package main
import (
"context"
"fmt"
"github.com/Metronome-Industries/metronome-go"
"github.com/Metronome-Industries/metronome-go/option"
)
func main() {
client := metronome.NewClient(
option.WithBearerToken("My Bearer Token"),
)
customer, err := client.V1.Customers.New(context.TODO(), metronome.V1CustomerNewParams{
Name: metronome.F("Example, Inc."),
CustomerBillingProviderConfigurations: metronome.F([]metronome.V1CustomerNewParamsCustomerBillingProviderConfiguration{metronome.V1CustomerNewParamsCustomerBillingProviderConfiguration{
BillingProvider: metronome.F(metronome.V1CustomerNewParamsCustomerBillingProviderConfigurationsBillingProviderStripe),
DeliveryMethod: metronome.F(metronome.V1CustomerNewParamsCustomerBillingProviderConfigurationsDeliveryMethodDirectToBillingProvider),
Configuration: metronome.F(map[string]interface{}{
"stripe_customer_id": "cus_123",
"stripe_collection_method": "charge_automatically",
}),
}}),
IngestAliases: metronome.F([]string{"[email protected]"}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customer.Data)
}
{
"data": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"external_id": "external_id",
"ingest_aliases": [
"string"
],
"name": "name",
"custom_fields": {
"foo": "string"
}
}
}