-
-
Notifications
You must be signed in to change notification settings - Fork 37
12 Customers examples
Victor Hugo Avelar Ossorio edited this page Mar 6, 2024
·
1 revision
package main
import (
"context"
"log"
"github.com/VictorAvelar/mollie-api-go/v4/mollie"
)
func main() {
config := mollie.NewAPITestingConfig(true)
client, err := mollie.NewClient(nil, config)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
response, customer, err := client.Customers.Create(ctx, mollie.CreateCustomer{
Name: "John Doe",
Email: "[email protected]",
Locale: mollie.EnglishGB,
})
if err != nil {
log.Fatal(err)
}
log.Println(response.Body)
log.Println(customer)
}
package main
import (
"context"
"log"
"github.com/VictorAvelar/mollie-api-go/v4/mollie"
)
func main() {
config := mollie.NewAPITestingConfig(true)
client, err := mollie.NewClient(nil, config)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
customerID := "cst_test_id"
response, customer, err := client.Customers.Update(ctx, customerID, mollie.UpdateCustomer{
Locale: mollie.German,
})
if err != nil {
log.Fatal(err)
}
log.Println(response.Body)
log.Println(customer)
}
package main
import (
"context"
"log"
"github.com/VictorAvelar/mollie-api-go/v4/mollie"
)
func main() {
config := mollie.NewAPITestingConfig(true)
client, err := mollie.NewClient(nil, config)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
response, customers, err := client.Customers.List(ctx, &mollie.CustomersListOptions{})
if err != nil {
log.Fatal(err)
}
log.Println(response.Body)
for _, customer := range customers.Embedded.Customers {
log.Println(customer)
}
}