POST
/
v1
/
customer-sessions
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.CustomerSessions.Create(ctx, components.CustomerSessionCreate{
        CustomerID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.CustomerSession != nil {
        // handle response
    }
}
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "token": "<string>",
  "expires_at": "2023-11-07T05:31:56Z",
  "customer_portal_url": "<string>",
  "customer_id": "<string>",
  "customer": {
    "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

Schema for creating a customer session.

customer_id
string
required

ID of the customer to create a session for.

Response

201
application/json
Customer session created.

A customer session that can be used to authenticate as a customer.

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.

token
string
required
expires_at
string
required
customer_portal_url
string
required
customer_id
string
required
customer
object
required

A customer in an organization.