POST
/
v1
/
customers
package main

import(
	"context"
	"os"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := polargo.New(
        polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
    )

    res, err := s.Customers.Create(ctx, components.CustomerCreate{
        Email: "Loyal79@yahoo.com",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Customer != nil {
        // handle response
    }
}
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "metadata": {},
  "email": "<string>",
  "email_verified": true,
  "name": "<string>",
  "billing_address": {
    "line1": "<string>",
    "line2": "<string>",
    "postal_code": "<string>",
    "city": "<string>",
    "state": "<string>",
    "country": "<string>"
  },
  "tax_id": [
    "<any>"
  ],
  "organization_id": "<string>",
  "avatar_url": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
email
string
required
metadata
object

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A boolean

You can store up to 50 key-value pairs.

name
string | null
billing_address
object | null
tax_id
any[] | null
organization_id
string | null

The ID of the organization owning the customer. Required unless you use an organization token.

Response

201
application/json
Customer created.

A customer in an organization.

created_at
string
required

Creation timestamp of the object.

modified_at
string | null
required

Last modification timestamp of the object.

id
string
required

The ID of the object.

metadata
object
required
email
string
required
email_verified
boolean
required
name
string | null
required
billing_address
object | null
required
tax_id
any[] | null
required
organization_id
string
required
avatar_url
string
required